Skip to content

Commit 13bd8a0

Browse files
committed
Fix default docs behavior when all docs are disabled
Fixes freeCodeCamp#424.
1 parent 66f170c commit 13bd8a0

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def docs
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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ def app
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

0 commit comments

Comments
 (0)