Sha256: fed768ee5c0ec1b5e3c4b2fdac20a6b17e23dce6b2f8a556527d44cc60b0d42c

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

shared_examples 'Unidom::Product::Concerns::AsTargetProduct' do |model_attributes|

  context do

    source_product_associating_1_attribtues = {
        source_id:                SecureRandom.uuid,
        product_association_code: 'CPLM',
        ordinal:                  1,
        quantity:                 1
      }

    source_product_associating_2_attribtues = {
        source_id:                SecureRandom.uuid,
        product_association_code: 'ICPT',
        ordinal:                  2,
        quantity:                 2
      }

    it_behaves_like 'has_many', model_attributes, :source_product_associatings, Unidom::Product::ProductAssociating, [ source_product_associating_1_attribtues, source_product_associating_2_attribtues ]

    model  = described_class.create! model_attributes
    source = described_class.create! model_attributes
    it_behaves_like 'assert_present!', model, :is_associated!, [ source, { due_to: 'CPLM', at: Time.now } ], [ { 0 => :source }, :due_to, :at ]
    it_behaves_like 'assert_present!', model, :is_associated?, [ source, { due_to: 'CPLM', at: Time.now } ], [ { 0 => :source }, :due_to, :at ]

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unidom-product-2.0 lib/rspec/models/unidom/product/concerns/as_target_product_shared_examples.rb
unidom-product-1.7.8 lib/rspec/models/unidom/product/concerns/as_target_product_shared_examples.rb
unidom-product-1.7.7 lib/rspec/models/unidom/product/concerns/as_target_product_shared_examples.rb