Sha256: 0d77956b2db80434424a7e37af8482c7ea71aa7acda61f82a3abae4c41e9ce64

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

require_relative 'helper'

class TemplateTest < Minitest::Test
  def test_compile
    assert_equal %("foo"), Mustache::Template.new("foo").compile
  end

  def test_compile_with_source
    assert_equal %("bar"), Mustache::Template.new("foo").compile("bar")
  end

  def test_token
    assert_equal [:multi, [:static, "foo"]], Mustache::Template.new("foo").tokens
  end

  def test_token_with_source
    assert_equal [:multi, [:static, "bar"]], Mustache::Template.new("foo").tokens("bar")
  end
end

class TemplateTest2 < Minitest::Test
  def setup
    @@template_text ||= File.read(File.dirname(__FILE__) + "/fixtures/simply_complicated.mustache")
    @template = Mustache::Template.new(@@template_text)
  end

  def test_tags
    assert_equal [
      "yourname",
      "HOME",
      "friend.name",
      "friend.morr.word",
      "friend.morr.up",
      "friend.morr.awesomesauce",
      "friend.morr.hiss",
      "friend.notinmorr",
      "friend.person",
      "love",
      "triplestash"
      ], @template.tags
  end

  def test_partials
    assert_equal ["partial1", "partial2"], @template.partials
  end

  def test_sections
    assert_equal ["friend", "friend.morr"], @template.sections
  end
end


Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
zine_brewer-1.5.0 vendor/bundle/ruby/2.7.0/gems/mustache-1.1.1/test/template_test.rb
zine_brewer-1.3.0 vendor/bundle/ruby/2.7.0/gems/mustache-1.1.1/test/template_test.rb
mustache-1.1.1 test/template_test.rb
mustache-1.1.0 test/template_test.rb
mustache-1.0.5 test/template_test.rb
mustache-1.0.3 test/template_test.rb
mustache-1.0.2 test/template_test.rb
mustache-1.0.1 test/template_test.rb
mustache-1.0.0 test/template_test.rb