1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Add first controller specs.

This commit is contained in:
Dan Barber 2013-05-30 09:06:21 +01:00
parent f4a02ad379
commit e143f120ab
3 changed files with 27 additions and 1 deletions

View File

@ -4,7 +4,7 @@ describe HomeController do
describe "GET index" do
it "responds with success" do
get :index
expect(response).to be_successful
expect(response).to render_template(:index)
end
end
end

View File

@ -0,0 +1,17 @@
require 'spec_helper'
describe PagesController do
describe "GET show" do
let(:test_page) { FactoryGirl.create(:page) }
it "renders a page" do
get :show, name: test_page.name
expect(response).to render_template(:show)
end
it "renders 404 for a non existant page" do
get :show, name: "not-a-page"
expect(response.status).to eql(404)
end
end
end

9
spec/factories/pages.rb Normal file
View File

@ -0,0 +1,9 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :page do
name "page"
title "Page"
content "This is a page."
end
end