Skip to content

Instantly share code, notes, and snippets.

@laserlemon
Created November 23, 2013 14:45
Show Gist options
  • Save laserlemon/7615336 to your computer and use it in GitHub Desktop.
Save laserlemon/7615336 to your computer and use it in GitHub Desktop.
How to create Balanced errors with Factory Girl
FactoryGirl.define do
trait :balanced_error do
skip_create
initialize_with do
new(body: attributes)
end
end
factory :balanced_payment_required, class: Balanced::PaymentRequired do
balanced_error
additional "Account Frozen"
category_code "card-declined"
category_type "banking"
description { "R758: Account Frozen. Your request id is #{request_id}." }
extras({})
request_id { "OMH#{SecureRandom.hex}" }
status "Payment Required"
status_code 402
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment