diff options
author | Matthew Gerrior <mgerrior@greanetree.com> | 2014-06-27 17:27:41 -0400 |
---|---|---|
committer | Matthew Gerrior <matthew@challengepost.com> | 2015-08-06 15:29:45 -0400 |
commit | 3004cc817794527fa44c727eea87e20b65c686ce (patch) | |
tree | 1415f6a237f8849edfe44d3d38f2a26eb883469a /actionpack/test/dispatch | |
parent | 3908a6d8675605f570f07d8be2f9224c1c47f0e3 (diff) | |
download | rails-3004cc817794527fa44c727eea87e20b65c686ce.tar.gz rails-3004cc817794527fa44c727eea87e20b65c686ce.tar.bz2 rails-3004cc817794527fa44c727eea87e20b65c686ce.zip |
Adds missing argument handling for ActionController::TestSession to
allow testing controllers that use session#fetch with a default value.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/session/test_session_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/session/test_session_test.rb b/actionpack/test/dispatch/session/test_session_test.rb index d30461a623..59c030176b 100644 --- a/actionpack/test/dispatch/session/test_session_test.rb +++ b/actionpack/test/dispatch/session/test_session_test.rb @@ -40,4 +40,14 @@ class ActionController::TestSessionTest < ActiveSupport::TestCase assert_equal %w(one two), session.keys assert_equal %w(1 2), session.values end + + def test_fetch_returns_default + session = ActionController::TestSession.new(one: '1') + assert_equal('2', session.fetch(:two, '2')) + end + + def test_fetch_returns_block_value + session = ActionController::TestSession.new(one: '1') + assert_equal(2, session.fetch('2') { |key| key.to_i }) + end end |