Skip to content

Commit

Permalink
Fix randomly failing cookie store tests
Browse files Browse the repository at this point in the history
Marshal.dump(Marshal.load(marshaled_hash)) is not guarenteed to be equal to marshaled_hash
because of the lack of ordering of hash
  • Loading branch information
fcheung committed Dec 26, 2008
1 parent e898f82 commit d7b6e48
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions actionpack/test/controller/session/cookie_store_test.rb
Expand Up @@ -25,7 +25,7 @@ def persistent_session_id

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
Expand Down Expand Up @@ -94,8 +94,7 @@ def test_setting_session_value
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
Expand Down Expand Up @@ -148,8 +147,8 @@ def test_setting_session_value_after_session_reset
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'
Expand Down

0 comments on commit d7b6e48

Please sign in to comment.