diff --git a/lib/rack/rewrite/rule.rb b/lib/rack/rewrite/rule.rb index f992089..ded0c3d 100644 --- a/lib/rack/rewrite/rule.rb +++ b/lib/rack/rewrite/rule.rb @@ -226,7 +226,7 @@ def match(path) def string_matches?(string, matcher) if self.is_a_regexp?(matcher) - string =~ matcher + (string =~ matcher) != nil elsif matcher.is_a?(String) string == matcher elsif matcher.is_a?(Symbol) diff --git a/test/rule_test.rb b/test/rule_test.rb index d950c88..c9caf05 100644 --- a/test/rule_test.rb +++ b/test/rule_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class RuleTest < Test::Unit::TestCase +class RuleTest < ZeroTest TEST_ROOT = File.dirname(__FILE__) diff --git a/test/test_helper.rb b/test/test_helper.rb index a11fd42..8509755 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -15,4 +15,17 @@ def rack_env_for(url, options = {}) def supported_status_codes [:r301, :r302, :r303, :r307] -end \ No newline at end of file +end + +class ZeroTest < Test::Unit::TestCase + def assert(test, msg= nil) + if test.class == Fixnum && test.zero? + super(false) + end + if msg.nil? + super(test) + else + super(test, msg) + end + end +end