Sha256: d838936087a921da44e278d8e5ceda13930dd37dc78e7f6c1eff046c827b829f

Contents?: true

Size: 331 Bytes

Versions: 43

Compression:

Stored size: 331 Bytes

Contents

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

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
solidus_api-2.5.2 spec/support/have_attributes_matcher.rb
solidus_api-2.5.1 spec/support/have_attributes_matcher.rb
solidus_api-2.5.0 spec/support/have_attributes_matcher.rb
solidus_api-2.5.0.rc1 spec/support/have_attributes_matcher.rb
solidus_api-2.5.0.beta2 spec/support/have_attributes_matcher.rb
solidus_api-2.5.0.beta1 spec/support/have_attributes_matcher.rb
solidus_api-2.4.2 spec/support/have_attributes_matcher.rb
solidus_api-2.4.1 spec/support/have_attributes_matcher.rb
solidus_api-2.3.1 spec/support/have_attributes_matcher.rb
solidus_api-2.2.2 spec/support/have_attributes_matcher.rb
solidus_api-2.1.1 spec/support/have_attributes_matcher.rb
solidus_api-2.0.3 spec/support/have_attributes_matcher.rb
solidus_api-1.4.2 spec/support/have_attributes_matcher.rb
solidus_api-1.3.2 spec/support/have_attributes_matcher.rb
solidus_api-2.4.0 spec/support/have_attributes_matcher.rb
solidus_api-2.4.0.rc1 spec/support/have_attributes_matcher.rb
solidus_api-2.4.0.beta1 spec/support/have_attributes_matcher.rb
solidus_api-2.3.0 spec/support/have_attributes_matcher.rb
solidus_api-2.3.0.rc3 spec/support/have_attributes_matcher.rb
solidus_api-2.3.0.rc2 spec/support/have_attributes_matcher.rb