Sha256: 885104b1c9fffa06688123fa5d5b2cfdf015dfe92ff7fc15c09f0bb979111713

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

describe 'Add to cart', type: :system do
  let!(:store) { Spree::Store.default }
  let!(:order) { create :completed_order_with_totals }
  let!(:line_item) { order.line_items.first }

  stub_authorization!

  before do
    current_order_stubs(order)
    stub_const 'ENV', ENV.to_h.merge(env_variable => 'XXX-YYYYY')

    visit spree.product_path(line_item.product)
    find('#add-to-cart-button').click
  end

  context 'when PINTEREST_TAG_ID environment variable is present' do
    let(:env_variable) { 'PINTEREST_TAG_ID' }

    it 'tracks "add to cart" event' do
      expect(page).to track_analytics_event :pinterest, 'addtocart', [
        'track', 'addtocart', order.total, order.number, line_item.variant.product.master.sku,
        line_item.name, line_item.variant.sku, line_item.variant.price
      ]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_seo-1.0.11 spec/features/add_to_cart_spec.rb
solidus_seo-1.0.10 spec/features/add_to_cart_spec.rb
solidus_seo-1.0.8 spec/features/add_to_cart_spec.rb