Skip to content

Commit

Permalink
Merge pull request #12881 from mkllnk/card-payment-spec
Browse files Browse the repository at this point in the history
Fix date dependent spec
  • Loading branch information
rioug authored Oct 1, 2024
2 parents 1969561 + 17c32ae commit 83b6f58
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions spec/controllers/spree/credit_cards_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,20 @@
{
format: :json,
exp_month: 9,
exp_year: 2024,
exp_year: 1.year.from_now.year,
last4: 4242,
token: token['id'],
cc_type: "visa"
}
end

before do
# there should be no cards stored locally
expect(Spree::CreditCard.count).to eq(0)
end

it "saves the card locally" do
spree_post :new_from_token, params
expect {
spree_post :new_from_token, params
}.to change {
Spree::CreditCard.count
}.from(0).to(1)

# checks whether a card was created
expect(Spree::CreditCard.count).to eq(1)
card = Spree::CreditCard.last

# retrieves the created card from Stripe
Expand Down

0 comments on commit 83b6f58

Please sign in to comment.