Sha256: 40d74c52f9a13b51f11e299ec58d5197cf58395b0b591c0dbc5c8e0bbac1f4a8

Contents?: true

Size: 997 Bytes

Versions: 7

Compression:

Stored size: 997 Bytes

Contents

require 'test_helper'
require 'review/template'

class TemplateTest < Test::Unit::TestCase
  include ReVIEW

  def setup
    @name = nil
  end

  def test_load
    tmplfile = File.expand_path('./assets/test.xml.erb', __dir__)
    tmpl = ReVIEW::Template.load(tmplfile)
    assert_equal("<test>\n<name></name>\n</test>\n", tmpl.result(binding))
  end

  def test_open_with_value
    tmplfile = File.expand_path('./assets/test.xml.erb', __dir__)
    tmpl = ReVIEW::Template.load(tmplfile)
    @name = 'test'
    assert_equal("<test>\n<name>test</name>\n</test>\n", tmpl.result(binding))
  end

  def test_generate
    result = ReVIEW::Template.generate(path: './assets/test.xml.erb', binding: binding, template_dir: __dir__)
    assert_equal("<test>\n<name></name>\n</test>\n", result)
  end

  def test_generate_without_template_dir
    result = ReVIEW::Template.generate(path: '../test/assets/test.xml.erb', binding: binding)
    assert_equal("<test>\n<name></name>\n</test>\n", result)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
review-5.6.0 test/test_template.rb
review-5.5.0 test/test_template.rb
review-5.4.0 test/test_template.rb
review-5.3.0 test/test_template.rb
review-5.2.0 test/test_template.rb
review-5.1.1 test/test_template.rb
review-5.1.0 test/test_template.rb