aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/request
diff options
context:
space:
mode:
authorTrent Ogren <tedwardo2@gmail.com>2013-12-11 15:29:33 -0600
committerTrent Ogren <tedwardo2@gmail.com>2013-12-11 15:29:33 -0600
commitd0fc760d093c377e4bd697121af9bc4b047ae04c (patch)
tree46d74c1db11209116df671e78314fd5a9da6c9e8 /actionpack/test/dispatch/request
parent5853c64a4ba77134b7a4ff942b7ae711cb7bcc46 (diff)
downloadrails-d0fc760d093c377e4bd697121af9bc4b047ae04c.tar.gz
rails-d0fc760d093c377e4bd697121af9bc4b047ae04c.tar.bz2
rails-d0fc760d093c377e4bd697121af9bc4b047ae04c.zip
Make ActionDispatch::Request::Session#fetch behave like Hash#fetch
Session#fetch was mutating the session when given a default argument and/or a block. Since Session duck-types as a Hash, it should behave like one in these cases.
Diffstat (limited to 'actionpack/test/dispatch/request')
-rw-r--r--actionpack/test/dispatch/request/session_test.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/test/dispatch/request/session_test.rb b/actionpack/test/dispatch/request/session_test.rb
index a244d1364c..df55fcc8bc 100644
--- a/actionpack/test/dispatch/request/session_test.rb
+++ b/actionpack/test/dispatch/request/session_test.rb
@@ -68,13 +68,12 @@ module ActionDispatch
assert_equal '1', session.fetch(:one)
assert_equal '2', session.fetch(:two, '2')
- assert_equal '2', session.fetch(:two)
+ assert_nil session.fetch(:two, nil)
assert_equal 'three', session.fetch(:three) {|el| el.to_s }
- assert_equal 'three', session.fetch(:three)
assert_raise KeyError do
- session.fetch(:four)
+ session.fetch(:three)
end
end