Skip to content

Instantly share code, notes, and snippets.

@andreaseriksson
Created May 18, 2013 13:41
Show Gist options
  • Save andreaseriksson/5604430 to your computer and use it in GitHub Desktop.
Save andreaseriksson/5604430 to your computer and use it in GitHub Desktop.
RSPEC Controller spec #DESTROY
describe 'DELETEdestroy' do
before :each do
@message = create(:message)
end
it "deletes the message" do
expect{
delete :destroy, id: @message
}.to change(Message,:count).by(-1)
end
it "redirects to messages#index" do
delete :destroy, id: @message
expect(response).to redirect_to messages_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment