Sha256: 7f20a38d14fc4b0a403b0cfad92450b80a3548d8f2cb6e27127b4db91893b7bf

Contents?: true

Size: 948 Bytes

Versions: 8

Compression:

Stored size: 948 Bytes

Contents

# encoding: utf-8

class Nanoc3::Filters::SlimTest < MiniTest::Unit::TestCase

  include Nanoc3::TestHelpers

  def test_filter
    if_have 'slim' do
      # Create filter
      filter = ::Nanoc3::Filters::Slim.new({ :rabbit => 'The rabbit is on the branch.' })

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

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

      # Run filter (assigns with @)
      result = filter.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 = ::Nanoc3::Filters::Slim.new({ :content => 'The rabbit is on the branch.' })

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

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nanoc3-3.2.4 test/filters/test_slim.rb
nanoc3-3.2.3 test/filters/test_slim.rb
nanoc3-3.2.2 test/filters/test_slim.rb
nanoc3-3.2.1 test/filters/test_slim.rb
nanoc3-3.2.0 test/filters/test_slim.rb
nanoc3-3.2.0b3 test/filters/test_slim.rb
nanoc3-3.2.0b2 test/filters/test_slim.rb
nanoc3-3.2.0b1 test/filters/test_slim.rb