Sha256: 636faeb4442c5ad022ca1ce98b0bfdffffefc60e6354aff386a867642a201e58

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

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
    create(:store)
    create(:product, name: 'RoR Mug')
    create(:product, name: 'RoR Shirt')

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

    using_session('first') do
      visit spree.root_path

      click_link 'RoR Mug'
      click_button 'Add To Cart'

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

      click_link 'Cart'
      expect(page).to have_text 'RoR Mug'
    end

    using_session('second') do
      visit spree.root_path

      click_link 'RoR Shirt'
      click_button 'Add To Cart'

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

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

    using_session('first') do
      visit spree.root_path

      click_link 'Cart'

      # 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

5 entries across 5 versions & 1 rubygems

Version Path
solidus_auth_devise-2.5.9 spec/features/order_spec.rb
solidus_auth_devise-2.5.8 spec/features/order_spec.rb
solidus_auth_devise-2.5.7 spec/features/order_spec.rb
solidus_auth_devise-2.5.6 spec/features/order_spec.rb
solidus_auth_devise-2.5.5 spec/features/order_spec.rb