-
-
Save bjensen/262553 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "failure due to record invalid" do | |
before(:each) do | |
e = mock("errors", :null_object => true) | |
e.stub!(:full_messages).and_return([]) | |
@obj.stub!(:errors).and_return(e) | |
@obj.stub!('update_attributes!').and_raise(ActiveRecord::RecordInvalid.new(@obj)) | |
put :update, { :id => @obj.id, at_name => @invalid_update } | |
end | |
it "should flash an error" do | |
flash[:error].should_not be_nil | |
end | |
it "should render the edit view with status 400" do | |
response.should render_template('edit') | |
response.code.should == '400' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment