lib/json_matchers/matcher.rb in json_matchers-0.6.0 vs lib/json_matchers/matcher.rb in json_matchers-0.6.1
- old
+ new
@@ -1,12 +1,12 @@
require "json-schema"
module JsonMatchers
class Matcher
- def initialize(schema_path, **options)
+ def initialize(schema_path, options = {})
@schema_path = schema_path
- @options = options
+ @options = default_options.merge(options)
end
def matches?(response)
JSON::Validator.validate!(
schema_path.to_s,
@@ -32,8 +32,12 @@
if response.respond_to?(:body)
response.body
else
response
end
+ end
+
+ def default_options
+ JsonMatchers.configuration.options || {}
end
end
end