首页 文章

RSpec失败没有明显的原因

提问于
浏览
0

所以我正在使用 rspec 来测试我的代码,因为我正在通过Rails Tutorial,当我在listing 3.20中测试代码时,我一直收到此错误 . 当我用眼球看着它时,一切都会检查出来,但RSpec似乎并不喜欢它 .

(注意,我刚刚做了其中一个页面,而不是全部三个,因为它们都给出了相同的错误)

james @tristan:〜/ rails_projects / sample_app $ rspec spec / controllers / pages_controller_spec.rb F ...失败:1)PagesController应该有正确的 Headers 失败/错误:response.should have_selector(“title”,预期输出到包含一个| Home标签:# . / spec / control / pages_controller_spec.rb:13:在`块(2级)中'完成0.97999秒4个例子,1个失败james @tristan:〜/ rails_projects / sample_app $

1 回答

  • 0

    在该规范文件的顶部,它说:

    before(:each) do
      #
      # Define @base_title here.
      #
    end
    

    您的规范是否为 @base_title 分配了值?

相关问题