[rspec-users] [RSpec] Testing a helper with or without model layer?

Bruno Cardoso lists at ruby-forum.com
Wed Aug 4 12:35:36 EDT 2010

David Chelimsky wrote:
> It really depends on how deep the helper is reaching into the model. 
> Ideally, when you're stubbing a layer, you want to be able to stub one 
> thing. In this example, there are many things that need to be stubbed. A 
> common example is a display formatter for a person's name:
> it "concats the first and last name" do
>   person = double('person', :first_name => "Joe", :last_name => "Smith")
>   helper.full_name_for(person).should == "Joe Smith"
> end
> Here we're just stubbing a couple of values on one object - simple. In 
> this case it makes sense to just stub the model.

Thanks again David.
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list