Skip to content

Instantly share code, notes, and snippets.

@pacuna
Created April 19, 2014 01:44
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 pacuna/11071201 to your computer and use it in GitHub Desktop.
Save pacuna/11071201 to your computer and use it in GitHub Desktop.
describe 'POST #create' do
it "saves the post to the db" do
expect{
post :create, :post => {:title => "The title", :body => "The Body"}
}.to change(Post, :count).by(1)
end
it "redirects to @post" do
@post = {:title => 'The title', :body => 'The body'}
post :create, :post => @post
expect(response).to redirect_to '/posts/1'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment