Sha256: aeefd9dfa2b783cd543f06bab0b807820e4b81ec1d35abf2e9acb9a2f43f56d4

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

RSpec.feature 'Sign Out', type: :feature, js: true do
  given!(:user) do
    create(:user,
          email: 'email@person.com',
          password: 'secret',
          password_confirmation: 'secret')
  end

  background do
    log_in(email: user.email, password: user.password)
  end

  scenario 'allow a signed in user to logout' do
    log_out

    visit spree.root_path
    show_user_menu

    expect(page).to have_link 'LOG IN'
    expect(page).not_to have_link 'LOG OUT'
  end

  describe 'before_logout' do
    let!(:mug)        { create(:product_in_stock, name: 'RoR Mug') }
    let!(:shirt)      { create(:product, name: 'RoR Shirt') }
    let!(:other_user) { create(:user) }

    it 'clears token cookies' do
      add_to_cart(mug)

      log_out

      find('#link-to-cart').click
      expect(page).to have_text Spree.t(:your_cart_is_empty)

      log_in(email: other_user.email, password: user.password)
      find('#link-to-cart').click

      expect(page).to have_text Spree.t(:your_cart_is_empty)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_auth_devise-4.2.1 spec/features/sign_out_spec.rb
spree_auth_devise-4.3.3 spec/features/sign_out_spec.rb
spree_auth_devise-4.3.2 spec/features/sign_out_spec.rb
spree_auth_devise-4.3.1 spec/features/sign_out_spec.rb
spree_auth_devise-4.3.0 spec/features/sign_out_spec.rb
spree_auth_devise-4.2.0 spec/features/sign_out_spec.rb