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:
parent
f4a02ad379
commit
e143f120ab
@ -4,7 +4,7 @@ describe HomeController do
|
|||||||
describe "GET index" do
|
describe "GET index" do
|
||||||
it "responds with success" do
|
it "responds with success" do
|
||||||
get :index
|
get :index
|
||||||
expect(response).to be_successful
|
expect(response).to render_template(:index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
17
spec/controllers/pages_controller_spec.rb
Normal file
17
spec/controllers/pages_controller_spec.rb
Normal 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
9
spec/factories/pages.rb
Normal 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
|
||||||
Loading…
Reference in New Issue
Block a user