Skip to content

Instantly share code, notes, and snippets.

@amiel
Created April 19, 2010 22:39
Show Gist options
  • Save amiel/371747 to your computer and use it in GitHub Desktop.
Save amiel/371747 to your computer and use it in GitHub Desktop.
Transform /^\$[.\d]+$/ do |dollars|
dollars.to_money
end
Transform /^card "([\d\s]*)"$/ do |cc_number|
ActiveMerchant::Billing::CreditCard.new :number => cc_number.gsub(/\D/, '')
end
Then /^the (card "[\d\s]*") should be charged (\$[.\d]+)$/ do |credit_card, price|
credit_card.class # => ActiveMerchant::Billing::CreditCard
price.class # => Money
end
Scenario: Register
...
Then the card "4111 1111 1111 1111" should be charged $20.00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment