Sha256: ba755cb608062df995f50fdb1beccbc65a733f9703b4387ea345c1a45df53505

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

Given /^that the credit card "([^"]*)" is invalid$/ do |number|
  FakeBraintree.registry.failures[number] = { "message" => "Credit card number is invalid.", "errors" => { "customer" => { "errors" => [], "credit-card" => { "errors" => [{ "message" => "Credit card number is invalid.", "code" => 81715, "attribute" => :number }] }}}}
end

Given /^that the credit card "([^"]*)" should not be honored$/ do |number|
  FakeBraintree.registry.failures[number] = { "message" => "Do Not Honor", "code" => "2000", "status" => "processor_declined" }
end

Given /^the "([^"]*)" account is past due$/ do |account_name|
  account = Account.find_by_name!(account_name)
  account.update_attribute(:subscription_status, Braintree::Subscription::Status::PastDue)
end

Given /^the following transactions? exists? for the "([^"]*)" account:$/ do |account_name, table|
  account = Account.find_by_name!(account_name)
  subscription = FakeBraintree.registry.subscriptions[account.subscription_token]
  subscription["transactions"] = []
  table.hashes.each do |transaction|
    subscription["transactions"] << FakeBraintree.generate_transaction({ :status => transaction["status"],
                                                                         :amount => transaction["amount"],
                                                                         :created_at => DateTime.parse(transaction["created_at"]),
                                                                         :subscription_id => account.subscription_token })
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saucy-0.16.1 features/step_definitions/engine/braintree_steps.rb
saucy-0.16.0 features/step_definitions/engine/braintree_steps.rb