Sha256: 7dfdae3bc9469101a0aafb41be25209f3d7a1ebe6a3146f8b9b7328b170cbb07

Contents?: true

Size: 759 Bytes

Versions: 11

Compression:

Stored size: 759 Bytes

Contents

require 'rspec/matchers' # @see https://rubygems.org/gems/rspec
require_relative 'support/extensions'

RSpec::Matchers.define :produce_jsonld do |expected, logger|
  match do |actual|
    expect(actual).to be_equivalent_jsonld expected
  end

  failure_message do |actual|
    "Expected: #{expected.is_a?(String) ? expected : expected.to_json(JSON_STATE) rescue 'malformed json'}\n" +
    "Actual  : #{actual.is_a?(String) ? actual : actual.to_json(JSON_STATE) rescue 'malformed json'}\n" +
    "\nDebug:\n#{logger}"
  end

  failure_message_when_negated do |actual|
    "Expected not to produce the following:\n" + 
    "Actual  : #{actual.is_a?(String) ? actual : actual.to_json(JSON_STATE) rescue 'malformed json'}\n" +
    "\nDebug:\n#{logger}"
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
json-ld-3.2.4 spec/matchers.rb
json-ld-3.2.3 spec/matchers.rb
json-ld-3.2.2 spec/matchers.rb
json-ld-3.2.1 spec/matchers.rb
json-ld-3.2.0 spec/matchers.rb
json-ld-3.1.10 spec/matchers.rb
json-ld-3.1.9 spec/matchers.rb
json-ld-3.1.8 spec/matchers.rb
json-ld-3.1.7 spec/matchers.rb
json-ld-3.1.6 spec/matchers.rb
json-ld-3.1.5 spec/matchers.rb