【问题标题】:Where to put VCR config when using both rspec and cucumber同时使用 rspec 和 cucumber 时在哪里放置 VCR 配置
【发布时间】:2011-03-15 13:39:07
【问题描述】:

我同时使用 rspec 和 cucumber。集成级别测试的黄瓜,但单元测试的 rspec。

我已经将 vcr 用于黄瓜,但也想将它用于 rspec。放置 vcr 配置的正确位置在哪里?我宁愿不在 features/support 和 rspec/support 中复制它。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 rspec cucumber vcr


    【解决方案1】:

    Cucumber 不“知道” RSpec,反之亦然。如果您不想复制它,请在其自己的文件中定义它,例如 spec/support/vcr_setup.rb,然后将其包含在两者中。

    features/support/env.rb
    require File.expand_path("../../../spec/support/vcr_setup", __FILE__)
    (觉得没错,根据需要调整路径)

    spec/spec_helper.rb
    require "support/vcr_setup"

    【讨论】:

      猜你喜欢
      • 2012-12-01
      • 1970-01-01
      • 2016-08-27
      • 1970-01-01
      • 1970-01-01
      • 2019-07-01
      • 2018-07-28
      • 2011-02-27
      • 1970-01-01
      相关资源
      最近更新 更多