summary refs log tree commit
path: root/test/spec_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/spec_handler.rb')
-rw-r--r--test/spec_handler.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/spec_handler.rb b/test/spec_handler.rb
index c252c176..838416d1 100644
--- a/test/spec_handler.rb
+++ b/test/spec_handler.rb
@@ -23,10 +23,19 @@ describe Rack::Handler do
     lambda {
       Rack::Handler.get('boom')
     }.should.raise(LoadError)
+  end
 
-    lambda {
-      Rack::Handler.get('Object')
-    }.should.raise(LoadError)
+  should "raise LoadError if handler isn't nested under Rack::Handler" do
+    # Feature-detect whether Ruby can do non-inherited const lookups.
+    # If it can't, then Rack::Handler may lookup non-handler toplevel
+    # constants, so the best we can do is no-op here and not test it.
+    begin
+      Rack::Handler._const_get('Object', false)
+    rescue NameError
+      lambda {
+        Rack::Handler.get('Object')
+      }.should.raise(LoadError)
+    end
   end
 
   should "get unregistered, but already required, handler by name" do