Sha256: 0d977760b3d2970997c9cfe22583a7c656b7de785387d25658821c4b87464850

Contents?: true

Size: 1.66 KB

Versions: 7

Compression:

Stored size: 1.66 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
    skip %{
      TODO: has been broken for ~2 months as of:
      https://github.com/spree/spree_auth_devise/commit/3157b47b22c559817d34ec34024587d8aa6136dc
      I dont think we can decode these sessions anymore since Rails 4 switched to encrypted cookies I believe devise stores session encrypted.
    }
    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
      add_to_cart 'RoR Mug'

      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
      add_to_cart 'RoR Shirt'

      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

7 entries across 7 versions & 1 rubygems

Version Path
spree_auth_devise-4.0.1 spec/features/order_spec.rb
spree_auth_devise-4.0.0 spec/features/order_spec.rb
spree_auth_devise-4.0.0.rc2 spec/features/order_spec.rb
spree_auth_devise-4.0.0.rc1 spec/features/order_spec.rb
spree_auth_devise-3.5.2 spec/features/order_spec.rb
spree_auth_devise-3.5.1 spec/features/order_spec.rb
spree_auth_devise-3.5.0 spec/features/order_spec.rb