Sha256: 002fb6c70ad6e8f563e18638514c57e7e5e2dd53a8404c64ac83476534985156

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

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)
  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

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 test/base/test_layout.rb