When working with views, I use instance methods of ApplicationHelper:

# app/helpers/application_helper.rb:
module ApplicationHelper
  def distribute(total, min, cutof, list)
    [1,2,3]
  end
end

# app/views/planner/_mta_colors.rhtml:
<td>
<%
...
dist = distribute(total_v_px, 4, 0, colors.collect{|color| color[1]})
...
%>

So to test the distribute method in ApplicationHelper, I have to extend my
spec models:
describe ApplicationHelper do
  extend(ApplicationHelper)
  it "doesn't find what it's looking for do
    distribute(1,2,3,[4,5,6]).should eql([1,2,3])
  end
end

This could use some documentation.


-- 
View this message in context: 
http://www.nabble.com/ApplicationHelper-tp16149622p16149622.html
Sent from the rspec-users mailing list archive at Nabble.com.

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to