Sha256: dce46ec055bbbfb6bfda1bce1f3626697818740191ceb1f1c558d28a8e3bfcff

Contents?: true

Size: 468 Bytes

Versions: 14

Compression:

Stored size: 468 Bytes

Contents

require "rspec/expectations"

RSpec::Matchers.define :satisfies_schema do |expected|
  match do |actual|
    @check = expected.call actual
    @check.success?
  end

  failure_message do |actual|
    msg = "expected that given hash will fit the schema.\n"
        
    @check.errors.each do |item|
      item.path.each do |path|
        msg += "#{path}."
      end

      msg = msg.delete_suffix(".")

      msg += ": #{item.text}\n"
    end

    return msg
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pubnub-4.6.0 spec/spec_expectations.rb
pubnub-4.5.0 spec/spec_expectations.rb
pubnub-4.4.0 spec/spec_expectations.rb
pubnub-4.3.0 spec/spec_expectations.rb
pubnub-4.2.7 spec/spec_expectations.rb
pubnub-4.2.6 spec/spec_expectations.rb
pubnub-4.2.5 spec/spec_expectations.rb
pubnub-4.2.4 spec/spec_expectations.rb
pubnub-4.2.3 spec/spec_expectations.rb
pubnub-4.2.2 spec/spec_expectations.rb
pubnub-4.2.1 spec/spec_expectations.rb
pubnub-4.2.0 spec/spec_expectations.rb
pubnub-4.1.6 spec/spec_expectations.rb
pubnub-4.1.5 spec/spec_expectations.rb