aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-28 18:33:44 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-28 18:33:44 -0800
commitbdfd11e6dafb1fac175fa0e7283be31e8849ec67 (patch)
tree8badf0bf6b49d01725b876765743d145cc170b02 /actionpack/test/controller
parentdea160266fee0576c2059a0699cbf93b465e95a2 (diff)
downloadrails-bdfd11e6dafb1fac175fa0e7283be31e8849ec67.tar.gz
rails-bdfd11e6dafb1fac175fa0e7283be31e8849ec67.tar.bz2
rails-bdfd11e6dafb1fac175fa0e7283be31e8849ec67.zip
mutations on the underlying hash should also mutate the discard set
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/flash_hash_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/flash_hash_test.rb b/actionpack/test/controller/flash_hash_test.rb
index e7ae7ce5f5..ccca0dac17 100644
--- a/actionpack/test/controller/flash_hash_test.rb
+++ b/actionpack/test/controller/flash_hash_test.rb
@@ -104,6 +104,15 @@ module ActionDispatch
assert_equal({'hello' => 'world', 'hi' => 'mom'}, @hash.to_hash)
end
+ def test_update_delete_sweep
+ @hash['hello'] = 'world'
+ @hash.delete 'hello'
+ @hash.update({'hello' => 'mom'})
+
+ @hash.sweep
+ assert_equal({'hello' => 'mom'}, @hash.to_hash)
+ end
+
def test_delete_sweep
@hash['hello'] = 'world'
@hash['hi'] = 'mom'
@@ -148,5 +157,15 @@ module ActionDispatch
@hash.sweep
assert_equal({'omg' => 'world', 'hello' => 'world'}, @hash.to_hash)
end
+
+ def test_double_sweep
+ @hash['hello'] = 'world'
+ @hash.sweep
+
+ assert_equal({'hello' => 'world'}, @hash.to_hash)
+
+ @hash.sweep
+ assert_equal({}, @hash.to_hash)
+ end
end
end