Sha256: b3197cbba5720341ef092aa8743c3e19507f2896faca7baa1bce1654be912d15
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
require_relative "../../../test_helper" class ContentTagsTemplateTest < ActiveSupport::TestCase def test_init tag = ComfortableMexicanSofa::Content::Tag::Template.new( context: @page, params: ["path/to/template"] ) assert_equal "path/to/template", tag.path end def test_init_without_path message = "Missing template path for template tag" assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do ComfortableMexicanSofa::Content::Tag::Template.new(context: @page) end end def test_content tag = ComfortableMexicanSofa::Content::Tag::Template.new( context: @page, params: ["path/to/template"] ) assert_equal "<%= render template: \"path/to/template\" %>", tag.content end def test_render tag = ComfortableMexicanSofa::Content::Tag::Template.new( context: @page, params: ["path/to/template"] ) assert_equal "<%= render template: \"path/to/template\" %>", tag.render end def test_render_with_whitelist ComfortableMexicanSofa.config.allowed_templates = ["allowed/path"] tag = ComfortableMexicanSofa::Content::Tag::Template.new( context: @page, params: ["allowed/path"] ) assert_equal "<%= render template: \"allowed/path\" %>", tag.render tag = ComfortableMexicanSofa::Content::Tag::Template.new( context: @page, params: ["not_allowed/path"] ) assert_equal "", tag.render end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comfortable_mexican_sofa-2.0.9 | test/lib/content/tags/template_test.rb |