Sha256: ae5040f669d8d96262e154c9ef97d76a9d8bee916153cd2bd443314a5ce50a66
Contents?: true
Size: 964 Bytes
Versions: 1
Compression:
Stored size: 964 Bytes
Contents
# frozen_string_literal: true require 'helper' class Nanoc::Int::ItemTest < Nanoc::TestCase def test_initialize_with_attributes_with_string_keys item = Nanoc::Int::Item.new('foo', { 'abc' => 'xyz' }, '/foo/') assert_equal nil, item.attributes['abc'] assert_equal 'xyz', item.attributes[:abc] end def test_reference item = Nanoc::Int::Item.new( 'content', { one: 'one in item' }, '/path/', ) assert_equal([:item, '/path/'], item.reference) end def test_attributes item = Nanoc::Int::Item.new('content', { 'one' => 'one in item' }, '/path/') assert_equal({ one: 'one in item' }, item.attributes) end def test_freeze_should_disallow_changes item = Nanoc::Int::Item.new('foo', { a: { b: 123 } }, '/foo/') item.freeze assert_raises_frozen_error do item.attributes[:abc] = '123' end assert_raises_frozen_error do item.attributes[:a][:b] = '456' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.7.10 | test/base/test_item.rb |