Capybara功能位于/功能目录之外

时间:2013-05-13 15:50:59

标签: ruby-on-rails capybara

我有一些大型的端到端集成测试,出于CI的目的,我不想在Capybara的spec / features文件夹中。相反,我将它们放在spec / integration文件夹中。知道Capybara根据文件夹加载的方式不同,我在我的describe中添加了:type =>:feature选项,如下所示:

describe 'Recurring Contract Orders', :type=>:feature, :js=>true, :focus=>true do
    it "satisifies the use case" do
    ....

但没有运气,我仍然得到:

NameError:
   undefined local variable or method `page' for #<RSpec::Core::ExampleGroup::Nested_1:0x007fd396bd2998>
运行测试时出现

错误。还有其他我想念的东西吗?

2 个答案:

答案 0 :(得分:1)

我不知道你是否仍在尝试解决这个问题,但我遇到了同样的问题。如果只包含DSL,则可以使用特定的Capybara命令:

include Capybara::DSL

我还没有找到如何让Capybara包含我的/ integration文件夹,但现在已经有用了。

答案 1 :(得分:0)

对于将来的参考,我认为正确的事情(根据https://github.com/jnicklas/capybara)是用以下标记来标记规范:type =&gt; :功能,例如

describe "Some pages", :type => :feature do

  specify "some behaviour"

end
相关问题