diff --git a/test/app_test.rb b/test/app_test.rb index 8b614b14..d3a03e43 100644 --- a/test/app_test.rb +++ b/test/app_test.rb @@ -57,6 +57,19 @@ class AppTest < MiniTest::Spec assert_includes last_response.body, '/css/index.json' assert_includes last_response.body, '/html/index.json' end + + it "includes has the word 'light' by default" do + get '/manifest.appcache' + assert_includes last_response.body, '# light' + refute_includes last_response.body, '# dark' + end + + it "includes has the word 'dark' when the cookie is set" do + set_cookie('dark=1') + get '/manifest.appcache' + assert_includes last_response.body, '# dark' + refute_includes last_response.body, '# light' + end end describe "/[doc]" do diff --git a/views/manifest.erb b/views/manifest.erb index b107bcb9..112df10a 100644 --- a/views/manifest.erb +++ b/views/manifest.erb @@ -1,4 +1,5 @@ CACHE MANIFEST +# <%= cookies[:dark].nil? ? 'light' : 'dark' %> CACHE: /