-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3428 from alphagov/remove-apple-touch-icon-redirects
Remove custom apple touch icons and redirects in static
- Loading branch information
Showing
8 changed files
with
19 additions
and
161 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,23 @@ | ||
require_relative "../integration_test_helper" | ||
|
||
class IconRedirectsTest < ActionDispatch::IntegrationTest | ||
[ | ||
"favicon.ico", | ||
"apple-touch-icon.png", | ||
"apple-touch-icon-180x180.png", | ||
"apple-touch-icon-167x167.png", | ||
"apple-touch-icon-152x152.png", | ||
].each do |file| | ||
should "redirect #{file} to the asset path" do | ||
get "/#{file}" | ||
assert_equal 301, last_response.status | ||
assert_equal last_response.headers["Cache-Control"], "max-age=86400, public" | ||
# In development and test mode the asset pipeline doesn't add the hashes to the URLs | ||
assert_equal "http://example.org/assets/static/#{file}", last_response.location | ||
end | ||
|
||
# TODO: check if this test is required and raise an issue for it | ||
# should "redirect #{file} to a location that exists" do | ||
# get "/assets/static/#{file}" | ||
# assert_equal 200, last_response.status | ||
# assert last_response.body.size > 100 | ||
# end | ||
should "redirect `favicon.ico` to the asset path" do | ||
get "/favicon.ico" | ||
assert_equal 301, last_response.status | ||
assert_equal last_response.headers["Cache-Control"], "max-age=86400, public" | ||
# In development and test mode the asset pipeline doesn't add the hashes to the URLs | ||
assert_equal "http://example.org/assets/static/favicon.ico", last_response.location | ||
end | ||
|
||
should "ignore query string when redirecting #{file}" do | ||
get "/#{file}?foo=bar" | ||
assert_equal 301, last_response.status | ||
assert_equal "http://example.org/assets/static/#{file}", last_response.location | ||
end | ||
should "redirect `favicon.ico` to a location that exists" do | ||
get "/assets/static/favicon.ico" | ||
assert_equal 200, last_response.status | ||
assert last_response.body.size > 100 | ||
end | ||
|
||
[ | ||
"apple-touch-icon-120x120.png", | ||
"apple-touch-icon-76x76.png", | ||
"apple-touch-icon-60x60.png", | ||
"apple-touch-icon-precomposed.png", | ||
].each do |file| | ||
should "redirect old icon size #{file} to the default apple-touch-icon.png icon" do | ||
get "/#{file}" | ||
assert_equal 301, last_response.status | ||
assert_equal last_response.headers["Cache-Control"], "max-age=86400, public" | ||
# In development and test mode the asset pipeline doesn't add the hashes to the URLs | ||
assert_equal "http://example.org/assets/static/apple-touch-icon.png", last_response.location | ||
end | ||
should "ignore query string when redirecting `favicon.ico`" do | ||
get "/favicon.ico?foo=bar" | ||
assert_equal 301, last_response.status | ||
assert_equal "http://example.org/assets/static/favicon.ico", last_response.location | ||
end | ||
end |