Sha256: 65983f77458c3c6eee2a1db33b687db3b0aff846aa6d2a4dce13ebca4c19f050
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
# encoding: utf-8 class Nanoc::Int::LayoutTest < Nanoc::TestCase def test_initialize # Make sure attributes are cleaned layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, '/foo/') assert_equal({ foo: 'bar' }, layout.attributes) # Make sure identifier is cleaned layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, 'foo') assert_equal(Nanoc::Identifier.new('/foo/'), layout.identifier) end def test_lookup_with_known_attribute # Create layout layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, '/foo/') # Check attributes assert_equal('bar', layout[:foo]) end def test_lookup_with_unknown_attribute # Create layout layout = Nanoc::Int::Layout.new('content', { 'foo' => 'bar' }, '/foo/') # Check attributes assert_equal(nil, layout[:filter]) end def test_dump_and_load layout = Nanoc::Int::Layout.new( 'foobar', { a: { b: 123 } }, '/foo/') layout = Marshal.load(Marshal.dump(layout)) assert_equal Nanoc::Identifier.new('/foo/'), layout.identifier assert_equal 'foobar', layout.raw_content assert_equal({ a: { b: 123 } }, layout.attributes) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.0.0b1 | test/base/test_layout.rb |
nanoc-4.0.0a2 | test/base/test_layout.rb |
nanoc-4.0.0a1 | test/base/test_layout.rb |