Sha256: 9e6aa39b0e10df408a3262ad707b9784c5afe92469cb4b6f20278a905ab01f18

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

#
# File::       test_HAMLProcessor.rb
# Author::     wkm
# Copyright::  2009
# License::    GPL
#
# Unit tests for the HAMLProcessor
#

$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'test/unit'
require 'sitefuel/extensions/StringFormatting'
require 'sitefuel/processors/HAMLProcessor'

include SiteFuel::Processor

class TestHAMLProcessor < Test::Unit::TestCase
  def test_file_extensions

    # negative tests
    assert_equal false, HAMLProcessor.processes_file?("testhaml")

    # positive tests
    assert HAMLProcessor.processes_file?("test.haml")
    assert HAMLProcessor.processes_file?("test.HAML")

  end

  def test_name
    assert_equal "HAML", HAMLProcessor.processor_name
  end

  def test_generate
    assert_equal(
      "<strong class='code' id='message'>Hello, World!</strong>",

      HAMLProcessor.filter_string(:generate,
        %q{
          %strong{:class => "code", :id => "message"} Hello, World!
        }.align
      ).strip
    )
  end

  def test_minify
    assert_equal(
      "<quote><p><strong class=\"code\" id=\"message\">Hello, World!</strong></p></quote>",

      HAMLProcessor.filter_string([:generate, :minify],
        %q{
          %quote
            %p
              %strong{:class => "code", :id => "message"} Hello, World!
        }.align
      ).strip
    )
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sitefuel-0.0.0b test/test_HAMLProcessor.rb.rb
sitefuel-0.0.0a test/test_HAMLProcessor.rb.rb