RSpec 无明显原因失败
因此,我正在使用 rspec
来测试我的代码,因为我正在学习 Rails 教程,当我测试 清单 3.20。当我用肉眼观察时,一切都检查完毕,但 RSpec 似乎不喜欢它。
(请注意,我只执行了其中一个页面,而不是所有三个页面,因为它们都给出了相同的错误)
james@tristan:~/rails_projects/sample_app$ 规范 规格/控制器/pages_controller_spec.rb
F...
失败:
1) PagesController 应该有 正确的标题 失败/错误:response.should have_selector("title", 预期以下输出包含 |首页标签: # ./spec/controllers/pages_controller_spec.rb:13:in `阻止(2 级)在 '
在 0.97999 秒内完成 4 示例,1 个失败
james@tristan:~/rails_projects/sample_app$
So I'm using rspec
to test my code as I'm going through the Rails Tutorial, and I keep getting this error when I test the code in listing 3.20. Everything checks out when I look at it with my eyeball, but RSpec doesn't seem to like it.
(Note that I just did one of the pages, not all three because they all give the same error)
james@tristan:~/rails_projects/sample_app$
rspec
spec/controllers/pages_controller_spec.rbF...
Failures:
1) PagesController should have the
right title
Failure/Error: response.should have_selector("title",
expected following output to contain a | Home tag:# ./spec/controllers/pages_controller_spec.rb:13:in
`block (2 levels) in 'Finished in 0.97999 seconds 4
examples, 1 failurejames@tristan:~/rails_projects/sample_app$
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在该规范文件的顶部显示:
您的规范是否为
@base_title
分配了值?At the top of that spec file it says:
Does your spec assign a value to
@base_title
?