History

Fix default docs behavior when all docs are disabled

Fixes #424.

Thibaut Courouble committed 10 years ago

Commit 13bd8a01 parent 66f170c2 files · +7 −1Browse files

Unified · Split

2 files
  1. lib/app.rb +1 −1
  2. test/app_test.rb +6 −0
lib/app.rb+1−1
@@ -119,7 +119,7 @@ class App < Sinatra::Application · 118 unmodified lines
119119 @docs ||= begin
120120 cookie = cookies[:docs]
121121
122− if cookie.nil? || cookie.empty?
122+ if cookie.nil?
123123 settings.default_docs
124124 else
125125 cookie.split('/')
test/app_test.rb+6−0
@@ -132,6 +132,12 @@ class AppTest < MiniTest::Spec · 131 unmodified lines
132132 assert last_response.ok?
133133 end
134134
135+ it "renders when the doc exists, is a default doc, and all docs are enabled" do
136+ set_cookie('docs=')
137+ get '/css/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER
138+ assert last_response.ok?
139+ end
140+
135141 it "redirects via JS cookie when the doc exists and is enabled" do
136142 set_cookie('docs=html~5')
137143 get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER