1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix randomly failing cookie store tests

Marshal.dump(Marshal.load(marshaled_hash)) is not guarenteed to be equal to marshaled_hash
because of the lack of ordering of hash
This commit is contained in:
Frederick Cheung 2008-12-25 12:10:28 +00:00
parent e898f82a74
commit d7b6e48c70

View file

@ -25,7 +25,7 @@ class CookieStoreTest < ActionController::IntegrationTest
def set_session_value
session[:foo] = "bar"
render :text => Marshal.dump(session.to_hash)
render :text => Verifier.generate(session.to_hash)
end
def get_session_value
@ -94,8 +94,7 @@ class CookieStoreTest < ActionController::IntegrationTest
with_test_route_set do
get '/set_session_value'
assert_response :success
session_payload = Verifier.generate(Marshal.load(response.body))
assert_equal ["_myapp_session=#{session_payload}; path=/"],
assert_equal ["_myapp_session=#{response.body}; path=/"],
headers['Set-Cookie']
end
end
@ -148,8 +147,8 @@ class CookieStoreTest < ActionController::IntegrationTest
with_test_route_set do
get '/set_session_value'
assert_response :success
session_payload = Verifier.generate(Marshal.load(response.body))
assert_equal ["_myapp_session=#{session_payload}; path=/"],
session_payload = response.body
assert_equal ["_myapp_session=#{response.body}; path=/"],
headers['Set-Cookie']
get '/call_reset_session'