[rspec-devel] [ rspec-Bugs-13741 ] Helper specs oddities, compared to controller and other specs

noreply at rubyforge.org noreply at rubyforge.org
Fri Sep 7 04:05:19 EDT 2007


Bugs item #13741, was opened at 2007-09-07 10:05
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13741&group_id=797

Category: mock module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Johan Sørensen (johansorensen)
Assigned to: Nobody (None)
Summary: Helper specs oddities, compared to controller and other specs

Initial Comment:
I've always found it odd that helpers called directly in the it() block, and not through an instance of some sort, eg typing

it "should do stuff" do
  helper_method.should == "output"
end

and even worse

it "should do stuff" do
  mock(:helper_method).and_return("thingies")
  #..
end

eg its not obvious at first sight exactly what you're mocking/expecting on, and its very inconsistant to general (non-rails) specs and controller/model specifications, where operate on some object.

Why not mix the helper into a dummy Helper object instead? So we can do:

it "should do stuff" do
  helper.mock(:helper_method).and_return("thingies")
  helper.other_method.should == "thingies are good"
end


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13741&group_id=797


More information about the rspec-devel mailing list