Fernando Perez wrote:
> Hi,
>
> From the railscasts website source code, in the episodes_controller_spec
> I read:
>
> it "index action with search should search published episodes" do
> Episode.expects(:search_published).with('foo').returns(Episode.all)
> get :index, :search => 'foo'
> end
>
> Here are my questions:
> - What does the returns(Episode.all) mean?
> - Is it stubbing what the search_published method returns?
> - Is it useful to add the returns(Episode.all) method call here?
> - Whats the difference with and_return(Episode.all)?
> - Shouldn't we only test for:
> Episode.expects(:search_published).with('foo')?
I also forgot to add:
What's the difference between expects and should_receive? I can get my
head around it.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users