Sha256: e6c80cdde76519028d765354b1f92ef213fa8ea98ef8e6daf6107ac8007338fc

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'assert'
require 'deas-nm'

class Deas::Nm::TemplateEngine

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

      @engine = Deas::Nm::TemplateEngine.new({
        'source_path' => TEST_SUPPORT_PATH,
        'serializer' => proc{ |obj, template_name| obj.to_s }
      })
    end
    subject{ @engine }

    should "render nm template files and serialize them" do
      exp = Factory.template_json_rendered(subject, @view, @locals).to_s
      assert_equal exp, subject.render('template.json', @view, @locals)
    end

    should "render nm partials and serialize them" do
      exp = Factory.partial_json_rendered(subject, @locals).to_s
      assert_equal exp, subject.partial('_partial.json', @locals)
    end

    should "render nm templates that render partials and serialize them" do
      exp = Factory.template_partial_json_rendered(subject, @view, @locals).to_s
      assert_equal exp, subject.render('template_partial.json', @view, @locals)
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deas-nm-0.5.1 test/system/template_engine_tests.rb
deas-nm-0.5.0 test/system/template_engine_tests.rb
deas-nm-0.4.0 test/system/template_engine_tests.rb
deas-nm-0.3.0 test/system/template_engine_tests.rb