Skip to content

Instantly share code, notes, and snippets.

@tatey
Forked from coop/gist:2557027
Created April 30, 2012 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatey/2557125 to your computer and use it in GitHub Desktop.
Save tatey/2557125 to your computer and use it in GitHub Desktop.
require 'test_helper'
class PayPalExpress::TransactionSearchTest < ActiveSupport::TestCase
test "#search returns a collection of transactions" do
account = MiniTest::Mock.new
period = MiniTest::Mock.new
requester = MiniTest::Mock.new
params = {}
params['ACK'] = 'Success'
params.default = []
requester.expect :perform, params
transaction_search = PayPalExpress::TransactionSearch.new :period => period, :account => account, :requester => requester
transactions = transaction_search.search
assert_empty transactions
requester.verify
end
test "#search sends an email when PayPal returns a failure" do
account = MiniTest::Mock.new
period = MiniTest::Mock.new
requester = MiniTest::Mock.new
notifier = MiniTest::Mock.new
notifier.expect :deliver
params = {}
params['ACK'] = 'Error'
params.default = []
transaction_search = PayPalExpress::TransactionSearch.new :period => period, :account => account, :requester => requester
transactions = transaction_search.search
assert notifier.verify
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment