Sha256: ddc9c9246be3eaf30e865715e93a3c1b417ab5ab07a35d521d0033446059d088

Contents?: true

Size: 918 Bytes

Versions: 40

Compression:

Stored size: 918 Bytes

Contents

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

40 entries across 40 versions & 1 rubygems

Version Path
nanoc-4.1.6 test/filters/test_slim.rb
nanoc-4.2.0b1 test/filters/test_slim.rb
nanoc-4.1.5 test/filters/test_slim.rb
nanoc-4.1.4 test/filters/test_slim.rb
nanoc-4.1.3 test/filters/test_slim.rb
nanoc-4.1.2 test/filters/test_slim.rb
nanoc-4.1.1 test/filters/test_slim.rb
nanoc-4.1.0 test/filters/test_slim.rb
nanoc-4.1.0rc2 test/filters/test_slim.rb
nanoc-4.1.0rc1 test/filters/test_slim.rb
nanoc-4.1.0b1 test/filters/test_slim.rb
nanoc-4.1.0a1 test/filters/test_slim.rb
nanoc-4.0.2 test/filters/test_slim.rb
nanoc-4.0.1 test/filters/test_slim.rb
nanoc-4.0.0 test/filters/test_slim.rb
nanoc-4.0.0rc3 test/filters/test_slim.rb
nanoc-4.0.0rc2 test/filters/test_slim.rb
nanoc-4.0.0rc1 test/filters/test_slim.rb
nanoc-4.0.0b4 test/filters/test_slim.rb
nanoc-4.0.0b3 test/filters/test_slim.rb