当教程说它应该通过时,我在第 8.1.1 节中的测试失败了。这里有一个类似的封闭问题。我的问题与那个不同,因为我的测试产生了 17 次失败而不是 15 次。
Failures:
1) Authentication signin page
Failure/Error: before { visit signin_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x529d880>:0x52a3970>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/authentication_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
2) Authentication signin page
Failure/Error: before { visit signin_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x529d880>:0x48f2238>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/authentication_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
3) Static pages Home page
Failure/Error: before { visit root_path }
NameError:
undefined local variable or method `root_path' for #<RSpec::Core::ExampleGroup::Nested_3::Nested_1:0x44ae8e0>
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
4) Static pages Home page
Failure/Error: before { visit root_path }
NameError:
undefined local variable or method `root_path' for #<RSpec::Core::ExampleGroup::Nested_3::Nested_1:0x42bb2c0>
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
5) Static pages Home page
Failure/Error: before { visit root_path }
NameError:
undefined local variable or method `root_path' for #<RSpec::Core::ExampleGroup::Nested_3::Nested_1:0x42f6120>
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
6) Static pages Help page
Failure/Error: before { visit help_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4c59f00>:0x4c62d08>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/static_pages_spec.rb:16:in `block (3 levels) in <top (required)>'
7) Static pages Help page
Failure/Error: before { visit help_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4c59f00>:0x311a0c0>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/static_pages_spec.rb:16:in `block (3 levels) in <top (required)>'
8) Static pages About page
Failure/Error: before { visit about_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4c59f00>:0x3fdc578>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/static_pages_spec.rb:23:in `block (3 levels) in <top (required)>'
9) Static pages About page
Failure/Error: before { visit about_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4c59f00>:0x47fdac8>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/static_pages_spec.rb:23:in `block (3 levels) in <top (required)>'
10) Static pages Contact page
Failure/Error: before { visit contact_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4c59f00>:0x3ddd330>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/static_pages_spec.rb:30:in `block (3 levels) in <top (required)>'
11) Static pages Contact page
Failure/Error: before { visit contact_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4c59f00>:0x4cea548>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/static_pages_spec.rb:30:in `block (3 levels) in <top (required)>'
12) User pages profile page
Failure/Error: before { visit user_path(user) }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4e20a00>:0x4e2a1c8>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
13) User pages profile page
Failure/Error: before { visit user_path(user) }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4e20a00>:0x3fdf0e0>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/user_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
14) User pages signup page
Failure/Error: before { visit signup_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4e20a00>:0x48f8a60>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top (required)>'
15) User pages signup page
Failure/Error: before { visit signup_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4e20a00>:0x4ccddd8>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/user_pages_spec.rb:16:in `block (3 levels) in <top (required)>'
16) User pages signup with invalid information should not create a user
Failure/Error: before { visit signup_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4e20a00>:0x4dffdf0>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
17) User pages signup with valid information should create a user
Failure/Error: before { visit signup_path }
ActionView::Template::Error:
undefined local variable or method `root_path' for #<#<Class:0x4e20a00>:0x3113700>
# ./app/views/layouts/_header.html.erb:4:in `_app_views_layouts__header_html_erb___509603306_33401520'
# ./app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb___981332443_30718356'
# ./spec/requests/user_pages_spec.rb:24:in `block (3 levels) in <top (required)>'
Finished in 7.96 seconds
37 examples, 17 failures
Failed examples:
rspec ./spec/requests/authentication_pages_spec.rb:10 # Authentication signin page
rspec ./spec/requests/authentication_pages_spec.rb:11 # Authentication signin page
rspec ./spec/requests/static_pages_spec.rb:10 # Static pages Home page
rspec ./spec/requests/static_pages_spec.rb:11 # Static pages Home page
rspec ./spec/requests/static_pages_spec.rb:12 # Static pages Home page
rspec ./spec/requests/static_pages_spec.rb:18 # Static pages Help page
rspec ./spec/requests/static_pages_spec.rb:19 # Static pages Help page
rspec ./spec/requests/static_pages_spec.rb:25 # Static pages About page
rspec ./spec/requests/static_pages_spec.rb:26 # Static pages About page
rspec ./spec/requests/static_pages_spec.rb:32 # Static pages Contact page
rspec ./spec/requests/static_pages_spec.rb:33 # Static pages Contact page
rspec ./spec/requests/user_pages_spec.rb:11 # User pages profile page
rspec ./spec/requests/user_pages_spec.rb:12 # User pages profile page
rspec ./spec/requests/user_pages_spec.rb:18 # User pages signup page
rspec ./spec/requests/user_pages_spec.rb:19 # User pages signup page
rspec ./spec/requests/user_pages_spec.rb:29 # User pages signup with invalid information should not create a user
rspec ./spec/requests/user_pages_spec.rb:42 # User pages signup with valid information should create a user