Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix custom assertions for Ruby 1.9

  • Loading branch information...
commit 188728eccc8c67fab9e4e508a90c1b25831fdab4 1 parent 0ae2fd6
Cody Fauser authored
Showing with 6 additions and 3 deletions.
  1. +1 −0  CHANGELOG
  2. +5 −3 test/test_helper.rb
1  CHANGELOG
View
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG
+* Fix custom assertions for Ruby 1.9 [cody]
* Deprecate Money objects [cody]
* Update JCB rejex to catch all valid PANs [pjhyett]
* Remove old TransaXGateway constant [cody]
8 test/test_helper.rb
View
@@ -30,6 +30,8 @@ class SubclassGateway < SimpleTestGateway
module ActiveMerchant
module Assertions
+ AssertionClass = RUBY_VERSION > '1.9' ? MiniTest::Assertion : Test::Unit::AssertionFailedError
+
def assert_field(field, value)
clean_backtrace do
assert_equal value, @helper.fields[field]
@@ -92,10 +94,10 @@ def assert_not_valid(validateable)
private
def clean_backtrace(&block)
- yield
- rescue Test::Unit::AssertionFailedError => e
+ yield
+ rescue AssertionClass => e
path = File.expand_path(__FILE__)
- raise Test::Unit::AssertionFailedError, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
+ raise AssertionClass, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.