Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created June 25, 2011 11:27
Show Gist options
  • Save dchelimsky/1046386 to your computer and use it in GitHub Desktop.
Save dchelimsky/1046386 to your computer and use it in GitHub Desktop.
describe PostsController do
let(:post) { Factory(:post) }
describe "PUT #update" do
it "allows an author to edit a post" do
sign_in post.author
put :update, :id => post.id
response.should be_successful
end
it "does not allow a non-author to edit a post" do
sign_in Factory(:user, :email => "[email protected]")
put :update, :id => post.id
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