我已经坚持了3天。我可能已经阅读了 stackoverflow 上与错误和第 5 章相关的每个线程,但似乎找不到修复方法。
我不断收到此错误
Failures:
1) Static pages should have the right links on the layout
Failure/Error: page.should have_selector 'h1', text: 'Sample App'
expected css "h1" with text "Sample App" to return something
# ./spec/requests/static_pages_spec.rb:66:in `block (2 levels) in <top (required)>'
2) Static pages About Page
Failure/Error: it { should_not have_selector 'title', text: '| About Us' }
expected css "title" with text "| About Us" not to return anything
# ./spec/requests/static_pages_spec.rb:40:in `block (3 levels) in <top (required)>'
3) Static pages About Page it should behave like all static pages
Failure/Error: it { should have_selector('h1', text: heading) }
expected css "h1" with text "Sample App" to return something
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:39
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
4) Static pages Home page
Failure/Error: it { should_not have_selector 'title', text: '| Home' }
expected css "title" with text "| Home" not to return anything
# ./spec/requests/static_pages_spec.rb:19:in `block (3 levels) in <top (required)>'
5) Static pages Contact Page
Failure/Error: it {should_not have_selector 'title', text:'| Contact Us'}
expected css "title" with text "| Contact Us" not to return anything
# ./spec/requests/static_pages_spec.rb:51:in `block (3 levels) in <top (required)>'
6) Static pages Contact Page it should behave like all static pages
Failure/Error: it { should have_selector('h1', text: heading) }
expected css "h1" with text "Sample App" to return something
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:50
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
7) Static pages Help Page
Failure/Error: it { should_not have_selector 'title', text: ' | Help' }
expected css "title" with text " | Help" not to return anything
# ./spec/requests/static_pages_spec.rb:29:in `block (3 levels) in <top (required)>'
8) Static pages Help Page it should behave like all static pages
Failure/Error: it { should have_selector('h1', text: heading) }
expected css "h1" with text "Sample App" to return something
Shared Example Group: "all static pages" called from ./spec/requests/static_pages_spec.rb:28
# ./spec/requests/static_pages_spec.rb:8:in `block (3 levels) in <top (required)>'
Finished in 0.36621 seconds
13 examples, 8 failures
Failed examples:
rspec ./spec/requests/static_pages_spec.rb:54 # Static pages should have the right links on the layout
rspec ./spec/requests/static_pages_spec.rb:40 # Static pages About Page
rspec ./spec/requests/static_pages_spec.rb:8 # Static pages About Page it should behave like all static pages
rspec ./spec/requests/static_pages_spec.rb:19 # Static pages Home page
rspec ./spec/requests/static_pages_spec.rb:51 # Static pages Contact Page
rspec ./spec/requests/static_pages_spec.rb:8 # Static pages Contact Page it should behave like all static pages
rspec ./spec/requests/static_pages_spec.rb:29 # Static pages Help Page
rspec ./spec/requests/static_pages_spec.rb:8 # Static pages Help Page it should behave like all static pages
我检查了所有相关文件中的语法,检查了任何拼写错误,尤其是双引号和单引号。因为我已经看了三天了,在这里或其他地方都没有找到任何好的解决方案,而且我不确定我到底哪里出了问题,而不是在这里粘贴代码,这里是我的应用程序的链接github,最新的工作分支谢谢你的帮助! https://github.com/cassking/sample_app/tree/filling-out-layout