I keep getting the same two failures for a test trying to create a signin page.
Here is the error message: $ bundle exec rspec spec/requests/user_pages_spec.rb FF
Failures:
1) User pages signup page
Failure/Error: before { visit signup_path }
ActionView::Template::Error:
undefined method |' for "Ruby on Rails Tutorial Sample App":String
# ./app/helpers/application_helper.rb:9:in
full_title'
# ./app/views/layouts/application.html.erb:4:in _app_views_layouts_application_html_erb__2148911516627374684_2168968760'
# ./spec/requests/user_pages_spec.rb:8:in
block (3 levels) in '
2) User pages signup page
Failure/Error: before { visit signup_path }
ActionView::Template::Error:
undefined method |' for "Ruby on Rails Tutorial Sample App":String
# ./app/helpers/application_helper.rb:9:in
full_title'
# ./app/views/layouts/application.html.erb:4:in _app_views_layouts_application_html_erb__2148911516627374684_2168968760'
# ./spec/requests/user_pages_spec.rb:8:in
block (3 levels) in '
Finished in 0.17668 seconds 2 examples, 2 failures
Failed examples:
rspec ./spec/requests/user_pages_spec.rb:10 # User pages signup page rspec ./spec/requests/user_pages_spec.rb:11 # User pages signup page
And here is the file user_pages_spec.rb
require 'spec_helper'
describe "User pages" do
subject { page }
describe "signup page" do before { visit signup_path }
it { should have_selector('h1', text: 'Sign up') }
it { should have_selector('title', text: full_title('Sign up')) }
end end
here is the file application_helper.rb:
module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title)
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
"#{base_title}" | "#{page_title}"
end
end
end
here is the file routes.rb SampleApp::Application.routes.draw do get "users/new"
root to: 'static_pages#home'
match '/signup', to: 'users#new'
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
I've been stuck on this for quite a bit so any help would be greatly appreciated!
Thanks!