Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Automatically calculate a future date for credit cards.
Let's not have this test fail in a few years.
- Loading branch information
Showing
2 changed files
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -18,11 +18,13 @@ | ||
| end | ||
|
|
||
| When(/^I try to tokenize the card "(.*?)" with the CVV "(.*?)"$/) do |number, cvv| | ||
| require 'date' | ||
|
|
||
| @client.post('/cards', | ||
| { | ||
| number: number, | ||
| expiration_month: 12, | ||
| expiration_year: 2016, | ||
| expiration_month: (Date.today.month + 1) % 12, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
steveklabnik
Author
Contributor
|
||
| expiration_year: Date.today.year + 1, | ||
| cvv: cvv, | ||
| address: { | ||
| line1: "965 Mission St", | ||
This file contains 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
In November wouldn't this make the month 0?
(11 + 1) % 12 == 0I think you actually want either
(Date.today.month % 12) + 1or to just leave it static since you're already pushing the year into the future.