Sha256: d847a559c87d31d18b3e5f039eab184db319880f98b4351db99a64be07f5aad9

Contents?: true

Size: 1.96 KB

Versions: 10

Compression:

Stored size: 1.96 KB

Contents

require 'test_helper'

module Workarea
  decorate Storefront::Accounts::CreditCardsSystemTest, with: :murals_your_way do
    def test_managing_credit_cards
      visit storefront.accounts_path

      click_link t('workarea.storefront.users.add_credit_card')

      within '#credit_card_form' do
        fill_in 'credit_card[number]', with: '4111111111111111'
        fill_in 'credit_card[first_name]', with: 'Ben'
        fill_in 'credit_card[last_name]', with: 'Crouse'
        select '1', from: 'credit_card[month]'
        select @year, from: 'credit_card[year]'
        fill_in 'credit_card[cvv]', with: '999'
        click_button t('workarea.storefront.forms.save')
      end

      assert(page.has_content?('Success'))
      assert(page.has_content?('ending in 1111'))
      assert(page.has_content?('1'))
      assert(page.has_content?(@year))

      click_link t('workarea.storefront.forms.edit')

      within '#credit_card_form' do
        select '2', from: 'credit_card[month]'
        fill_in 'credit_card[cvv]', with: '999'
        click_button t('workarea.storefront.forms.save')
      end

      assert(page.has_content?('Success'))
      assert(page.has_content?('ending in 1111'))
      assert(page.has_content?('2'))
      assert(page.has_content?(@year))

      click_button t('workarea.storefront.forms.delete')

      assert(page.has_no_content?('ending in 1111'))

      visit storefront.new_users_credit_card_path

      within '#credit_card_form' do
        fill_in 'credit_card[number]', with: '401200003333042211'
        fill_in 'credit_card[first_name]', with: 'Ben'
        fill_in 'credit_card[last_name]', with: 'Crouse'
        select '1', from: 'credit_card[month]'
        select @year, from: 'credit_card[year]'
        fill_in 'credit_card[cvv]', with: '999'
        click_button t('workarea.storefront.forms.save')
      end

      refute(page.has_content?('Success'))
      assert(page.has_content?(I18n.t('workarea.payment.store_credit_card_failure')))
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
workarea-usaepay-1.0.43 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.42 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.41 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.40 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.30 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.3 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.26 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.24 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.23 test/system/workarea/storefront/accounts/credit_cards_system_test.decorator
workarea-usaepay-1.0.22 test/system/workarea/storefront/account/credit_cards_system_test.decorator