使用Guard运行我的规范时,我遇到了一个奇怪的问题.
我正在运行使用Capybara“feature”/“scenario”语法的功能规范.我也在使用Spring.
如果我在控制台中运行rspec spec或spring rspec或在Guard shell中运行rspec,一切正常.但是,当看到的规格由Guard自动运行时,我收到以下错误:
/spec/features/navigation_spec.rb:1:in
feature’ for main:Object (NoMethodError)
required)>': undefined method
为什么它只是在这个特定的上下文中才取出Capybara语法?
这是相关代码:
GuardFile
guard :rspec,:spring => true do
watch(%r{^spec/.+_spec\.rb$})
end
规格/功能/ navigation_spec.rb
feature "navigation" do
context "When on the home page" do
before { visit "/" }
scenario "I should see the navigation header" do
expect(page).to have_selector("div.navigation")
end
end
end
投机/ spec_helper.rb
require 'capybara/rspec'
最佳答案
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。