Sha256: 151d9dcffba348434cd0e335d9db79fbfcc9daf71e63c56996a0145e9ddd004b

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'rails_helper'

feature 'Mylist', :js do
  background do
    create(:product,          name: 'Awesome product')
    create(:product, :secret, name: 'Secret product')
  end

  scenario 'Add product to mylist' do
    visit mylist_products_path
    expect(page).to have_content('There are not product yet.')

    visit products_path
    expect(page).to have_link('Awesome product')
    expect(page).to have_no_link('Secret product')

    click_on 'Awesome product'
    expect(page).to have_header('Awesome product')

    click_link 'Add this product to mylist'
    expect(page).to have_link('Remove this product from mylist')

    visit mylist_products_path
    expect(page).to have_header('Mylist')
    expect(page).to have_content('Awesome product')
  end

  scenario 'Remove product from mylist' do
    visit products_path

    click_on 'Awesome product'

    click_link 'Add this product to mylist'

    visit mylist_products_path
    expect(page).to have_header('Mylist')
    expect(page).to have_content('Awesome product')

    visit products_path

    click_on 'Awesome product'
    click_link 'Remove this product from mylist'
    expect(page).to have_link('Add this product to mylist')

    visit mylist_products_path
    expect(page).to have_content('There are not product yet.')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
daimon-exhibition-0.1.0 spec/features/mylist_spec.rb