同时使用 rspec 和 cucumber 时将 VCR 配置放在哪里
我同时使用 rspec 和黄瓜。 Cucumber 集成级别测试,但 rspec 用于单元测试。
我已经将 vcr 用于 cucumber,但也想将其用于 rspec。放置录像机配置的正确位置在哪里?我不想在 features/support 和 rspec/support 中复制它。
I'm using both rspec and cucumber. Cucumber of integration level tests, but rspec for unit tests.
I'm using vcr for cucumber already, but want to use it for rspec, too. Where's the right place to put the vcr configuration? I'd rather not replicate it in both features/support and rspec/support.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Cucumber 不“了解”RSpec,反之亦然。如果您不想重复它,请将其定义在自己的文件中,例如 spec/support/vcr_setup.rb,然后将其包含在两个文件中。
features/support/env.rb:
需要 File.expand_path("../../../spec/support/vcr_setup", __FILE__)
(认为正确,根据需要调整路径)
spec/spec_helper.rb:
需要“support/vcr_setup”
Cucumber doesn't "know" about RSpec, nor vice-versa. If you don't want to duplicate it, define it in its own file, say spec/support/vcr_setup.rb, and then include that in both.
features/support/env.rb:
require File.expand_path("../../../spec/support/vcr_setup", __FILE__)
(think that's right, adjust path as needed)
spec/spec_helper.rb:
require "support/vcr_setup"