Sha256: 54d001525f6f0e8e55942387bc93f1c28e75595a5521528fd68171ce10a4455b

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

require 'assert'
require 'deas-kramdown'

require 'deas/template_source'

class Deas::Kramdown::TemplateEngine

  class SystemTests < Assert::Context
    desc "Deas::Kramdown::TemplateEngine"
    setup do
      @view = OpenStruct.new({
        :identifier => Factory.integer,
        :name       => Factory.string
      })
      @locals  = { 'local1' => Factory.string }
      @content = Proc.new{ Factory.string }

      @engine = Deas::Kramdown::TemplateEngine.new('source_path' => TEMPLATE_ROOT)
    end
    subject{ @engine }

    should "render templates (ignoring the view/locals/content)" do
      exp = Factory.basic_markdown_rendered
      assert_equal exp, subject.render('basic', @view, @locals)
      assert_equal exp, subject.render('basic', @view, @locals, &@content)
    end

    should "render partial templates (ignoring the locals/content)" do
      exp = Factory.basic_markdown_rendered
      assert_equal exp, subject.partial('_basic', @locals)
      assert_equal exp, subject.partial('_basic', @locals, &@content)
    end

    should "compile raw template markup" do
      template_name = 'basic_alt'
      file_path     = TEMPLATE_ROOT.join("#{template_name}.markdown").to_s
      file_content  = File.read(file_path)

      exp = Factory.basic_markdown_rendered
      assert_equal exp, subject.compile(template_name, file_content)
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
deas-kramdown-0.1.4 test/system/template_engine_tests.rb
deas-kramdown-0.1.3 test/system/template_engine_tests.rb
deas-kramdown-0.1.2 test/system/template_engine_tests.rb
deas-kramdown-0.1.1 test/system/template_engine_tests.rb
deas-kramdown-0.1.0 test/system/template_engine_tests.rb