X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/c8f26592a74e776b9827ed68ccc1ee345ff52408..b9b255fa65813af95702b848cb084e2286345de9:/test/test_helper.rb diff --git a/test/test_helper.rb b/test/test_helper.rb index 88cfe4831..3eafdd55c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -77,6 +77,19 @@ module ActiveSupport end end + ## + # work round minitest insanity that causes it to tell you + # to use assert_nil to test for nil, which is fine if you're + # comparing to a nil constant but not if you're comparing + # an expression that might be nil sometimes + def assert_equal_allowing_nil(exp, act, msg = nil) + if exp.nil? + assert_nil act, msg + else + assert_equal exp, act, msg + end + end + ## # for some reason assert_equal a, b fails when the relations are # actually equal, so this method manually checks the fields...