Skip to content

Instantly share code, notes, and snippets.

@calebwoods
Created September 30, 2011 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calebwoods/1254258 to your computer and use it in GitHub Desktop.
Save calebwoods/1254258 to your computer and use it in GitHub Desktop.
Failing PUT
describe "with invalid params" do
it "assigns the snippet as @snippet" do
snippet = FactoryGirl.create(:snippet)
# Trigger the behavior that occurs when invalid params are submitted
Snippet.any_instance.stub(:save).and_return(false)
put :update, :id => snippet.id.to_s, :snippet => {}
assigns(:snippet).should eq(snippet)
end
it "re-renders the 'edit' template" do
snippet = FactoryGirl.create(:snippet)
# Trigger the behavior that occurs when invalid params are submitted
Snippet.any_instance.stub(:save).and_return(false)
put :update, :id => snippet.id.to_s, :snippet => {}
response.should render_template("edit")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment