【问题标题】:How to get rake to use the 'integration' directory instead of 'requests' for integration tests?如何让 rake 使用“集成”目录而不是“请求”进行集成测试?
【发布时间】:2012-01-07 03:43:59
【问题描述】:

我想在规范/集成中保留我的集成测试。但是,当我生成其中一个 rake 时,会创建一个 spec/requests 目录。

有没有办法将生成器指向另一个目录?

谢谢!

【问题讨论】:

    标签: ruby-on-rails-3 rspec rake integration-testing


    【解决方案1】:

    您可以修改 spec_helper。例如,在您的 rspec 配置中添加 capybara 就足够了。

    RSpec.configure do |config|
      config.include Capybara::DSL, type: :integration
    end
    

    然后你可以添加自己的助手:

      RSpec.configure do |config|
        config.with_options example_group: { file_path: /\bspec\/integration\// } do |integration|
          integration.include SomeIntegrationHelper
        end
     end
    

    【讨论】:

    【解决方案2】:

    我最终只使用了 requests 目录 - 意识到我喜欢将目录称为“集成”并不值得为此付出努力。

    将其标记为答案可能是一种糟糕的形式。请告诉我

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-25
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-07
      • 2019-12-17
      相关资源
      最近更新 更多