Sha256: d74278c9f919bff44aa9ce178ca64d42765d631840267023ac7c62d29fbd2e7f

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

require File.dirname(__FILE__) + '/../../test_helper'

class SnippetTest < ActiveSupport::TestCase
  
  def test_initialize_tag
    %w(
      <cms:snippet:label/>
      <cms:snippet:label>
    ).each do |tag_signature|
      assert tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), tag_signature)
      assert_equal 'label', tag.label
    end
  end
  
  def test_initialize_tag_failure
    %w(
      <cms:snippet>
      <cms:not_snippet:label/>
      not_a_tag
    ).each do |tag_signature|
      assert_nil CmsTag::Snippet.initialize_tag(cms_pages(:default), tag_signature)
    end
  end
  
  def test_content_and_render
    tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), "<cms:snippet:default>")
    assert_equal 'default_snippet_content', tag.content
    assert_equal 'default_snippet_content', tag.render
    
    tag = CmsTag::Snippet.initialize_tag(cms_pages(:default), "<cms:snippet:doesnot_exist>")
    assert_equal nil, tag.content
    assert_equal '', tag.render
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.0.1 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.0 test/unit/cms_tags/snippet_test.rb