Skip to content

Instantly share code, notes, and snippets.

@evanwalsh
Created May 9, 2011 04:42
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 evanwalsh/962067 to your computer and use it in GitHub Desktop.
Save evanwalsh/962067 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe PostsController do
before do
@post = Fabricate :post
end
describe "GET index", type: :request do
before do
visit posts_url
end
end
describe "GET show with a valid post", type: :request do
before do
visit post_url(@post.url)
end
it "should display the post's title" do
page.has_content?(@post.title).should be true
end
end
describe "GET show with an invalid post", type: :request do
before do
visit post_url(@post.url.reverse)
end
it "should give a 404 HTTP response" do
page.status_code.should == 404
end
end
describe "GET new", type: :request do
before do
visit new_post_url
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment