Sha256: 57c038aa9b910bb5e0a22c6dd8c69d6fc0d1a2aca289ce226819079d4cf72288

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

require 'assert'
require 'deas-kramdown'

require 'deas/template_engine'
require 'deas-kramdown/source'

class Deas::Kramdown::TemplateEngine

  class UnitTests < Assert::Context
    desc "Deas::Kramdown::TemplateEngine"
    setup do
      @engine = Deas::Kramdown::TemplateEngine.new({
        'source_path' => TEST_SUPPORT_PATH
      })
    end
    subject{ @engine }

    should have_imeths :kramdown_source
    should have_imeths :render, :partial, :compile

    should "be a Deas template engine" do
      assert_kind_of Deas::TemplateEngine, subject
    end

    should "memoize its kramdown source" do
      assert_kind_of Deas::Kramdown::Source, subject.kramdown_source
      assert_equal subject.source_path, subject.kramdown_source.root
      assert_same subject.kramdown_source, subject.kramdown_source
    end

    should "allow custom doc opts on its source" do
      doc_opts = { Factory.string => Factory.string }
      engine = Deas::Kramdown::TemplateEngine.new('doc_opts' => doc_opts)
      assert_equal doc_opts, engine.kramdown_source.doc_opts
    end

    should "pass any given cache option to its source" do
      engine = Deas::Kramdown::TemplateEngine.new('cache' => true)
      assert_kind_of Hash, engine.kramdown_source.cache
    end

  end

  # render, partial and compile tests are covered in the system tests

end

Version data entries

5 entries across 5 versions & 1 rubygems

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