Sha256: 0ee8c4d59e032323f9d725d94626e7aa57af22c7efcc626a10bf1a89f397bdce

Contents?: true

Size: 678 Bytes

Versions: 28

Compression:

Stored size: 678 Bytes

Contents

RSpec::Matchers.define :be_eql_hash_with_regexes do |expected|
  def check_value(actual_value, expected_value)
    if expected_value.is_a?(Hash)
      expected_value.all? { |k, _| check_value(actual_value[k], expected_value[k]) }
    elsif expected_value.is_a?(Array)
      expected_value.each_with_index.map do |v, i|
        check_value(actual_value[i], v)
      end.all?
    elsif expected_value.is_a?(Regexp)
      actual_value.match(expected_value)
    else
      actual_value == expected_value
    end
  end

  match do |actual|
    expected.all? do |key, expected_value|
      actual_value = actual[key]

      check_value(actual_value, expected_value)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rollbar-2.18.2 spec/support/matchers.rb
rollbar-2.18.0 spec/support/matchers.rb
rollbar-2.17.0 spec/support/matchers.rb
rollbar-2.16.4 spec/support/matchers.rb
rollbar-2.16.3 spec/support/matchers.rb
rollbar-2.16.2 spec/support/matchers.rb
rollbar-2.16.0 spec/support/matchers.rb
rollbar-2.15.6 spec/support/matchers.rb
rollbar-2.15.5 spec/support/matchers.rb
rollbar-2.15.4 spec/support/matchers.rb
rollbar-2.15.3 spec/support/matchers.rb
rollbar-2.15.2 spec/support/matchers.rb
rollbar-2.15.1 spec/support/matchers.rb
rollbar-2.15.0 spec/support/matchers.rb
rollbar-2.14.1 spec/support/matchers.rb
rollbar-2.14.0 spec/support/matchers.rb
rollbar-2.13.3 spec/support/matchers.rb
rollbar-2.13.2 spec/support/matchers.rb
rollbar-2.13.1 spec/support/matchers.rb
rollbar-2.13.0 spec/support/matchers.rb