Merge pull request #38216 from kamipo/fix_failure_for_rack-2.1.0

rack 2.1.0 changed expires date format from rfc2822 to httpdate
This commit is contained in:
Ryuta Kamizono 2020-01-12 06:01:39 +09:00 committed by GitHub
commit cba70a86da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 16 deletions

View File

@ -12,6 +12,9 @@ gem "rake", ">= 11.1"
gem "capybara", ">= 3.26"
gem "selenium-webdriver", ">= 3.141.592"
# TODO: Remove the line once next version has released.
gem "rack", github: "rack/rack", ref: "1b82d84"
gem "rack-cache", "~> 1.2"
gem "sass-rails"
gem "turbolinks", "~> 5"

View File

@ -14,6 +14,13 @@ GIT
event_emitter
websocket
GIT
remote: https://github.com/rack/rack.git
revision: 1b82d84d80c7d02a04122517da4a3874e5b78ba7
ref: 1b82d84
specs:
rack (2.2.0)
PATH
remote: .
specs:
@ -367,7 +374,6 @@ GEM
thor
raabro (1.1.6)
racc (1.4.16)
rack (2.0.8)
rack-cache (1.10.0)
rack (>= 0.4)
rack-protection (2.0.7)
@ -575,6 +581,7 @@ DEPENDENCIES
queue_classic!
qunit-selenium
racc (>= 1.4.6)
rack!
rack-cache (~> 1.2)
rails!
rake (>= 11.1)

View File

@ -413,13 +413,13 @@ class CookiesTest < ActionController::TestCase
def test_setting_cookie_for_fourteen_days
get :authenticate_for_fourteen_days
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT; SameSite=Lax"
assert_equal({ "user_name" => "david" }, @response.cookies)
end
def test_setting_cookie_for_fourteen_days_with_symbols
get :authenticate_for_fourteen_days_with_symbols
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT; SameSite=Lax"
assert_equal({ "user_name" => "david" }, @response.cookies)
end
@ -454,7 +454,7 @@ class CookiesTest < ActionController::TestCase
def test_multiple_cookies
get :set_multiple_cookies
assert_equal 2, @response.cookies.size
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000; SameSite=Lax\nlogin=XJ-122; path=/; SameSite=Lax"
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT; SameSite=Lax\nlogin=XJ-122; path=/; SameSite=Lax"
assert_equal({ "login" => "XJ-122", "user_name" => "david" }, @response.cookies)
end
@ -465,14 +465,14 @@ class CookiesTest < ActionController::TestCase
def test_expiring_cookie
request.cookies[:user_name] = "Joe"
get :logout
assert_cookie_header "user_name=; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax"
assert_equal({ "user_name" => nil }, @response.cookies)
end
def test_delete_cookie_with_path
request.cookies[:user_name] = "Joe"
get :delete_cookie_with_path
assert_cookie_header "user_name=; path=/beaten; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=; path=/beaten; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax"
end
def test_delete_unexisting_cookie
@ -749,7 +749,7 @@ class CookiesTest < ActionController::TestCase
def test_delete_and_set_cookie
request.cookies[:user_name] = "Joe"
get :delete_and_set_cookie
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=david; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT; SameSite=Lax"
assert_equal({ "user_name" => "david" }, @response.cookies)
end
@ -991,7 +991,7 @@ class CookiesTest < ActionController::TestCase
request.cookies[:user_name] = "Joe"
get :delete_cookie_with_domain
assert_response :success
assert_cookie_header "user_name=; domain=.nextangle.com; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=; domain=.nextangle.com; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax"
end
def test_cookie_with_all_domain_option_and_tld_length
@ -1025,7 +1025,7 @@ class CookiesTest < ActionController::TestCase
request.cookies[:user_name] = "Joe"
get :delete_cookie_with_domain_and_tld
assert_response :success
assert_cookie_header "user_name=; domain=.nextangle.com; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=; domain=.nextangle.com; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax"
end
def test_cookie_with_several_preset_domains_using_one_of_these_domains
@ -1054,7 +1054,7 @@ class CookiesTest < ActionController::TestCase
request.cookies[:user_name] = "Joe"
get :delete_cookie_with_domains
assert_response :success
assert_cookie_header "user_name=; domain=example2.com; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=; domain=example2.com; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax"
end
def test_deletings_cookie_with_several_preset_domains_using_other_domain
@ -1062,7 +1062,7 @@ class CookiesTest < ActionController::TestCase
request.cookies[:user_name] = "Joe"
get :delete_cookie_with_domains
assert_response :success
assert_cookie_header "user_name=; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax"
end
def test_cookies_hash_is_indifferent_access
@ -1207,7 +1207,7 @@ class CookiesTest < ActionController::TestCase
def test_vanilla_cookie_with_expires_set_relatively
travel_to Time.utc(2017, 8, 15) do
get :cookie_expires_in_two_hours
assert_cookie_header "user_name=assain; path=/; expires=Tue, 15 Aug 2017 02:00:00 -0000; SameSite=Lax"
assert_cookie_header "user_name=assain; path=/; expires=Tue, 15 Aug 2017 02:00:00 GMT; SameSite=Lax"
end
end

View File

@ -238,7 +238,7 @@ class ResponseTest < ActiveSupport::TestCase
@response.set_cookie("user_name", value: "david", path: "/")
@response.set_cookie("login", value: "foo&bar", path: "/", expires: Time.utc(2005, 10, 10, 5))
_status, headers, _body = @response.to_a
assert_equal "user_name=david; path=/\nlogin=foo%26bar; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000", headers["Set-Cookie"]
assert_equal "user_name=david; path=/\nlogin=foo%26bar; path=/; expires=Mon, 10 Oct 2005 05:00:00 GMT", headers["Set-Cookie"]
assert_equal({ "login" => "foo&bar", "user_name" => "david" }, @response.cookies)
end

View File

@ -300,7 +300,7 @@ class CookieStoreTest < ActionDispatch::IntegrationTest
time = Time.local(2008, 4, 24)
Time.stub :now, time do
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S -0000")
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
get "/set_session_value"
@ -311,7 +311,7 @@ class CookieStoreTest < ActionDispatch::IntegrationTest
# Second request does not access the session
time = time + 3.hours
Time.stub :now, time do
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S -0000")
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
get "/no_session_access"
@ -327,7 +327,7 @@ class CookieStoreTest < ActionDispatch::IntegrationTest
time = Time.local(2017, 11, 12)
Time.stub :now, time do
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S -0000")
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
get "/set_session_value"
get "/get_session_value"