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

- Moved hwia frozen value assignment test to hash_ext_test similar to other tests

- Fixed the wrong use of with_indifferent_access on hash in the test which failed for isolated tests
- Renamed to appropriately specify what the test does
This commit is contained in:
Vipul A M 2015-01-17 14:55:19 +05:30
parent 9be89ab215
commit 9287790df8
2 changed files with 9 additions and 7 deletions

View file

@ -1549,6 +1549,14 @@ class HashToXmlTest < ActiveSupport::TestCase
assert_not_same hash_wia, hash_wia.with_indifferent_access
end
def test_allows_setting_frozen_array_values_with_indifferent_access
value = [1, 2, 3].freeze
hash = HashWithIndifferentAccess.new
hash[:key] = value
assert_equal hash[:key], value
end
def test_should_copy_the_default_value_when_converting_to_hash_with_indifferent_access
hash = Hash.new(3)
hash_wia = hash.with_indifferent_access

View file

@ -8,10 +8,4 @@ class HashWithIndifferentAccessTest < ActiveSupport::TestCase
assert_equal :old_value, hash[:key]
end
def test_frozen_value
value = [1, 2, 3].freeze
hash = {}.with_indifferent_access
hash[:key] = value
assert_equal hash[:key], value
end
end
end