Sha256: 0ebc80f8f51ad0798b768190177694aa085a8ef9ddd6db45e921408839c2fb71
Contents?: true
Size: 1.46 KB
Versions: 5
Compression:
Stored size: 1.46 KB
Contents
# encoding: UTF-8 # Generators register themself on the CLI module require "test_helper" require "./lib/roger/template.rb" module Roger # Roger template tests class TemplateTest < ::Test::Unit::TestCase def setup @base = Pathname.new(File.dirname(__FILE__) + "/../../project") @config = { partials_path: @base + "partials", layouts_path: @base + "layouts", source_path: @base + "html/test.html.erb" } @template_path = @base + "html" end def test_render template = Template.new("<%= 'test' %>", {}, source_path: "test.erb") assert_equal "test", template.render end def test_render_with_block template = Template.new("<%= yield %>", {}, source_path: "test.erb") assert_equal "inner", template.render { "inner" } end def test_data template = Template.new("---\nkey: value\n---\ndata", {}, source_path: "test.erb") assert_equal "value", template.data[:key] end def test_faulty_data template = Template.new("---\nkey value\n---\ndata", {}, source_path: "test.erb") assert_equal({}, template.data) end def test_strip_data_block template = Template.new("---\nkey: value\n---\ndata", {}, source_path: "test.erb") assert_equal "data", template.render end def test_strip_faulty_data_block template = Template.new("---\nkey value\n---\ndata", {}, source_path: "test.erb") assert_equal "data", template.render end end end
Version data entries
5 entries across 5 versions & 1 rubygems