I think our checkout specs are tangled because they try to encapsulate a lot of actions within each test (i.e. a specify
or it
block). I think we should instead break each direction a user could go into an RSpec shared example and write one test per checkout state (i.e. address, shipping, payment, confirmation).
Last active
August 29, 2015 14:01
-
-
Save shicholas/810d8debe5579b5058fb to your computer and use it in GitHub Desktop.
Checkout Specs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'features_spec_helper' | |
feature 'Checkout#Payment' do | |
before do | |
include_context 'checkout up to payment' | |
end | |
describe 'failing conditions that do not take user to #confirm' do | |
user_can 'not advance without payment info' | |
user_can 'not advance with failed Braintree payment' | |
end | |
describe 'succeeding conditions that take user to #confirm' do | |
user_can 'advance with successful VISA' | |
user_can 'advance with successful Mastercard' | |
user_can 'advance with successful Paypal' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |c| | |
c.alias_it_should_behave_like_to :user_can, 'user can:' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment