Sha256: 16e9e710aeccfd13490c3ef4996e439abb292cb5598f3da97ba832b696cd433d

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

class Nanoc::Filters::MustacheTest < Nanoc::TestCase
  def test_filter
    if_have 'mustache' do
      # Create item
      item = Nanoc::Int::Item.new(
        'content',
        { title: 'Max Payne', protagonist: 'Max Payne' },
        '/games/max-payne/',
      )

      # Create filter
      filter = ::Nanoc::Filters::Mustache.new({ item: item })

      # Run filter
      result = filter.setup_and_run('The protagonist of {{title}} is {{protagonist}}.')
      assert_equal('The protagonist of Max Payne is Max Payne.', result)
    end
  end

  def test_filter_with_yield
    if_have 'mustache' do
      # Create item
      item = Nanoc::Int::Item.new(
        'content',
        { title: 'Max Payne', protagonist: 'Max Payne' },
        '/games/max-payne/',
      )

      # Create filter
      filter = ::Nanoc::Filters::Mustache.new(
        { content: 'No Payne No Gayne', item: item },
      )

      # Run filter
      result = filter.setup_and_run('Max says: {{yield}}.')
      assert_equal('Max says: No Payne No Gayne.', result)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
nanoc-4.4.5 test/filters/test_mustache.rb
nanoc-4.4.4 test/filters/test_mustache.rb
nanoc-4.4.3 test/filters/test_mustache.rb
nanoc-4.4.2 test/filters/test_mustache.rb
nanoc-4.4.1 test/filters/test_mustache.rb
nanoc-4.4.0 test/filters/test_mustache.rb
nanoc-4.3.8 test/filters/test_mustache.rb
nanoc-4.3.7 test/filters/test_mustache.rb
nanoc-4.3.6 test/filters/test_mustache.rb
nanoc-4.3.5 test/filters/test_mustache.rb
nanoc-4.3.4 test/filters/test_mustache.rb
nanoc-4.3.3 test/filters/test_mustache.rb
nanoc-4.3.2 test/filters/test_mustache.rb
nanoc-4.3.1 test/filters/test_mustache.rb
nanoc-4.3.0 test/filters/test_mustache.rb
nanoc-4.2.4 test/filters/test_mustache.rb
nanoc-4.2.3 test/filters/test_mustache.rb
nanoc-4.2.2 test/filters/test_mustache.rb
nanoc-4.2.1 test/filters/test_mustache.rb
nanoc-4.2.0 test/filters/test_mustache.rb