Permalink
Browse files

Add test to go with commit 869d42b

  • Loading branch information...
1 parent e34ed3f commit 5c5310d266dd062e834f4cc90ef7a5002e751bb9 @chrisparrish committed Jun 23, 2011
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/unit/refund_amount_notification_test.rb
@@ -49,6 +49,17 @@ def setup
<latest-fee-refund-amount>5.04</latest-fee-refund-amount>
<timestamp>2006-03-18T20:25:31</timestamp>
</refund-amount-notification>
+}
+
+ @example2_xml = %q{
+<?xml version="1.0" encoding="UTF-8"?>
+<refund-amount-notification xmlns="http://checkout.google.com/schema/2"
+ serial-number="d669f8c7-6d75-4ad6-9278-d2fc997d15f2">
+ <google-order-number>841171949013218</google-order-number>
+ <latest-refund-amount currency="GBP">226.06</latest-refund-amount>
+ <total-refund-amount currency="GBP">226.06</total-refund-amount>
+ <timestamp>2006-03-18T20:25:31</timestamp>
+</refund-amount-notification>
}
end
@@ -64,4 +75,16 @@ def test_create_from_element_works_correctly
assert_equal(Money.new(22606, 'GBP'), notification.latest_refund_amount)
assert_equal(Money.new(504, nil), notification.latest_fee_refund_amount)
end
+
+ def test_create_from_minmal_element_works_correctly
+ root = REXML::Document.new(@example2_xml).root
+
+ notification = RefundAmountNotification.create_from_element(root, @frontend)
+
+ assert_equal 'd669f8c7-6d75-4ad6-9278-d2fc997d15f2', notification.serial_number
+ assert_equal '841171949013218', notification.google_order_number
+ assert_equal Time.parse('2006-03-18T20:25:31'), notification.timestamp
+ assert_equal(Money.new(22606, 'GBP'), notification.total_refund_amount)
+ assert_equal(Money.new(22606, 'GBP'), notification.latest_refund_amount)
+ end
end

0 comments on commit 5c5310d

Please sign in to comment.