Sha256: 2afebe6fe6de7f0832cc8de9daf21edf7acdc2f01fc07ee78fcebe8d9a257f06
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 Bytes
Contents
# frozen_string_literal: true require 'json' module Vacuum # Custom VCR matcher for stubbing calls to the Product Advertising API # @api private class Matcher IGNORED_KEYS = %w[PartnerTag].freeze attr_reader :requests def self.call(*requests) new(*requests).compare end def initialize(*requests) @requests = requests end def compare uris.reduce(:==) && bodies.reduce(:==) end private def uris requests.map(&:uri) end def bodies requests.map do |req| params = JSON.parse(req.body) IGNORED_KEYS.each { |k| params.delete(k) } params end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vacuum-3.0.0 | lib/vacuum/matcher.rb |