| @@ -80,11 +80,11 @@ class AppTest < MiniTest::Spec · 79 unmodified lines |
| 80 | end | 80 | end |
| 81 | | 81 | |
| 82 | it "works with cookie" do | 82 | it "works with cookie" do |
| 83 | set_cookie('docs=css/html~v5') | 83 | set_cookie('docs=css/html~5') |
| 84 | get '/manifest.appcache' | 84 | get '/manifest.appcache' |
| 85 | assert last_response.ok? | 85 | assert last_response.ok? |
| 86 | assert_includes last_response.body, '/css/index.json?1420139788' | 86 | assert_includes last_response.body, '/css/index.json?1420139788' |
| 87 | assert_includes last_response.body, '/html~v5/index.json?1420139791' | 87 | assert_includes last_response.body, '/html~5/index.json?1420139791' |
| 88 | end | 88 | end |
| 89 | | 89 | |
| 90 | it "ignores invalid docs in the cookie" do | 90 | it "ignores invalid docs in the cookie" do |
| @@ -127,17 +127,17 @@ class AppTest < MiniTest::Spec · 36 unmodified lines |
| 127 | | 127 | |
| 128 | describe "/[doc]" do | 128 | describe "/[doc]" do |
| 129 | it "renders when the doc exists and isn't enabled" do | 129 | it "renders when the doc exists and isn't enabled" do |
| 130 | set_cookie('docs=html~v5') | 130 | set_cookie('docs=html~5') |
| 131 | get '/html~v4/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 131 | get '/html~4/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 132 | assert last_response.ok? | 132 | assert last_response.ok? |
| 133 | end | 133 | end |
| 134 | | 134 | |
| 135 | it "redirects via JS cookie when the doc exists and is enabled" do | 135 | it "redirects via JS cookie when the doc exists and is enabled" do |
| 136 | set_cookie('docs=html~v5') | 136 | set_cookie('docs=html~5') |
| 137 | get '/html~v5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 137 | get '/html~5/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 138 | assert last_response.redirect? | 138 | assert last_response.redirect? |
| 139 | assert_equal 'http://example.org/', last_response['Location'] | 139 | assert_equal 'http://example.org/', last_response['Location'] |
| 140 | assert last_response['Set-Cookie'].start_with?("initial_path=%2Fhtml%7Ev5%2F; path=/; expires=") | 140 | assert last_response['Set-Cookie'].start_with?("initial_path=%2Fhtml%7E5%2F; path=/; expires=") |
| 141 | end | 141 | end |
| 142 | | 142 | |
| 143 | it "renders when the doc exists, has no version in the path, and isn't enabled" do | 143 | it "renders when the doc exists, has no version in the path, and isn't enabled" do |
| @@ -146,7 +146,7 @@ class AppTest < MiniTest::Spec · 2 unmodified lines |
| 146 | end | 146 | end |
| 147 | | 147 | |
| 148 | it "redirects via JS cookie when the doc exists, has no version in the path, and a version is enabled" do | 148 | it "redirects via JS cookie when the doc exists, has no version in the path, and a version is enabled" do |
| 149 | set_cookie('docs=html~v5') | 149 | set_cookie('docs=html~5') |
| 150 | get '/html/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER | 150 | get '/html/', {}, 'HTTP_USER_AGENT' => MODERN_BROWSER |
| 151 | assert last_response.redirect? | 151 | assert last_response.redirect? |
| 152 | assert_equal 'http://example.org/', last_response['Location'] | 152 | assert_equal 'http://example.org/', last_response['Location'] |
| @@ -160,7 +160,7 @@ class AppTest < MiniTest::Spec · 7 unmodified lines |
| 160 | end | 160 | end |
| 161 | | 161 | |
| 162 | it "returns 404 when the doc doesn't exist" do | 162 | it "returns 404 when the doc doesn't exist" do |
| 163 | get '/html~v6/' | 163 | get '/html~6/' |
| 164 | assert last_response.not_found? | 164 | assert last_response.not_found? |
| 165 | end | 165 | end |
| 166 | | 166 | |
| @@ -177,15 +177,15 @@ class AppTest < MiniTest::Spec · 10 unmodified lines |
| 177 | | 177 | |
| 178 | describe "/[doc]-[type]" do | 178 | describe "/[doc]-[type]" do |
| 179 | it "works when the doc exists" do | 179 | it "works when the doc exists" do |
| 180 | get '/html~v4-foo-bar_42/' | 180 | get '/html~4-foo-bar_42/' |
| 181 | assert last_response.ok? | 181 | assert last_response.ok? |
| 182 | assert_includes last_response.body, 'app.DOC = {"name":"HTML","slug":"html~v4"' | 182 | assert_includes last_response.body, 'app.DOC = {"name":"HTML","slug":"html~4"' |
| 183 | end | 183 | end |
| 184 | | 184 | |
| 185 | it "works when the doc has no version in the path and a version exists" do | 185 | it "works when the doc has no version in the path and a version exists" do |
| 186 | get '/html-foo-bar_42/' | 186 | get '/html-foo-bar_42/' |
| 187 | assert last_response.ok? | 187 | assert last_response.ok? |
| 188 | assert_includes last_response.body, 'app.DOC = {"name":"HTML","slug":"html~v5"' | 188 | assert_includes last_response.body, 'app.DOC = {"name":"HTML","slug":"html~5"' |
| 189 | end | 189 | end |
| 190 | | 190 | |
| 191 | it "returns 404 when the type is blank" do | 191 | it "returns 404 when the type is blank" do |
| @@ -199,7 +199,7 @@ class AppTest < MiniTest::Spec · 7 unmodified lines |
| 199 | end | 199 | end |
| 200 | | 200 | |
| 201 | it "returns 404 when the doc doesn't exist" do | 201 | it "returns 404 when the doc doesn't exist" do |
| 202 | get '/html~v6-bar/' | 202 | get '/html~6-bar/' |
| 203 | assert last_response.not_found? | 203 | assert last_response.not_found? |
| 204 | end | 204 | end |
| 205 | | 205 | |