Sha256: b7190bb1c1be2ac74cfebde0531aea4ccc66e8276b1c9ad88510c8a7b64f30fb

Contents?: true

Size: 819 Bytes

Versions: 41

Compression:

Stored size: 819 Bytes

Contents

shared_context "product prototype" do

  def build_option_type_with_values(name, values)
    ot = FactoryGirl.create(:option_type, :name => name)
    values.each do |val|
      ot.option_values.create(:name => val.downcase, :presentation => val)
    end
    ot
  end

  let(:product_attributes) do
    # FactoryGirl.attributes_for is un-deprecated!
    #   https://github.com/thoughtbot/factory_girl/issues/274#issuecomment-3592054
    FactoryGirl.attributes_for(:base_product)
  end

  let(:prototype) do
    size = build_option_type_with_values("size", %w(Small Medium Large))
    FactoryGirl.create(:prototype, :name => "Size", :option_types => [ size ])
  end

  let(:option_values_hash) do
    hash = {}
    prototype.option_types.each do |i|
      hash[i.id.to_s] = i.option_value_ids
    end
    hash
  end

end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
solidus_frontend-1.2.3 spec/support/shared_contexts/product_prototypes.rb
solidus_frontend-1.1.4 spec/support/shared_contexts/product_prototypes.rb
solidus_frontend-1.0.7 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.5 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.4 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.3 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.2 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.0.10 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.1 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.0 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.0.rc4 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.0.9 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.0.rc3 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.0.rc2 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.1.0.rc1 spec/support/shared_contexts/product_prototypes.rb
solidus_frontend-1.0.6 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.0.8 spec/support/shared_contexts/product_prototypes.rb
solidus_frontend-1.2.2 spec/support/shared_contexts/product_prototypes.rb
spree_frontend-3.0.7 spec/support/shared_contexts/product_prototypes.rb
solidus_frontend-1.2.1 spec/support/shared_contexts/product_prototypes.rb