Sha256: 8a703ea0e8f9bd0316a0667362e3834eb58cee3f3729e0861484950721c7a681
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
# encoding: utf-8 class Nanoc::Filters::HandlebarsTest < MiniTest::Unit::TestCase include Nanoc::TestHelpers def test_filter if_have 'handlebars' do # Create data item = Nanoc::Item.new( 'content', { :title => 'Max Payne', :protagonist => 'Max Payne', :location => 'here' }, '/games/max-payne/') layout = Nanoc::Layout.new( 'layout content', { :name => 'Max Payne' }, '/default/') config = { :animals => 'cats and dogs' } # Create filter assigns = { :item => item, :layout => layout, :config => config, :content => 'No Payne No Gayne' } filter = ::Nanoc::Filters::Handlebars.new(assigns) # Run filter result = filter.run('{{protagonist}} says: {{yield}}.') assert_equal('Max Payne says: No Payne No Gayne.', result) result = filter.run('We can’t stop {{item.location}}! This is the {{layout.name}} layout!') assert_equal('We can’t stop here! This is the Max Payne layout!', result) result = filter.run('It’s raining {{config.animals}} here!') assert_equal('It’s raining cats and dogs here!', result) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nanoc-3.5.0 | test/filters/test_handlebars.rb |
nanoc-3.5.0b2 | test/filters/test_handlebars.rb |
nanoc-3.5.0b1 | test/filters/test_handlebars.rb |
nanoc-3.4.3 | test/filters/test_handlebars.rb |