Fix default docs behavior when all docs are disabled

Fixes #424.
pull/427/head
Thibaut Courouble 9 years ago
parent 66f170c01d
commit 13bd8a07b0

@ -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('/')

@ -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

Loading…
Cancel
Save