Sha256: b5dba1b4d3e9ef9958d2949f597dee04eb60d576e080ac04023002703bcf2f47

Contents?: true

Size: 467 Bytes

Versions: 9

Compression:

Stored size: 467 Bytes

Contents

RSpec::Matchers.define :match_attributes do |expected|
  match do |actual|
    success = true
    expected.each_pair do |key,value|
      # check if its a boolean
      success = if !!actual.send(key) == actual.send(key)
        actual.send(key) == (value != 0)
      elsif actual.send(key).is_a?(Time)
        actual.send(key).utc.to_i == value.utc.to_i
      else
        actual.send(key) == value
      end
      break unless success
    end
    success
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mail_manager-3.2.25.1 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.22.0 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.7 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.6 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.5 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.4 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.2 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.1 spec/test_app/spec/support/custom_matchers.rb
mail_manager-3.2.0 spec/test_app/spec/support/custom_matchers.rb