Sha256: fc4e435c5e9c37b94dbc5869c3b6f58858d1ac7ff2f5403d7f2f3600bdce8721
Contents?: true
Size: 535 Bytes
Versions: 13
Compression:
Stored size: 535 Bytes
Contents
require_relative '../../test_helper' DuckPuncher.punch! Hash class HashTest < MiniTest::Test def setup @subject = { a: 1, b: { c: 2 } } end def test_dig assert_equal @subject.dig(:a), 1 assert_equal @subject.dig(:b, :a), nil assert_equal @subject.dig(:b, :c), 2 assert_equal @subject.dig(:b), { c: 2 } end def test_compact assert_equal @subject.compact, { a: 1, b: { c: 2 } } @subject[:b] = nil assert_equal @subject, { a: 1, b: nil } assert_equal @subject.compact, { a: 1 } end end
Version data entries
13 entries across 13 versions & 1 rubygems