Skip to content

Instantly share code, notes, and snippets.

@coop
Created April 30, 2012 10:17
Show Gist options
  • Save coop/2557027 to your computer and use it in GitHub Desktop.
Save coop/2557027 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
@tatey
Copy link

tatey commented Apr 30, 2012

Looks good, bro.

@davekiss
Copy link

Not sure how I came across this, but dig the badge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment