Browse Source

Fix default docs behavior when all docs are disabled

Fixes #424.
Thibaut Courouble 9 years ago
parent
commit
13bd8a07b0
2 changed files with 7 additions and 1 deletions
  1. 1 1
      lib/app.rb
  2. 6 0
      test/app_test.rb

+ 1 - 1
lib/app.rb

@@ -119,7 +119,7 @@ class App < Sinatra::Application
       @docs ||= begin
         cookie = cookies[:docs]
 
-        if cookie.nil? || cookie.empty?
+        if cookie.nil?
           settings.default_docs
         else
           cookie.split('/')

+ 6 - 0
test/app_test.rb

@@ -132,6 +132,12 @@ class AppTest < MiniTest::Spec
       assert last_response.ok?
     end
 
+    it "renders when the doc exists, is a default doc, and all docs are enabled" do
+      set_cookie('docs=')
+      get '/css/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER
+      assert last_response.ok?
+    end
+
     it "redirects via JS cookie when the doc exists and is enabled" do
       set_cookie('docs=html~5')
       get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER