Skip to content

Instantly share code, notes, and snippets.

@alindeman
Created June 21, 2011 18:33
Show Gist options
  • Select an option

  • Save alindeman/1038534 to your computer and use it in GitHub Desktop.

Select an option

Save alindeman/1038534 to your computer and use it in GitHub Desktop.
describe PostsController do
describe "PUT #update" do
it "allows an author to edit a post" do
post = Factory(:post)
sign_in post.author
put :update, :id => post.id, :body => "new content"
response.should be_successful
end
it "does not allow a non-author to edit a post" do
post = Factory(:post)
sign_in Factory(:user)
put :update, :id => post.id, :body => "new content"
response.should be_forbidden
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment