Sha256: 8cc208e37372af5d4326cec573ff77db162c1e16e80b4168d28c3056ce94e50f

Contents?: true

Size: 944 Bytes

Versions: 15

Compression:

Stored size: 944 Bytes

Contents

# encoding: utf-8

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

  include Nanoc::TestHelpers

  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.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 = ::Nanoc::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

15 entries across 15 versions & 1 rubygems

Version Path
nanoc-3.5.0 test/filters/test_slim.rb
nanoc-3.5.0b2 test/filters/test_slim.rb
nanoc-3.5.0b1 test/filters/test_slim.rb
nanoc-3.4.3 test/filters/test_slim.rb
nanoc-3.4.2 test/filters/test_slim.rb
nanoc-3.4.1 test/filters/test_slim.rb
nanoc-3.4.0 test/filters/test_slim.rb
nanoc-3.3.7 test/filters/test_slim.rb
nanoc-3.3.6 test/filters/test_slim.rb
nanoc-3.3.5 test/filters/test_slim.rb
nanoc-3.3.4 test/filters/test_slim.rb
nanoc-3.3.3 test/filters/test_slim.rb
nanoc-3.3.2 test/filters/test_slim.rb
nanoc-3.3.1 test/filters/test_slim.rb
nanoc-3.3.0 test/filters/test_slim.rb