是否可以在Ruby中使用VCR gem来记录传出的消息并期望发送正确的消息?

sshcrbum  于 2023-06-29  发布在  Ruby
关注(0)|答案(1)|浏览(101)

这将是与Webmock相同的功能。只不过它用的是磁带而不是琴弦。
类似于expect(Webmock)to receive...

vqlkdk9b

vqlkdk9b1#

这里有一个配置:match_requests_on
默认值为[:method, :uri]

VCR.configure do |config|
  config.default_cassette_options[:match_requests_on] = [:method, :uri, :body, :headers]
end

https://nicolasiensen.gitbook.io/vcr/configuration/default_cassette_options#match_requests_on-defaults-to-method-uri-when-it-has-not-been-set
https://nicolasiensen.gitbook.io/vcr/request-matching/body

相关问题