about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--test/test_uriclassifier.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_uriclassifier.rb b/test/test_uriclassifier.rb
index f7c2608..526a921 100644
--- a/test/test_uriclassifier.rb
+++ b/test/test_uriclassifier.rb
@@ -167,6 +167,25 @@ class URIClassifierTest < Test::Unit::TestCase
     assert_equal 1,h, "didn't find handler"
   end
 
+  # Verifies that a root mounted ("/") handler
+  # is the default point, doesn't matter the order we use
+  # to resgister the URIs
+  def test_classifier_order
+    tests = ["/before", "/way_past"]
+    root = "/"
+    path = "/path"
+
+    u = URIClassifier.new
+    u.register(path, 1)
+    u.register(root, 2)
+
+    tests.each do |uri|
+        sn, pi, h = u.resolve(uri)
+        assert_equal root, sn, "didn't get right script name"
+        assert_equal uri, pi, "didn't get right path info"
+        assert_equal 2, h, "didn't find handler"
+    end
+  end
 
 end