solidus_frontend 2.10.5 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solidus_frontend might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/app/assets/javascripts/spree/frontend/checkout/address.js +1 -1
 - data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js +1 -1
 - data/app/controllers/spree/checkout_controller.rb +9 -5
 - data/app/controllers/spree/orders_controller.rb +9 -9
 - data/app/controllers/spree/products_controller.rb +1 -1
 - data/app/views/spree/address/_form.html.erb +15 -8
 - data/app/views/spree/address/_form_hidden.html.erb +6 -2
 - data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
 - data/app/views/spree/orders/_form.html.erb +1 -1
 - data/app/views/spree/shared/_address.html.erb +1 -1
 - data/app/views/spree/shared/_image.html.erb +3 -2
 - data/solidus_frontend.gemspec +5 -5
 - metadata +10 -53
 - data/script/rails +0 -10
 - data/spec/controllers/controller_helpers_spec.rb +0 -29
 - data/spec/controllers/locale_controller_spec.rb +0 -57
 - data/spec/controllers/spree/checkout_controller_spec.rb +0 -610
 - data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -37
 - data/spec/controllers/spree/content_controller_spec.rb +0 -9
 - data/spec/controllers/spree/current_order_tracking_spec.rb +0 -47
 - data/spec/controllers/spree/home_controller_spec.rb +0 -29
 - data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -90
 - data/spec/controllers/spree/orders_controller_spec.rb +0 -254
 - data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -33
 - data/spec/controllers/spree/products_controller_spec.rb +0 -38
 - data/spec/controllers/spree/taxons_controller_spec.rb +0 -14
 - data/spec/features/address_spec.rb +0 -78
 - data/spec/features/automatic_promotion_adjustments_spec.rb +0 -49
 - data/spec/features/caching/products_spec.rb +0 -48
 - data/spec/features/caching/taxons_spec.rb +0 -21
 - data/spec/features/cart_spec.rb +0 -85
 - data/spec/features/checkout_confirm_insufficient_stock_spec.rb +0 -71
 - data/spec/features/checkout_spec.rb +0 -758
 - data/spec/features/checkout_unshippable_spec.rb +0 -37
 - data/spec/features/coupon_code_spec.rb +0 -266
 - data/spec/features/currency_spec.rb +0 -20
 - data/spec/features/first_order_promotion_spec.rb +0 -59
 - data/spec/features/free_shipping_promotions_spec.rb +0 -60
 - data/spec/features/locale_spec.rb +0 -26
 - data/spec/features/order_spec.rb +0 -73
 - data/spec/features/products_spec.rb +0 -291
 - data/spec/features/promotion_code_invalidation_spec.rb +0 -54
 - data/spec/features/quantity_promotions_spec.rb +0 -130
 - data/spec/features/taxons_spec.rb +0 -158
 - data/spec/features/template_rendering_spec.rb +0 -20
 - data/spec/fixtures/thinking-cat.jpg +0 -0
 - data/spec/generators/solidus/views/override_generator_spec.rb +0 -50
 - data/spec/helpers/base_helper_spec.rb +0 -13
 - data/spec/helpers/order_helper_spec.rb +0 -14
 - data/spec/helpers/taxon_filters_helper_spec.rb +0 -12
 - data/spec/spec_helper.rb +0 -106
 - data/spec/support/shared_contexts/checkout_setup.rb +0 -12
 - data/spec/support/shared_contexts/custom_products.rb +0 -28
 - data/spec/support/shared_contexts/locales.rb +0 -16
 - data/spec/views/spree/checkout/_summary_spec.rb +0 -11
 
    
        data/spec/features/order_spec.rb
    DELETED
    
    | 
         @@ -1,73 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            describe 'orders', type: :feature do
         
     | 
| 
       6 
     | 
    
         
            -
              let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:complete) }
         
     | 
| 
       7 
     | 
    
         
            -
              let(:user) { create(:user) }
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              before do
         
     | 
| 
       10 
     | 
    
         
            -
                order.update_attribute(:user_id, user.id)
         
     | 
| 
       11 
     | 
    
         
            -
                allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
         
     | 
| 
       12 
     | 
    
         
            -
              end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              it "can visit an order" do
         
     | 
| 
       15 
     | 
    
         
            -
                # Regression test for current_user call on orders/show
         
     | 
| 
       16 
     | 
    
         
            -
                visit spree.order_path(order)
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
              it "should display line item price" do
         
     | 
| 
       20 
     | 
    
         
            -
                # Regression test for https://github.com/spree/spree/issues/2772
         
     | 
| 
       21 
     | 
    
         
            -
                line_item = order.line_items.first
         
     | 
| 
       22 
     | 
    
         
            -
                line_item.target_shipment = create(:shipment)
         
     | 
| 
       23 
     | 
    
         
            -
                line_item.price = 19.00
         
     | 
| 
       24 
     | 
    
         
            -
                line_item.save!
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                visit spree.order_path(order)
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                # Tests view spree/shared/_order_details
         
     | 
| 
       29 
     | 
    
         
            -
                within 'td.price' do
         
     | 
| 
       30 
     | 
    
         
            -
                  expect(page).to have_content "19.00"
         
     | 
| 
       31 
     | 
    
         
            -
                end
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
              it "should have credit card info if paid with credit card" do
         
     | 
| 
       35 
     | 
    
         
            -
                create(:payment, order: order)
         
     | 
| 
       36 
     | 
    
         
            -
                visit spree.order_path(order)
         
     | 
| 
       37 
     | 
    
         
            -
                within '.payment-info' do
         
     | 
| 
       38 
     | 
    
         
            -
                  expect(page).to have_content "Ending in 1111"
         
     | 
| 
       39 
     | 
    
         
            -
                end
         
     | 
| 
       40 
     | 
    
         
            -
              end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
              it "should have payment method name visible if not paid with credit card" do
         
     | 
| 
       43 
     | 
    
         
            -
                create(:check_payment, order: order)
         
     | 
| 
       44 
     | 
    
         
            -
                visit spree.order_path(order)
         
     | 
| 
       45 
     | 
    
         
            -
                within '.payment-info' do
         
     | 
| 
       46 
     | 
    
         
            -
                  expect(page).to have_content "Check"
         
     | 
| 
       47 
     | 
    
         
            -
                end
         
     | 
| 
       48 
     | 
    
         
            -
              end
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
              # Regression test for https://github.com/spree/spree/issues/2282
         
     | 
| 
       51 
     | 
    
         
            -
              context "can support a credit card with blank information" do
         
     | 
| 
       52 
     | 
    
         
            -
                before do
         
     | 
| 
       53 
     | 
    
         
            -
                  credit_card = create(:credit_card)
         
     | 
| 
       54 
     | 
    
         
            -
                  credit_card.update_column(:cc_type, '')
         
     | 
| 
       55 
     | 
    
         
            -
                  payment = order.payments.first
         
     | 
| 
       56 
     | 
    
         
            -
                  payment.source = credit_card
         
     | 
| 
       57 
     | 
    
         
            -
                  payment.save!
         
     | 
| 
       58 
     | 
    
         
            -
                end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                specify do
         
     | 
| 
       61 
     | 
    
         
            -
                  visit spree.order_path(order)
         
     | 
| 
       62 
     | 
    
         
            -
                  expect(find('.payment-info')).to have_no_css('img')
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
              end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
              it "should return the correct title when displaying a completed order" do
         
     | 
| 
       67 
     | 
    
         
            -
                visit spree.order_path(order)
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                within '#order_summary' do
         
     | 
| 
       70 
     | 
    
         
            -
                  expect(page).to have_content("#{I18n.t('spree.order')} #{order.number}")
         
     | 
| 
       71 
     | 
    
         
            -
                end
         
     | 
| 
       72 
     | 
    
         
            -
              end
         
     | 
| 
       73 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,291 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            describe "Visiting Products", type: :feature, inaccessible: true do
         
     | 
| 
       6 
     | 
    
         
            -
              include_context "custom products"
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              let(:store_name) do
         
     | 
| 
       9 
     | 
    
         
            -
                ((first_store = Spree::Store.first) && first_store.name).to_s
         
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              before(:each) do
         
     | 
| 
       13 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              it "should be able to show the shopping cart after adding a product to it" do
         
     | 
| 
       17 
     | 
    
         
            -
                click_link "Ruby on Rails Ringer T-Shirt"
         
     | 
| 
       18 
     | 
    
         
            -
                expect(page).to have_content("$19.99")
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                click_button 'add-to-cart-button'
         
     | 
| 
       21 
     | 
    
         
            -
                expect(page).to have_content("Shopping Cart")
         
     | 
| 
       22 
     | 
    
         
            -
              end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              # Regression spec for Spree [PR#7442](https://github.com/spree/spree/pull/7442)
         
     | 
| 
       25 
     | 
    
         
            -
              context "when generating product links" do
         
     | 
| 
       26 
     | 
    
         
            -
                let(:product) { Spree::Product.available.first }
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                it "should not use the *_url helper to generate the product links" do
         
     | 
| 
       29 
     | 
    
         
            -
                  visit spree.root_path
         
     | 
| 
       30 
     | 
    
         
            -
                  expect(page).not_to have_xpath(".//a[@href='#{spree.product_url(product, host: current_host)}']")
         
     | 
| 
       31 
     | 
    
         
            -
                end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                it "should use *_path helper to generate the product links" do
         
     | 
| 
       34 
     | 
    
         
            -
                 visit spree.root_path
         
     | 
| 
       35 
     | 
    
         
            -
                 expect(page).to have_xpath(".//a[@href='#{spree.product_path(product)}']")
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
              end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
              describe 'meta tags and title' do
         
     | 
| 
       40 
     | 
    
         
            -
                let(:jersey) { Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey') }
         
     | 
| 
       41 
     | 
    
         
            -
                let(:metas) { { meta_description: 'Brand new Ruby on Rails Jersey', meta_title: 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel', meta_keywords: 'ror, jersey, ruby' } }
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                it 'should return the correct title when displaying a single product' do
         
     | 
| 
       44 
     | 
    
         
            -
                  click_link jersey.name
         
     | 
| 
       45 
     | 
    
         
            -
                  expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
         
     | 
| 
       46 
     | 
    
         
            -
                  within('div#product-description') do
         
     | 
| 
       47 
     | 
    
         
            -
                    within('h1.product-title') do
         
     | 
| 
       48 
     | 
    
         
            -
                      expect(page).to have_content('Ruby on Rails Baseball Jersey')
         
     | 
| 
       49 
     | 
    
         
            -
                    end
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
                end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                it 'displays metas' do
         
     | 
| 
       54 
     | 
    
         
            -
                  jersey.update metas
         
     | 
| 
       55 
     | 
    
         
            -
                  click_link jersey.name
         
     | 
| 
       56 
     | 
    
         
            -
                  expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
         
     | 
| 
       57 
     | 
    
         
            -
                  expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
         
     | 
| 
       58 
     | 
    
         
            -
                end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                it 'displays title if set' do
         
     | 
| 
       61 
     | 
    
         
            -
                  jersey.update metas
         
     | 
| 
       62 
     | 
    
         
            -
                  click_link jersey.name
         
     | 
| 
       63 
     | 
    
         
            -
                  expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
         
     | 
| 
       64 
     | 
    
         
            -
                end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                it "doesn't use meta_title as heading on page" do
         
     | 
| 
       67 
     | 
    
         
            -
                  jersey.update metas
         
     | 
| 
       68 
     | 
    
         
            -
                  click_link jersey.name
         
     | 
| 
       69 
     | 
    
         
            -
                  within("h1") do
         
     | 
| 
       70 
     | 
    
         
            -
                    expect(page).to have_content(jersey.name)
         
     | 
| 
       71 
     | 
    
         
            -
                    expect(page).not_to have_content(jersey.meta_title)
         
     | 
| 
       72 
     | 
    
         
            -
                  end
         
     | 
| 
       73 
     | 
    
         
            -
                end
         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                it 'uses product name in title when meta_title set to empty string' do
         
     | 
| 
       76 
     | 
    
         
            -
                  jersey.update meta_title: ''
         
     | 
| 
       77 
     | 
    
         
            -
                  click_link jersey.name
         
     | 
| 
       78 
     | 
    
         
            -
                  expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
         
     | 
| 
       79 
     | 
    
         
            -
                end
         
     | 
| 
       80 
     | 
    
         
            -
              end
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
              describe 'schema.org markup' do
         
     | 
| 
       83 
     | 
    
         
            -
                let(:product) { Spree::Product.available.first }
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                it 'has correct schema.org/Offer attributes' do
         
     | 
| 
       86 
     | 
    
         
            -
                  expect(page).to have_css("#product_#{product.id} [itemprop='price'][content='19.99']")
         
     | 
| 
       87 
     | 
    
         
            -
                  expect(page).to have_css("#product_#{product.id} [itemprop='priceCurrency'][content='USD']")
         
     | 
| 
       88 
     | 
    
         
            -
                  click_link product.name
         
     | 
| 
       89 
     | 
    
         
            -
                  expect(page).to have_css("[itemprop='price'][content='19.99']")
         
     | 
| 
       90 
     | 
    
         
            -
                  expect(page).to have_css("[itemprop='priceCurrency'][content='USD']")
         
     | 
| 
       91 
     | 
    
         
            -
                end
         
     | 
| 
       92 
     | 
    
         
            -
              end
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
              context "using Russian Rubles as a currency" do
         
     | 
| 
       95 
     | 
    
         
            -
                before do
         
     | 
| 
       96 
     | 
    
         
            -
                  stub_spree_preferences(currency: "RUB")
         
     | 
| 
       97 
     | 
    
         
            -
                end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                let!(:product) do
         
     | 
| 
       100 
     | 
    
         
            -
                  product = Spree::Product.find_by(name: "Ruby on Rails Ringer T-Shirt")
         
     | 
| 
       101 
     | 
    
         
            -
                  product.price = 19.99
         
     | 
| 
       102 
     | 
    
         
            -
                  product.tap(&:save)
         
     | 
| 
       103 
     | 
    
         
            -
                end
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                # Regression tests for https://github.com/spree/spree/issues/2737
         
     | 
| 
       106 
     | 
    
         
            -
                context "uses руб as the currency symbol" do
         
     | 
| 
       107 
     | 
    
         
            -
                  it "on products page" do
         
     | 
| 
       108 
     | 
    
         
            -
                    visit spree.root_path
         
     | 
| 
       109 
     | 
    
         
            -
                    within("#product_#{product.id}") do
         
     | 
| 
       110 
     | 
    
         
            -
                      within(".price") do
         
     | 
| 
       111 
     | 
    
         
            -
                        expect(page).to have_content("19.99 ₽")
         
     | 
| 
       112 
     | 
    
         
            -
                      end
         
     | 
| 
       113 
     | 
    
         
            -
                    end
         
     | 
| 
       114 
     | 
    
         
            -
                  end
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                  it "on product page" do
         
     | 
| 
       117 
     | 
    
         
            -
                    visit spree.product_path(product)
         
     | 
| 
       118 
     | 
    
         
            -
                    within(".price") do
         
     | 
| 
       119 
     | 
    
         
            -
                      expect(page).to have_content("19.99 ₽")
         
     | 
| 
       120 
     | 
    
         
            -
                    end
         
     | 
| 
       121 
     | 
    
         
            -
                  end
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                  it "when adding a product to the cart", js: true do
         
     | 
| 
       124 
     | 
    
         
            -
                    visit spree.product_path(product)
         
     | 
| 
       125 
     | 
    
         
            -
                    click_button "Add To Cart"
         
     | 
| 
       126 
     | 
    
         
            -
                    click_link "Home"
         
     | 
| 
       127 
     | 
    
         
            -
                    within(".cart-info") do
         
     | 
| 
       128 
     | 
    
         
            -
                      expect(page).to have_content("19.99 ₽")
         
     | 
| 
       129 
     | 
    
         
            -
                    end
         
     | 
| 
       130 
     | 
    
         
            -
                  end
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                  it "when on the 'address' state of the cart" do
         
     | 
| 
       133 
     | 
    
         
            -
                    visit spree.product_path(product)
         
     | 
| 
       134 
     | 
    
         
            -
                    click_button "Add To Cart"
         
     | 
| 
       135 
     | 
    
         
            -
                    click_button "Checkout"
         
     | 
| 
       136 
     | 
    
         
            -
                    within("tr[data-hook=item_total]") do
         
     | 
| 
       137 
     | 
    
         
            -
                      expect(page).to have_content("19.99 ₽")
         
     | 
| 
       138 
     | 
    
         
            -
                    end
         
     | 
| 
       139 
     | 
    
         
            -
                  end
         
     | 
| 
       140 
     | 
    
         
            -
                end
         
     | 
| 
       141 
     | 
    
         
            -
              end
         
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
              it "should be able to search for a product" do
         
     | 
| 
       144 
     | 
    
         
            -
                fill_in "keywords", with: "shirt"
         
     | 
| 
       145 
     | 
    
         
            -
                click_button "Search"
         
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
                expect(page.all('ul.product-listing li').size).to eq(1)
         
     | 
| 
       148 
     | 
    
         
            -
              end
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
              context "a product with variants" do
         
     | 
| 
       151 
     | 
    
         
            -
                let(:product) { Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey") }
         
     | 
| 
       152 
     | 
    
         
            -
                let(:option_value) { create(:option_value) }
         
     | 
| 
       153 
     | 
    
         
            -
                let!(:variant) { product.variants.create!(price: 5.59) }
         
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
                before do
         
     | 
| 
       156 
     | 
    
         
            -
                  # Need to have two images to trigger the error
         
     | 
| 
       157 
     | 
    
         
            -
                  image = File.open(File.expand_path('../fixtures/thinking-cat.jpg', __dir__))
         
     | 
| 
       158 
     | 
    
         
            -
                  product.images.create!(attachment: image)
         
     | 
| 
       159 
     | 
    
         
            -
                  product.images.create!(attachment: image)
         
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
       161 
     | 
    
         
            -
                  product.option_types << option_value.option_type
         
     | 
| 
       162 
     | 
    
         
            -
                  variant.option_values << option_value
         
     | 
| 
       163 
     | 
    
         
            -
                end
         
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
                it "displays price of first variant listed", js: true do
         
     | 
| 
       166 
     | 
    
         
            -
                  click_link product.name
         
     | 
| 
       167 
     | 
    
         
            -
                  within("#product-price") do
         
     | 
| 
       168 
     | 
    
         
            -
                    expect(page).to have_content variant.price
         
     | 
| 
       169 
     | 
    
         
            -
                    expect(page).not_to have_content I18n.t('spree.out_of_stock')
         
     | 
| 
       170 
     | 
    
         
            -
                  end
         
     | 
| 
       171 
     | 
    
         
            -
                end
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                it "doesn't display out of stock for master product" do
         
     | 
| 
       174 
     | 
    
         
            -
                  product.master.stock_items.update_all count_on_hand: 0, backorderable: false
         
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
     | 
    
         
            -
                  click_link product.name
         
     | 
| 
       177 
     | 
    
         
            -
                  within("#product-price") do
         
     | 
| 
       178 
     | 
    
         
            -
                    expect(page).not_to have_content I18n.t('spree.out_of_stock')
         
     | 
| 
       179 
     | 
    
         
            -
                  end
         
     | 
| 
       180 
     | 
    
         
            -
                end
         
     | 
| 
       181 
     | 
    
         
            -
              end
         
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
              context "a product with variants, images only for the variants" do
         
     | 
| 
       184 
     | 
    
         
            -
                let(:product) { Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey") }
         
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
                before do
         
     | 
| 
       187 
     | 
    
         
            -
                  image = File.open(File.expand_path('../fixtures/thinking-cat.jpg', __dir__))
         
     | 
| 
       188 
     | 
    
         
            -
                  v1 = product.variants.create!(price: 9.99)
         
     | 
| 
       189 
     | 
    
         
            -
                  v2 = product.variants.create!(price: 10.99)
         
     | 
| 
       190 
     | 
    
         
            -
                  v1.images.create!(attachment: image)
         
     | 
| 
       191 
     | 
    
         
            -
                  v2.images.create!(attachment: image)
         
     | 
| 
       192 
     | 
    
         
            -
                end
         
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
                it "should not display no image available" do
         
     | 
| 
       195 
     | 
    
         
            -
                  visit spree.root_path
         
     | 
| 
       196 
     | 
    
         
            -
                  expect(page).to have_xpath("//img[contains(@src,'thinking-cat')]")
         
     | 
| 
       197 
     | 
    
         
            -
                end
         
     | 
| 
       198 
     | 
    
         
            -
              end
         
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
              it "should be able to hide products without price" do
         
     | 
| 
       201 
     | 
    
         
            -
                expect(page.all('ul.product-listing li').size).to eq(9)
         
     | 
| 
       202 
     | 
    
         
            -
                stub_spree_preferences(show_products_without_price: false)
         
     | 
| 
       203 
     | 
    
         
            -
                stub_spree_preferences(currency: "CAN")
         
     | 
| 
       204 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       205 
     | 
    
         
            -
                expect(page.all('ul.product-listing li').size).to eq(0)
         
     | 
| 
       206 
     | 
    
         
            -
              end
         
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
              it "should be able to display products priced under 10 dollars" do
         
     | 
| 
       209 
     | 
    
         
            -
                within(:css, '#taxonomies') { click_link "Ruby on Rails" }
         
     | 
| 
       210 
     | 
    
         
            -
                check "Price_Range_Under_$10.00"
         
     | 
| 
       211 
     | 
    
         
            -
                within(:css, '#sidebar_products_search') { click_button "Search" }
         
     | 
| 
       212 
     | 
    
         
            -
                expect(page).to have_content("No products found")
         
     | 
| 
       213 
     | 
    
         
            -
              end
         
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
              it "should be able to display products priced between 15 and 18 dollars" do
         
     | 
| 
       216 
     | 
    
         
            -
                within(:css, '#taxonomies') { click_link "Ruby on Rails" }
         
     | 
| 
       217 
     | 
    
         
            -
                check "Price_Range_$15.00_-_$18.00"
         
     | 
| 
       218 
     | 
    
         
            -
                within(:css, '#sidebar_products_search') { click_button "Search" }
         
     | 
| 
       219 
     | 
    
         
            -
             
     | 
| 
       220 
     | 
    
         
            -
                expect(page.all('ul.product-listing li').size).to eq(3)
         
     | 
| 
       221 
     | 
    
         
            -
                tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
         
     | 
| 
       222 
     | 
    
         
            -
                tmp.delete("")
         
     | 
| 
       223 
     | 
    
         
            -
                expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein", "Ruby on Rails Tote"])
         
     | 
| 
       224 
     | 
    
         
            -
              end
         
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
              it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
         
     | 
| 
       227 
     | 
    
         
            -
                stub_spree_preferences(products_per_page: 2)
         
     | 
| 
       228 
     | 
    
         
            -
                within(:css, '#taxonomies') { click_link "Ruby on Rails" }
         
     | 
| 
       229 
     | 
    
         
            -
                check "Price_Range_$15.00_-_$18.00"
         
     | 
| 
       230 
     | 
    
         
            -
                within(:css, '#sidebar_products_search') { click_button "Search" }
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
                expect(page.all('ul.product-listing li').size).to eq(2)
         
     | 
| 
       233 
     | 
    
         
            -
                products = page.all('ul.product-listing li a[itemprop=name]')
         
     | 
| 
       234 
     | 
    
         
            -
                expect(products.count).to eq(2)
         
     | 
| 
       235 
     | 
    
         
            -
             
     | 
| 
       236 
     | 
    
         
            -
                find('nav.pagination .next a').click
         
     | 
| 
       237 
     | 
    
         
            -
                products = page.all('ul.product-listing li a[itemprop=name]')
         
     | 
| 
       238 
     | 
    
         
            -
                expect(products.count).to eq(1)
         
     | 
| 
       239 
     | 
    
         
            -
              end
         
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
              it "should be able to display products priced 18 dollars and above" do
         
     | 
| 
       242 
     | 
    
         
            -
                within(:css, '#taxonomies') { click_link "Ruby on Rails" }
         
     | 
| 
       243 
     | 
    
         
            -
                check "Price_Range_$18.00_-_$20.00"
         
     | 
| 
       244 
     | 
    
         
            -
                check "Price_Range_$20.00_or_over"
         
     | 
| 
       245 
     | 
    
         
            -
                within(:css, '#sidebar_products_search') { click_button "Search" }
         
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
       247 
     | 
    
         
            -
                expect(page.all('ul.product-listing li').size).to eq(4)
         
     | 
| 
       248 
     | 
    
         
            -
                tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
         
     | 
| 
       249 
     | 
    
         
            -
                tmp.delete("")
         
     | 
| 
       250 
     | 
    
         
            -
                expect(tmp.sort!).to eq(["Ruby on Rails Bag",
         
     | 
| 
       251 
     | 
    
         
            -
                                         "Ruby on Rails Baseball Jersey",
         
     | 
| 
       252 
     | 
    
         
            -
                                         "Ruby on Rails Jr. Spaghetti",
         
     | 
| 
       253 
     | 
    
         
            -
                                         "Ruby on Rails Ringer T-Shirt"])
         
     | 
| 
       254 
     | 
    
         
            -
              end
         
     | 
| 
       255 
     | 
    
         
            -
             
     | 
| 
       256 
     | 
    
         
            -
              it "should be able to put a product without a description in the cart" do
         
     | 
| 
       257 
     | 
    
         
            -
                product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
         
     | 
| 
       258 
     | 
    
         
            -
                visit spree.product_path(product)
         
     | 
| 
       259 
     | 
    
         
            -
                expect(page).to have_content "This product has no description"
         
     | 
| 
       260 
     | 
    
         
            -
                click_button 'add-to-cart-button'
         
     | 
| 
       261 
     | 
    
         
            -
                expect(page).to have_content "This product has no description"
         
     | 
| 
       262 
     | 
    
         
            -
              end
         
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
              it "shouldn't be able to put a product without a current price in the cart" do
         
     | 
| 
       265 
     | 
    
         
            -
                product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
         
     | 
| 
       266 
     | 
    
         
            -
                stub_spree_preferences(currency: "CAN")
         
     | 
| 
       267 
     | 
    
         
            -
                stub_spree_preferences(show_products_without_price: true)
         
     | 
| 
       268 
     | 
    
         
            -
                visit spree.product_path(product)
         
     | 
| 
       269 
     | 
    
         
            -
                expect(page).to have_content "This product is not available in the selected currency."
         
     | 
| 
       270 
     | 
    
         
            -
                expect(page).not_to have_content "add-to-cart-button"
         
     | 
| 
       271 
     | 
    
         
            -
              end
         
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
              it "should be able to list products without a price" do
         
     | 
| 
       274 
     | 
    
         
            -
                product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
         
     | 
| 
       275 
     | 
    
         
            -
                stub_spree_preferences(currency: "CAN")
         
     | 
| 
       276 
     | 
    
         
            -
                stub_spree_preferences(show_products_without_price: true)
         
     | 
| 
       277 
     | 
    
         
            -
                visit spree.products_path
         
     | 
| 
       278 
     | 
    
         
            -
                expect(page).to have_content(product.name)
         
     | 
| 
       279 
     | 
    
         
            -
              end
         
     | 
| 
       280 
     | 
    
         
            -
             
     | 
| 
       281 
     | 
    
         
            -
              it "should return the correct title when displaying a single product" do
         
     | 
| 
       282 
     | 
    
         
            -
                product = Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey")
         
     | 
| 
       283 
     | 
    
         
            -
                click_link product.name
         
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
                within("div#product-description") do
         
     | 
| 
       286 
     | 
    
         
            -
                  within("h1.product-title") do
         
     | 
| 
       287 
     | 
    
         
            -
                    expect(page).to have_content("Ruby on Rails Baseball Jersey")
         
     | 
| 
       288 
     | 
    
         
            -
                  end
         
     | 
| 
       289 
     | 
    
         
            -
                end
         
     | 
| 
       290 
     | 
    
         
            -
              end
         
     | 
| 
       291 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,54 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            RSpec.feature "Promotion Code Invalidation", js: true do
         
     | 
| 
       6 
     | 
    
         
            -
              given!(:promotion) do
         
     | 
| 
       7 
     | 
    
         
            -
                FactoryBot.create(
         
     | 
| 
       8 
     | 
    
         
            -
                  :promotion_with_item_adjustment,
         
     | 
| 
       9 
     | 
    
         
            -
                  code: "PROMO",
         
     | 
| 
       10 
     | 
    
         
            -
                  per_code_usage_limit: 1,
         
     | 
| 
       11 
     | 
    
         
            -
                  adjustment_rate: 5
         
     | 
| 
       12 
     | 
    
         
            -
                )
         
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              background do
         
     | 
| 
       16 
     | 
    
         
            -
                create(:store)
         
     | 
| 
       17 
     | 
    
         
            -
                FactoryBot.create(:product, name: "DL-44")
         
     | 
| 
       18 
     | 
    
         
            -
                FactoryBot.create(:product, name: "E-11")
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       21 
     | 
    
         
            -
                click_link "DL-44"
         
     | 
| 
       22 
     | 
    
         
            -
                click_button "Add To Cart"
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       25 
     | 
    
         
            -
                click_link "E-11"
         
     | 
| 
       26 
     | 
    
         
            -
                click_button "Add To Cart"
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
              scenario "adding the promotion to a cart with two applicable items" do
         
     | 
| 
       30 
     | 
    
         
            -
                fill_in "Coupon code", with: "PROMO"
         
     | 
| 
       31 
     | 
    
         
            -
                click_button "Apply Code"
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                expect(page).to have_content("The coupon code was successfully applied to your order")
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       36 
     | 
    
         
            -
                  expect(page).to have_content("-$10.00")
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                # Remove an item
         
     | 
| 
       40 
     | 
    
         
            -
                fill_in "order_line_items_attributes_0_quantity", with: 0
         
     | 
| 
       41 
     | 
    
         
            -
                click_button "Update"
         
     | 
| 
       42 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       43 
     | 
    
         
            -
                  expect(page).to have_content("-$5.00")
         
     | 
| 
       44 
     | 
    
         
            -
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                # Add it back
         
     | 
| 
       47 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       48 
     | 
    
         
            -
                click_link "DL-44"
         
     | 
| 
       49 
     | 
    
         
            -
                click_button "Add To Cart"
         
     | 
| 
       50 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       51 
     | 
    
         
            -
                  expect(page).to have_content("-$10.00")
         
     | 
| 
       52 
     | 
    
         
            -
                end
         
     | 
| 
       53 
     | 
    
         
            -
              end
         
     | 
| 
       54 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,130 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            RSpec.feature "Quantity Promotions", js: true do
         
     | 
| 
       6 
     | 
    
         
            -
              given(:action) do
         
     | 
| 
       7 
     | 
    
         
            -
                Spree::Promotion::Actions::CreateQuantityAdjustments.create(
         
     | 
| 
       8 
     | 
    
         
            -
                  calculator: calculator,
         
     | 
| 
       9 
     | 
    
         
            -
                  preferred_group_size: 2
         
     | 
| 
       10 
     | 
    
         
            -
                )
         
     | 
| 
       11 
     | 
    
         
            -
              end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              given(:promotion) { FactoryBot.create(:promotion, code: "PROMO") }
         
     | 
| 
       14 
     | 
    
         
            -
              given(:calculator) { FactoryBot.create(:calculator, preferred_amount: 5) }
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              background do
         
     | 
| 
       17 
     | 
    
         
            -
                create(:store)
         
     | 
| 
       18 
     | 
    
         
            -
                FactoryBot.create(:product, name: "DL-44")
         
     | 
| 
       19 
     | 
    
         
            -
                FactoryBot.create(:product, name: "E-11")
         
     | 
| 
       20 
     | 
    
         
            -
                promotion.actions << action
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       23 
     | 
    
         
            -
                click_link "DL-44"
         
     | 
| 
       24 
     | 
    
         
            -
                click_button "Add To Cart"
         
     | 
| 
       25 
     | 
    
         
            -
              end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              scenario "adding and removing items from the cart" do
         
     | 
| 
       28 
     | 
    
         
            -
                # Attempt to use the code with too few items.
         
     | 
| 
       29 
     | 
    
         
            -
                fill_in "coupon_code", with: "PROMO"
         
     | 
| 
       30 
     | 
    
         
            -
                click_button "Apply Code"
         
     | 
| 
       31 
     | 
    
         
            -
                expect(page).to have_content("This coupon code could not be applied to the cart at this time")
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                # Add another item to our cart.
         
     | 
| 
       34 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       35 
     | 
    
         
            -
                click_link "DL-44"
         
     | 
| 
       36 
     | 
    
         
            -
                click_button "Add To Cart"
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                # Using the code should now succeed.
         
     | 
| 
       39 
     | 
    
         
            -
                fill_in "coupon_code", with: "PROMO"
         
     | 
| 
       40 
     | 
    
         
            -
                click_button "Apply Code"
         
     | 
| 
       41 
     | 
    
         
            -
                expect(page).to have_content("The coupon code was successfully applied to your order")
         
     | 
| 
       42 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       43 
     | 
    
         
            -
                  expect(page).to have_content("-$10.00")
         
     | 
| 
       44 
     | 
    
         
            -
                end
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                # Reduce quantity by 1, making promotion not apply.
         
     | 
| 
       47 
     | 
    
         
            -
                fill_in "order_line_items_attributes_0_quantity", with: 1
         
     | 
| 
       48 
     | 
    
         
            -
                click_button "Update"
         
     | 
| 
       49 
     | 
    
         
            -
                expect(page).to_not have_content("#cart_adjustments")
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                # Bump quantity to 3, making promotion apply "once."
         
     | 
| 
       52 
     | 
    
         
            -
                fill_in "order_line_items_attributes_0_quantity", with: 3
         
     | 
| 
       53 
     | 
    
         
            -
                click_button "Update"
         
     | 
| 
       54 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       55 
     | 
    
         
            -
                  expect(page).to have_content("-$10.00")
         
     | 
| 
       56 
     | 
    
         
            -
                end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                # Bump quantity to 4, making promotion apply "twice."
         
     | 
| 
       59 
     | 
    
         
            -
                fill_in "order_line_items_attributes_0_quantity", with: 4
         
     | 
| 
       60 
     | 
    
         
            -
                click_button "Update"
         
     | 
| 
       61 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       62 
     | 
    
         
            -
                  expect(page).to have_content("-$20.00")
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
              end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
              # Catches an earlier issue with quantity calculation.
         
     | 
| 
       67 
     | 
    
         
            -
              scenario "adding odd numbers of items to the cart" do
         
     | 
| 
       68 
     | 
    
         
            -
                # Bump quantity to 3
         
     | 
| 
       69 
     | 
    
         
            -
                fill_in "order_line_items_attributes_0_quantity", with: 3
         
     | 
| 
       70 
     | 
    
         
            -
                click_button "Update"
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                # Apply the promo code and see a $10 discount (for 2 of the 3 items)
         
     | 
| 
       73 
     | 
    
         
            -
                fill_in "coupon_code", with: "PROMO"
         
     | 
| 
       74 
     | 
    
         
            -
                click_button "Apply Code"
         
     | 
| 
       75 
     | 
    
         
            -
                expect(page).to have_content("The coupon code was successfully applied to your order")
         
     | 
| 
       76 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       77 
     | 
    
         
            -
                  expect(page).to have_content("-$10.00")
         
     | 
| 
       78 
     | 
    
         
            -
                end
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                # Add a different product to our cart with quantity of 2.
         
     | 
| 
       81 
     | 
    
         
            -
                visit spree.root_path
         
     | 
| 
       82 
     | 
    
         
            -
                click_link "E-11"
         
     | 
| 
       83 
     | 
    
         
            -
                fill_in "quantity", with: "2"
         
     | 
| 
       84 
     | 
    
         
            -
                click_button "Add To Cart"
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                # We now have 5 items total, so discount should increase.
         
     | 
| 
       87 
     | 
    
         
            -
                within("#cart_adjustments") do
         
     | 
| 
       88 
     | 
    
         
            -
                  expect(page).to have_content("-$20.00")
         
     | 
| 
       89 
     | 
    
         
            -
                end
         
     | 
| 
       90 
     | 
    
         
            -
              end
         
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
              context "with a group size of 3" do
         
     | 
| 
       93 
     | 
    
         
            -
                given(:action) do
         
     | 
| 
       94 
     | 
    
         
            -
                  Spree::Promotion::Actions::CreateQuantityAdjustments.create(
         
     | 
| 
       95 
     | 
    
         
            -
                    calculator: calculator,
         
     | 
| 
       96 
     | 
    
         
            -
                    preferred_group_size: 3
         
     | 
| 
       97 
     | 
    
         
            -
                  )
         
     | 
| 
       98 
     | 
    
         
            -
                end
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                background { FactoryBot.create(:product, name: "DC-15A") }
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                scenario "odd number of changes to quantities" do
         
     | 
| 
       103 
     | 
    
         
            -
                  fill_in "order_line_items_attributes_0_quantity", with: 3
         
     | 
| 
       104 
     | 
    
         
            -
                  click_button "Update"
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
                  # Apply the promo code and see a $15 discount
         
     | 
| 
       107 
     | 
    
         
            -
                  fill_in "coupon_code", with: "PROMO"
         
     | 
| 
       108 
     | 
    
         
            -
                  click_button "Apply Code"
         
     | 
| 
       109 
     | 
    
         
            -
                  expect(page).to have_content("The coupon code was successfully applied to your order")
         
     | 
| 
       110 
     | 
    
         
            -
                  within("#cart_adjustments") do
         
     | 
| 
       111 
     | 
    
         
            -
                    expect(page).to have_content("-$15.00")
         
     | 
| 
       112 
     | 
    
         
            -
                  end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                  # Add two different products to our cart
         
     | 
| 
       115 
     | 
    
         
            -
                  visit spree.root_path
         
     | 
| 
       116 
     | 
    
         
            -
                  click_link "E-11"
         
     | 
| 
       117 
     | 
    
         
            -
                  click_button "Add To Cart"
         
     | 
| 
       118 
     | 
    
         
            -
                  within("#cart_adjustments") do
         
     | 
| 
       119 
     | 
    
         
            -
                    expect(page).to have_content("-$15.00")
         
     | 
| 
       120 
     | 
    
         
            -
                  end
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                  # Reduce quantity of first item to 2
         
     | 
| 
       123 
     | 
    
         
            -
                  fill_in "order_line_items_attributes_0_quantity", with: 2
         
     | 
| 
       124 
     | 
    
         
            -
                  click_button "Update"
         
     | 
| 
       125 
     | 
    
         
            -
                  within("#cart_adjustments") do
         
     | 
| 
       126 
     | 
    
         
            -
                    expect(page).to have_content("-$15.00")
         
     | 
| 
       127 
     | 
    
         
            -
                  end
         
     | 
| 
       128 
     | 
    
         
            -
                end
         
     | 
| 
       129 
     | 
    
         
            -
              end
         
     | 
| 
       130 
     | 
    
         
            -
            end
         
     |