Sha256: a9a2c3be24f3cf703e35f0df4fe26991cd5c4a67037b54b16359c562ac17c387

Contents?: true

Size: 937 Bytes

Versions: 6

Compression:

Stored size: 937 Bytes

Contents

# encoding: utf-8

class Nanoc::Filters::SlimTest < Nanoc::TestCase
  def test_filter
    if_have 'slim' do
      # Create filter
      filter = ::Nanoc::Filters::Slim.new({ rabbit: 'The rabbit is on the branch.' })

      # Run filter (no assigns)
      result = filter.setup_and_run('html')
      assert_match(/<html>.*<\/html>/, result)

      # Run filter (assigns without @)
      result = filter.setup_and_run('p = rabbit')
      assert_equal('<p>The rabbit is on the branch.</p>', result)

      # Run filter (assigns with @)
      result = filter.setup_and_run('p = @rabbit')
      assert_equal('<p>The rabbit is on the branch.</p>', result)
    end
  end

  def test_filter_with_yield
    if_have 'slim' do
      filter = ::Nanoc::Filters::Slim.new({ content: 'The rabbit is on the branch.' })

      result = filter.setup_and_run('p = yield')
      assert_equal('<p>The rabbit is on the branch.</p>', result)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 test/filters/test_slim.rb
nanoc-4.0.0b1 test/filters/test_slim.rb
nanoc-4.0.0a2 test/filters/test_slim.rb
nanoc-4.0.0a1 test/filters/test_slim.rb
nanoc-3.8.0 test/filters/test_slim.rb
nanoc-3.7.5 test/filters/test_slim.rb