Sha256: 0f9efcacf52d9f9000e67c134d578191e5e80d12a7a13428803290f7afce66ab
Contents?: true
Size: 852 Bytes
Versions: 5
Compression:
Stored size: 852 Bytes
Contents
[:json_eq, :json_like].each do |it| def as_matcher_json(obj, options = {}) if obj.instance_of? String JSON.parse(obj).with_indifferent_access.as_json options else obj.as_json options end end RSpec::Matchers.define it do |expected, options={}| match do |actual| as_matcher_json(actual, options) == as_matcher_json(expected, options) end failure_message_for_should do |actual| <<-EOS expected: #{as_matcher_json(expected, options)} (#{expected.class}) got: #{as_matcher_json(actual, options)} (#{actual.class}) EOS end failure_message_for_should_not do |actual| <<-EOS expected: value != #{as_matcher_json(expected, options)} (#{expected.class}) got: #{as_matcher_json(actual, options)} (#{actual.class}) EOS end end end
Version data entries
5 entries across 5 versions & 1 rubygems