Created
April 30, 2012 10:17
-
-
Save coop/2557027 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Not sure how I came across this, but dig the badge.