いつもお世話になっております。
Ruby on Rails Tutorial 8章でuser_pages_specが
エラーとなってしまい、それ以降を実行することができません。
おそらく実行ページ先が見つかっていないのかと思いますが、
チュートリアル通りには従っているはずなので困っています。
どうかお助けくださいませ。
下記の続きとなります。
https://teratail.com/questions/12650
- User pages profile page
Failure/Error: let(:user) { FactoryGirl.create(:user) } NoMethodError: undefined method `remember_token=' for #<User:0x007fb94548f7c8> # ./app/models/user.rb:23:in `create_remember_token' # ./spec/requests/user_pages_spec.rb:8:in `block (3 levels) in <top (required)>' # ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
- User pages profile page
Failure/Error: let(:user) { FactoryGirl.create(:user) } NoMethodError: undefined method `remember_token=' for #<User:0x007fb9417b7468> # ./app/models/user.rb:23:in `create_remember_token' # ./spec/requests/user_pages_spec.rb:8:in `block (3 levels) in <top (required)>' # ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
- User pages signup page
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top (required)>'
- User pages signup page
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top (required)>'
- User pages signup with invalid information should not create a user
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
- User pages signup with valid information should create a user
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
- User pages signup with valid information after saving the user
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
- User pages signup with valid information after saving the user
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
- User pages signup with valid information after saving the user
Failure/Error: before { visit signup_path } ActionView::Template::Error: SQLite3::SQLException: no such column: users.remember_token: SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' LIMIT 1 # ./app/helpers/sessions_helper.rb:20:in `current_user' # ./app/helpers/sessions_helper.rb:11:in `signed_in?' # ./app/views/layouts/_header.html.erb:9:in `_app_views_layouts__header_html_erb___2063214517191558985_70216852545980' # ./app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb___3393450340642813266_70216830195980' # ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
◼︎ user_page_spec.rb
lang
1require 'spec_helper' 2 3describe "User pages" do 4 5 subject { page } 6 7 describe "profile page" do 8 let(:user) { FactoryGirl.create(:user) } 9 before { visit user_path(user) } 10 11 it { should have_content(user.name) } 12 it { should have_title(user.name) } 13 end 14 15 describe "signup page" do 16 before { visit signup_path } 17 18 it { should have_content('Sign up') } 19 it { should have_title(full_title('Sign up')) } 20 end 21 22describe "signup" do 23 24 before { visit signup_path } 25 26 let(:submit) { "Create my account" } 27 28 describe "with invalid information" do 29 it "should not create a user" do 30 expect { click_button submit }.not_to change(User, :count) 31 end 32 end 33 34 describe "with valid information" do 35 before do 36 fill_in "Name", with: "Example User" 37 fill_in "Email", with: "user@example.com" 38 fill_in "Password", with: "foobar" 39 fill_in "Confirmation", with: "foobar" 40 end 41 42 it "should create a user" do 43 expect { click_button submit }.to change(User, :count).by(1) 44 end 45 46 describe "after saving the user" do 47 before { click_button submit } 48 let(:user) { User.find_by(email: 'user@example.com') } 49 50 it { should have_link('Sign out') } 51 it { should have_title(user.name) } 52 it { should have_selector('div.alert.alert-success', text: 'Welcome') } 53 end 54 end 55 end 56end
あなたの回答
tips
プレビュー