Sha256: 22ee5c2bfab2cf14367f1435cc460f86f5ac4f170ff622ab3979594a2e2d351a

Contents?: true

Size: 365 Bytes

Versions: 16

Compression:

Stored size: 365 Bytes

Contents



RSpec::Matchers.define :have_attributes do |expected_attributes|
  match do |actual|
    # actual is a Hash object representing an object, like this:
    # { "product" => { "name" => "Product #1" } }
    actual_attributes = actual.values.first.keys.map(&:to_sym)
    expected_attributes.map(&:to_sym).all? { |attr| actual_attributes.include?(attr) }
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spree_api-1.2.5 spec/support/have_attributes_matcher.rb
spree_api-1.1.6 spec/support/have_attributes_matcher.rb
spree_api-1.1.5 spec/support/have_attributes_matcher.rb
spree_api-1.2.4 spec/support/have_attributes_matcher.rb
spree_api-1.2.3 spec/support/have_attributes_matcher.rb
spree_api-1.2.2 spec/support/have_attributes_matcher.rb
spree_api-1.1.4 spec/support/have_attributes_matcher.rb
spree_api-1.2.0 spec/support/have_attributes_matcher.rb
spree_api-1.2.0.rc2 spec/support/have_attributes_matcher.rb
spree_api-1.2.0.rc1 spec/support/have_attributes_matcher.rb
spree_api-1.1.3 spec/support/have_attributes_matcher.rb
spree_api-1.1.2 spec/support/have_attributes_matcher.rb
spree_api-1.1.2.rc1 spec/support/have_attributes_matcher.rb
spree_api-1.1.1 spec/support/have_attributes_matcher.rb
spree_api-1.1.0 spec/support/have_attributes_matcher.rb
spree_api-1.1.0.rc2 spec/support/have_attributes_matcher.rb