在RSPEC中,如何在功能描述中设置VCR记录模式?

发布于 2025-01-26 15:19:48 字数 557 浏览 3 评论 0原文

我有一个使用这样的VCR的测试:

描述'用API做某事',功能:true,js:true,vcr:true do end

我想将此VCR录制设置为选项new_episodes(当前设置为ANCE),但我无法找到如何通过此选项进入设置。如何使用设置new_episodes制作此功能记录?

https://relishapp.com/ vcr/vcr/v/2-9-3/doc/record-modes/new-episodes - 这是此选项的文档。

当在VCR录制中包装块时,我可以做到这一点,但是我想将此设置用于我的一个功能,我该怎么做?我可以在Dricesd行上传递它吗?

I have a test that uses VCR like this:

describe 'Do something with an api', feature: true, js: true, vcr: true do
end

I want to set this vcr recording to the option new_episodes (it's currently set to once) but I can't find out how to pass this option into the settings. How to I make this feature record with the setting new_episodes?

https://relishapp.com/vcr/vcr/v/2-9-3/docs/record-modes/new-episodes - here's the docs for this option.

I can do it when wrapping a block in a vcr recording, however I want to use this setting for one of my features, how do I go about doing that? Can I pass it in on the describe line?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与之呼应 2025-02-02 15:19:48

2.9.3非常旧(当前版本似乎是6.1.0)。

话虽这么说,根据文档,几乎显示了这个确切的示例,您可以通过:vcr键传递该选项

VCR.configure do |c| 
  c.configure_rspec_metadata!
end

然后

spec/your_spec.rb

describe 'Do something with an api', feature: true, js: true, vcr: {record: :new_episodes} do

2.9.3 is extremely old (current version appears to be 6.1.0).

That being said according to the docs, which show almost this exact example, you can pass that option through the :vcr key in the Hash

spec/spec_helper.rb

VCR.configure do |c| 
  c.configure_rspec_metadata!
end

And then

spec/your_spec.rb

describe 'Do something with an api', feature: true, js: true, vcr: {record: :new_episodes} do
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文