Displaying 1 result from an estimated 1 matches for "do_verb".
Did you mean:
_verb
2008 May 10
4
Newbie: lambda do...end.should change(Model, :count).by(1). Doesn''t work
...in_as(:admin)
@album = mock_model(Album, :save => true)
Album.stub!(:new).and_return(@album)
@params = { :title => ''a new title'', :description => ''a new
description'', :category => ''a new category'' }
end
def do_verb(params = @params)
post :create, :album => params
end
it "should change the Albums count by 1 after POST" do
lambda do
@album.should_receive(:save).and_return(true)
do_verb
end.should change(Album, :count).by(1)
end
end
When I run the spe...