Sha256: 66906618f5c5c4b772816b645957ad449a1f0d0821e393aa46d8d6f5e00a7aa5

Contents?: true

Size: 384 Bytes

Versions: 7

Compression:

Stored size: 384 Bytes

Contents

RSpec::Matchers.define :be_json_with do |expected|
  match do |json_string|
    json_string == expected.to_json
  end
end

RSpec::Matchers.define :contain_keys do |*expected|
  match do |json_string|
    begin
      @actual = JSON.parse(json_string).keys
      @expected = expected.first
      @actual.sort == @expected.sort
    rescue
      @actual = []
      false
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
upholsterer-1.4.0 spec/support/matchers/json_matcher.rb
upholsterer-1.3.0 spec/support/matchers/json_matcher.rb
upholsterer-1.2.0 spec/support/matchers/json_matcher.rb
upholsterer-1.1.0 spec/support/matchers/json_matcher.rb
upholsterer-1.0.0 spec/support/matchers/json_matcher.rb
upholsterer-0.5.0 spec/support/matchers/json_matcher.rb
upholsterer-0.4.5 spec/support/matchers/json_matcher.rb