Skip to content

Commit

Permalink
Add test to check payment step requires the expiration date and cvv f…
Browse files Browse the repository at this point in the history
…ield.
  • Loading branch information
hectoregm committed May 4, 2016
1 parent c5e0667 commit d459739
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions spec/features/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,35 @@
expect(order.payments.count).to be(0)
end

it "expiration and cvv are required" do
using_wait_time(5) do
visit "/products/#{product.slug}"
end
click_on 'Add To Cart'
click_on 'Checkout'

fill_in_address
click_on 'Save and Continue'
click_on 'Save and Continue'

# Payment
expect(page).to have_content(gateway.name)

braintree_fill_in 'Card Number', with: '4111111111111111'
braintree_fill_in 'Expiration', with: ''
braintree_fill_in 'Card Code', with: ''

click_on 'Save and Continue'
expect(page).to have_content('cvv is required')
expect(page).to have_content('expirationDate is required')
expect(page).to_not have_content('Place Order')

# Assert the payment details were not stored
order = Spree::Order.first
expect(order.state).to eq("payment")
expect(order.payments.count).to be(0)
end

def fill_in_address
fill_in "Customer E-Mail", with: "han@example.com"
within("#billing") do
Expand Down

0 comments on commit d459739

Please sign in to comment.