Class: JsonBodyMatcher
- Inherits:
-
Object
- Object
- JsonBodyMatcher
- Defined in:
- lib/matic/testing/vcr_json_api/json_body_matcher.rb
Class Method Summary collapse
Class Method Details
.call(actual, expected) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/matic/testing/vcr_json_api/json_body_matcher.rb', line 17 def self.call(actual, expected) return true if actual.body.blank? && expected.body.blank? DeepDiff.(JSON(actual.body), JSON(expected.body)).tap do |diff| if diff.present? puts colorize('Difference between request bodies:') puts colorize(JSON.pretty_generate(diff)) end end.empty? end |
.colorize(string) ⇒ Object
28 29 30 |
# File 'lib/matic/testing/vcr_json_api/json_body_matcher.rb', line 28 def self.colorize(string) string.respond_to?(:colorize) ? string.colorize(:red) : string end |