mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
parent
66f170c01d
commit
13bd8a07b0
2 changed files with 7 additions and 1 deletions
|
@ -119,7 +119,7 @@ class App < Sinatra::Application
|
||||||
@docs ||= begin
|
@docs ||= begin
|
||||||
cookie = cookies[:docs]
|
cookie = cookies[:docs]
|
||||||
|
|
||||||
if cookie.nil? || cookie.empty?
|
if cookie.nil?
|
||||||
settings.default_docs
|
settings.default_docs
|
||||||
else
|
else
|
||||||
cookie.split('/')
|
cookie.split('/')
|
||||||
|
|
|
@ -132,6 +132,12 @@ class AppTest < MiniTest::Spec
|
||||||
assert last_response.ok?
|
assert last_response.ok?
|
||||||
end
|
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
|
it "redirects via JS cookie when the doc exists and is enabled" do
|
||||||
set_cookie('docs=html~5')
|
set_cookie('docs=html~5')
|
||||||
get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER
|
get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER
|
||||||
|
|
Loading…
Reference in a new issue