Sha256: 1457c8007cde5443b11ae468dfbf129184f20b94ce793d02fe8d4eed75fefa21

Contents?: true

Size: 306 Bytes

Versions: 8

Compression:

Stored size: 306 Bytes

Contents

RSpec::Matchers.define :be_jsonapi_response_for do |model|
  match do |actual|
    parsed_actual = JSON.parse(actual)
    parsed_actual.dig('data', 'type') == model &&
      parsed_actual.dig('data', 'attributes').is_a?(Hash)
    # &&
    # parsed_actual.dig('data', 'relationships').is_a?(Hash)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pwb-1.4.0 spec/support/matchers/json_matchers.rb
pwb-1.3.0 spec/support/matchers/json_matchers.rb
pwb-1.2.0 spec/support/matchers/json_matchers.rb
pwb-1.1.1 spec/support/matchers/json_matchers.rb
pwb-1.0.0 spec/support/matchers/json_matchers.rb
pwb-0.1.1 spec/support/matchers/json_matchers.rb
pwb-0.1.0 spec/support/matchers/json_matchers.rb
pwb-0.0.2 spec/support/matchers/json_matchers.rb