Friday, 27 September 2013

Hartl Chapter Error Before 9.1.3

Hartl Chapter Error Before 9.1.3

I'm going through Mr. Hartl's Tutorial and trying to copy it exactly, even
kinda using his completed github code as a guide, but I'm stuck with the
following after running the "bundle exec rspec spec/":

Failures:
1) Authentication signin with valid information
Failure/Error: before { sign_in user }
ActionView::MissingTemplate:
Missing template sessions/create, application/create with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder,
:raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/nemo/rails_projects/sample_app/app/views"
# ./spec/support/utilities.rb:19:in `sign_in'
# ./spec/requests/authentication_pages_spec.rb:32:in `block (4
levels) in <top (required)>'
2) Authentication signin with valid information
Failure/Error: before { sign_in user }
ActionView::MissingTemplate:
Missing template sessions/create, application/create with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder,
:raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/nemo/rails_projects/sample_app/app/views"
# ./spec/support/utilities.rb:19:in `sign_in'
# ./spec/requests/authentication_pages_spec.rb:32:in `block (4
levels) in <top (required)>'
3) Authentication signin with valid information
Failure/Error: before { sign_in user }
ActionView::MissingTemplate:
Missing template sessions/create, application/create with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder,
:raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/nemo/rails_projects/sample_app/app/views"
# ./spec/support/utilities.rb:19:in `sign_in'
# ./spec/requests/authentication_pages_spec.rb:32:in `block (4
levels) in <top (required)>'
4) Authentication signin with valid information
Failure/Error: before { sign_in user }
ActionView::MissingTemplate:
Missing template sessions/create, application/create with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder,
:raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/nemo/rails_projects/sample_app/app/views"
# ./spec/support/utilities.rb:19:in `sign_in'
# ./spec/requests/authentication_pages_spec.rb:32:in `block (4
levels) in <top (required)>'
5) Authentication signin with valid information
Failure/Error: before { sign_in user }
ActionView::MissingTemplate:
Missing template sessions/create, application/create with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder,
:raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/nemo/rails_projects/sample_app/app/views"
# ./spec/support/utilities.rb:19:in `sign_in'
# ./spec/requests/authentication_pages_spec.rb:32:in `block (4
levels) in <top (required)>'
6) Authentication signin with valid information followed by signout
Failure/Error: before { sign_in user }
ActionView::MissingTemplate:
Missing template sessions/create, application/create with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder,
:raw, :ruby, :jbuilder, :coffee]}. Searched in:
* "/home/nemo/rails_projects/sample_app/app/views"
# ./spec/support/utilities.rb:19:in `sign_in'
# ./spec/requests/authentication_pages_spec.rb:32:in `block (4
levels) in <top (required)>'
7) User pages profile page signup with valid information after saving
the user
Failure/Error: before { visit user_path(user) }
AbstractController::ActionNotFound:
The action 'index' could not be found for UsersController
# ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top
(required)>'
8) User pages profile page signup with valid information after saving
the user
Failure/Error: before { visit user_path(user) }
AbstractController::ActionNotFound:
The action 'index' could not be found for UsersController
# ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top
(required)>'
9) User pages profile page signup with valid information after saving
the user
Failure/Error: before { visit user_path(user) }
AbstractController::ActionNotFound:
The action 'index' could not be found for UsersController
# ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top
(required)>'
10) User pages profile page with invalid information
Failure/Error: before { click_button "Save changes" }
Capybara::ElementNotFound:
Unable to find button "Save changes"
# ./spec/requests/user_pages_spec.rb:76:in `block (4 levels) in <top
(required)>'
11) User pages profile page page
Failure/Error: it { should have_content("Update your profile") }
expected #has_content?("Update your profile") to return true, got
false
# ./spec/requests/user_pages_spec.rb:70:in `block (4 levels) in <top
(required)>'
12) User pages profile page page
Failure/Error: it { should have_title("Edit user") }
expected #has_title?("Edit user") to return true, got false
# ./spec/requests/user_pages_spec.rb:71:in `block (4 levels) in <top
(required)>'
13) User pages profile page page
Failure/Error: it { should have_link('change', href:
'http://gravatar.com/emails') }
expected #has_link?("change",
{:href=>"http://gravatar.com/emails"}) to return true, got false
# ./spec/requests/user_pages_spec.rb:72:in `block (4 levels) in <top
(required)>'
Finished in 1.83 seconds
53 examples, 13 failures

spec/requests/authentication_pages_spec.rb:
require 'spec_helper'
describe "Authentication" do
subject { page }
describe "signin page" do
before { visit signin_path }
it { should have_content('Sign in') }
it { should have_title('Sign in') }
end
describe "signin" do
before { visit signin_path }
describe "with invalid information" do
before { click_button "Sign in" }
it { should have_title('Sign in') }
it { should have_selector('div.alert.alert-error', text: 'Invalid') }
describe "after visiting another page" do
before { click_link "Home" }
it { should_not have_selector('div.alert.alert-error') }
end
end
describe "with valid information" do
let(:user) { FactoryGirl.create(:user) }
before { sign_in user }
it { should have_title(user.name) }
it { should have_link('Profile', href: user_path(user)) }
it { should have_link('Settings', href: edit_user_path(user)) }
it { should have_link('Sign out', href: signout_path) }
it { should_not have_link('Sign in', href: signin_path) }
describe "followed by signout" do
before { click_link "Sign out" }
it { should have_link('Sign in') }
end
end
end
end
spec/requests/user_pages_spec.rb
require 'spec_helper'
describe "User pages" do
subject { page }
describe "signup page" do
before { visit signup_path }
it { should have_content('Sign up') }
it { should have_title(full_title('Sign up')) }
end
describe "profile page" do
let(:user) { FactoryGirl.create(:user) }
before { visit user_path(user) }
it { should have_content(user.name) }
it { should have_title(user.name) }
describe "signup" do
before { visit signup_path }
let(:submit) { "Create my account" }
describe "with invalid information" do
it "should not create a user" do
expect { click_button submit }.not_to change(User, :count)
end
describe "after submission" do
before { click_button submit }
it { should have_title('Sign up') }
it { should have_content('error') }
end
end
describe "with valid information" do
before do
fill_in "Name", with: "Example User"
fill_in "Email", with: "user@example.com"
fill_in "Password", with: "foobar"
fill_in "Confirmation", with: "foobar"
end
it "should create a user" do
expect { click_button submit }.to change(User, :count).by(1)
end
describe "after saving the user" do
before { click_button submit }
let(:user) { User.find_by(email: 'user@example.com') }
it { should have_link('Sign out') }
it { should have_title(user.name) }
it { should have_selector('div.alert.alert-success', text:
'Welcome') }
end
end
end
describe "edit" do
let(:user) { FactoryGirl.create(:user) }
before { visit edit_user_path(user) }
end
describe "page" do
it { should have_content("Update your profile") }
it { should have_title("Edit user") }
it { should have_link('change', href: 'http://gravatar.com/emails') }
end
describe "with invalid information" do
before { click_button "Save changes" }
it { should have_content('error') }
end
end
end

No comments:

Post a Comment