Sha256: b10688c2a86c7c9c6cc9a4eb8a01f8577ca435b3922be30bb6ec5f5408c7c7f2
Contents?: true
Size: 981 Bytes
Versions: 4
Compression:
Stored size: 981 Bytes
Contents
require 'helper' describe 'Array#__nanoc_symbolize_keys_recursively' do it 'should convert keys to symbols' do array_old = [:abc, 'xyz', { 'foo' => 'bar', :baz => :qux }] array_new = [:abc, 'xyz', { foo: 'bar', baz: :qux }] array_old.__nanoc_symbolize_keys_recursively.must_equal array_new end end describe 'Array#__nanoc_freeze_recursively' do include Nanoc::TestHelpers it 'should prevent first-level elements from being modified' do array = [:a, %i[b c], :d] array.__nanoc_freeze_recursively assert_raises_frozen_error do array[0] = 123 end end it 'should prevent second-level elements from being modified' do array = [:a, %i[b c], :d] array.__nanoc_freeze_recursively assert_raises_frozen_error do array[1][0] = 123 end end it 'should not freeze infinitely' do a = [] a << a a.__nanoc_freeze_recursively assert a.frozen? assert a[0].frozen? assert_equal a, a[0] end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.7.9 | test/base/core_ext/array_spec.rb |
nanoc-4.7.8 | test/base/core_ext/array_spec.rb |
nanoc-4.7.7 | test/base/core_ext/array_spec.rb |
nanoc-4.7.6 | test/base/core_ext/array_spec.rb |