Sha256: a7ba2f153622f91a4a575269ba7ad66958fb5f6dc55bb6cf85828bacd7527d9e

Contents?: true

Size: 566 Bytes

Versions: 2

Compression:

Stored size: 566 Bytes

Contents

module Workarea
  module Factories
    module GiftWrapping
      Factories.add(self)

      def create_gift_wrap(overrides = {})
        attributes =
          { name: 'Test', sku: 'GW_TEST' }.merge(overrides.slice(:name, :sku))

        Workarea::Catalog::GiftWrap.create!(attributes).tap do |wrap|
          if overrides[:pricing].present?
            attributes = { id: wrap.sku, prices: [{ regular: 1.to_m }] }
                         .merge(overrides[:pricing])

            create_pricing_sku(attributes)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-gift_wrapping-1.3.0 test/factories/workarea/gift_wrapping.rb
workarea-gift_wrapping-1.2.1 test/factories/workarea/gift_wrapping.rb