Skip to content

Instantly share code, notes, and snippets.

@supriya
Created July 29, 2009 19:56
Show Gist options
  • Save supriya/158361 to your computer and use it in GitHub Desktop.
Save supriya/158361 to your computer and use it in GitHub Desktop.
return result.fail_with("The card doesn't have any available credit.") unless @card.credit_account && @card.credit_account.has_credit?
return result.fail_with('Credit Account is frozen.') if @card.credit_account.frozen_credit?
tests
context "with frozen credit" do
setup do
@card.credit_account.freeze_credit!
@result = CallHandler.top_up_card(:version => :v1, :account_number => @card_with_topup.pan, :transaction_amount => @transaction_amount, :available_balance => 488.00, :ip_address => "127.0.0.01")
end
#
should "fail" do
assert_equal false, @result.success?
end
#
should_change "CallHandlerLogEntry.unsuccessful.for_method('top_up_card').count", :by =>1
should_not_change "CardTopUpTransaction.count"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment