Sha256: e6cb5805176268dfecd6e9a18027fccd871626e3d16e6d5ebb16294cd65bb630

Contents?: true

Size: 559 Bytes

Versions: 24

Compression:

Stored size: 559 Bytes

Contents

# frozen_string_literal: true

require "json"

RSpec::Matchers.define :contain_json do
  match do
    sub_json = expected
    filename = actual

    filepath = File.join(project_path, filename)
    json = JSON.parse(IO.read(filepath), symbolize_names: true)
    sub_json <= json
  end

  failure_message do
    sub_json = expected
    filename = actual

    filepath = File.join(project_path, filename)
    json = JSON.parse(IO.read(filepath), symbolize_names: true)

    "in #{filename}, expected to find\n#{sub_json.inspect}\nin\n#{json.inspect}"
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
welaika-suspenders-3.0 spec/support/contain_json_matcher.rb
welaika-suspenders-2.36 spec/support/contain_json_matcher.rb
welaika-suspenders-2.35 spec/support/contain_json_matcher.rb
welaika-suspenders-2.34 spec/support/contain_json_matcher.rb
suspenders-1.53.0 spec/support/contain_json_matcher.rb
welaika-suspenders-2.33 spec/support/contain_json_matcher.rb
welaika-suspenders-2.32.2 spec/support/contain_json_matcher.rb
welaika-suspenders-2.32.1 spec/support/contain_json_matcher.rb
welaika-suspenders-2.32.0 spec/support/contain_json_matcher.rb
suspenders-1.52.0 spec/support/contain_json_matcher.rb
suspenders-1.51.0 spec/support/contain_json_matcher.rb
welaika-suspenders-2.31.0 spec/support/contain_json_matcher.rb
welaika-suspenders-2.30.0 spec/support/contain_json_matcher.rb
bulldozer-1.6.3 spec/support/contain_json_matcher.rb
bulldozer-1.6.2 spec/support/contain_json_matcher.rb
bulldozer-1.6.1 spec/support/contain_json_matcher.rb
bulldozer-1.6.0 spec/support/contain_json_matcher.rb
suspenders-1.50.0 spec/support/contain_json_matcher.rb
suspenders-1.49.0 spec/support/contain_json_matcher.rb
welaika-suspenders-2.29.0 spec/support/contain_json_matcher.rb