Sha256: a5198cebef8e6c009b32db5de32ab3549b076c29060c571fdec46d028c730c21
Contents?: true
Size: 1.86 KB
Versions: 6
Compression:
Stored size: 1.86 KB
Contents
require_relative "../../../test_helper" class ContentTagsFragmentTest < ActiveSupport::TestCase setup do @page = comfy_cms_pages(:default) end def test_init tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "content") assert_equal @page, tag.context assert_equal "content", tag.identifier assert_equal true, tag.renderable assert_equal "default", tag.namespace end def test_init_with_params tag = ComfortableMexicanSofa::Content::Tag::Fragment.new( @page, "content, render: false, namespace: test" ) assert_equal false, tag.renderable assert_equal "test", tag.namespace end def test_init_without_identifier message = "Missing identifier for fragment tag" assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "") end end def test_fragment tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "content") assert_equal comfy_cms_fragments(:default), tag.fragment end def test_fragment_new_record tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "new") fragment = tag.fragment assert fragment.is_a?(Comfy::Cms::Fragment) assert fragment.new_record? end def test_content tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "content") assert_equal "content", tag.content end def test_content_new_record tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "new") assert_nil tag.content end def test_render tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "content") assert_equal "content", tag.render end def test_render_when_not_renderable tag = ComfortableMexicanSofa::Content::Tag::Fragment.new(@page, "content, render: false") assert_equal "", tag.render end end
Version data entries
6 entries across 6 versions & 1 rubygems