Sha256: 36e9619e905586cfe4a0e6e3afb6a9f0ec56244c33f1e9510fb9568b96b40cdf
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require File.dirname(__FILE__) + '/../../../test_helper' class NochexNotificationTest < Test::Unit::TestCase include MerbMerchant::Billing::Integrations def setup @nochex = Nochex::Notification.new(http_raw_data) end def test_accessors assert @nochex.complete? assert_equal "Completed", @nochex.status assert_equal "91191", @nochex.transaction_id assert_equal "11", @nochex.item_id assert_equal "31.66", @nochex.gross assert_equal "GBP", @nochex.currency assert_equal Time.utc(2006, 9, 27, 22, 30, 53), @nochex.received_at assert @nochex.test? end def test_compositions assert_equal Money.new(3166, 'GBP'), @nochex.amount end def test_successful_acknowledgement Nochex::Notification.any_instance.expects(:ssl_post).returns('AUTHORISED') assert @nochex.acknowledge end def test_failed_acknowledgement Nochex::Notification.any_instance.expects(:ssl_post).returns('DECLINED') assert !@nochex.acknowledge end def test_respond_to_acknowledge assert @nochex.respond_to?(:acknowledge) end def test_nil_notification Nochex::Notification.any_instance.expects(:ssl_post).returns('DECLINED') notification = Nochex::Notification.new(nil) assert !notification.acknowledge end private def http_raw_data "transaction_date=27/09/2006 22:30:53&transaction_id=91191&order_id=11&from_email=test2@nochex.com&to_email=test1@nochex.com&amount=31.66&security_key=L254524366479818252491366&status=test&custom=" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
merb_merchant-1.4.1 | test/unit/integrations/notifications/nochex_notification_test.rb |