Displaying 1 result from an estimated 1 matches for "stub_authorized_login".
2007 May 20
9
How to test for exceptions
...do
@venue = mock("venue")
@venue.stub!(:new_record?).and_return(false)
@venue.stub!(:to_param).and_return(''1'')
controller.class.send(:define_method, :rescue_action) { |e| raise e }
end
it "should raise an error if record is invalid" do
stub_authorized_login
Venue.should_receive(:find).and_return(@venue)
@venue.should_receive(:update_attributes!).with("name" => "random text").and_return(false)
lambda {post :create, {:venue => @venue}}.should raise_error(ActiveRecord::RecordInvalid)
end
end
describe VenuesControl...