Sha256: d51b3ba9fe97e53eed9d370e1f667d5572c067ce5d2f25b85760b4006693f9d6

Contents?: true

Size: 1.39 KB

Versions: 9

Compression:

Stored size: 1.39 KB

Contents

RSpec.feature 'Orders', :js, type: :feature do
  scenario 'allow a user to view their cart at any time' do
    visit spree.cart_path
    expect(page).to have_text 'Your cart is empty'
  end

  # regression test for spree/spree#1687
  scenario 'merge incomplete orders from different sessions' do
    ror_mug = create(:product, name: 'RoR Mug')
    ror_shirt = create(:product, name: 'RoR Shirt')

    user = create(:user, email: 'email@person.com', password: 'password', password_confirmation: 'password')

    using_session('first') do
      add_to_cart ror_mug

      visit spree.login_path
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Log in'

      visit spree.cart_path
      expect(page).to have_text 'RoR Mug'
    end

    using_session('second') do
      add_to_cart ror_shirt

      visit spree.login_path
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Log in'

      # Order should have been merged with first session
      visit spree.cart_path
      expect(page).to have_text 'RoR Mug'
      expect(page).to have_text 'RoR Shirt'
    end

    using_session('first') do
      visit spree.root_path
      visit spree.cart_path

      # Order should have been merged with second session
      expect(page).to have_text 'RoR Mug'
      expect(page).to have_text 'RoR Shirt'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_auth_devise-4.1.1 spec/features/order_spec.rb
spree_auth_devise-4.2.1 spec/features/order_spec.rb
spree_auth_devise-4.3.3 spec/features/order_spec.rb
spree_auth_devise-4.3.2 spec/features/order_spec.rb
spree_auth_devise-4.3.1 spec/features/order_spec.rb
spree_auth_devise-4.3.0 spec/features/order_spec.rb
spree_auth_devise-4.2.0 spec/features/order_spec.rb
spree_auth_devise-4.1.0 spec/features/order_spec.rb
spree_auth_devise-4.1.0.rc1 spec/features/order_spec.rb