Sha256: be3433c78e93d8279d5dd912f7d4fcded02759f42f2c76098f32e10bf32ceb18
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
require_relative "../../../test_helper" class ContentTagsTemplateTest < ActiveSupport::TestCase def test_init tag = ComfortableMexicanSofa::Content::Tag::Template.new(@page, "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(@page, "") end end def test_content tag = ComfortableMexicanSofa::Content::Tag::Template.new(@page, "path/to/template") assert_equal "<%= render template: \"path/to/template\" %>", tag.content end def test_render tag = ComfortableMexicanSofa::Content::Tag::Template.new(@page, "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(@page, "allowed/path") assert_equal "<%= render template: \"allowed/path\" %>", tag.render tag = ComfortableMexicanSofa::Content::Tag::Template.new(@page, "not_allowed/path") assert_equal "", tag.render end end
Version data entries
6 entries across 6 versions & 1 rubygems