It's been suggested that instead of doing
-- organization.events.find(params[:id])
that you should be writing
-- organization.get_event( params[:id] )
and the orgs 'get_event' method should look like
-- def get_event( event_id )
-- self.events.find( event_id )
-- end
So are the following valid / efficient specs or am I testing what isn't my own
code?
it "should return a particular event" do
event = stub("an event")
events = stub("event association")
events.stub!(:find).with("1").and_return(event)
@organization.stub!(:events).and_return(events)
@organization.get_event("1").should == event
end
it "should raise error if it can't find event" do
lambda{ @organization.get_event("1") }.should
raise_error(ActiveRecord::RecordNotFound)
end
Any other suggestions?
_________________________________________________________________
Stay in touch when you're away with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_messenger2_072008
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users