Sha256: 9548f49a22ad07704176e5f1ec8f0834e99ec8aca1370f57b27f11175fdb79cd

Contents?: true

Size: 1000 Bytes

Versions: 7

Compression:

Stored size: 1000 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.slug
    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

7 entries across 7 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.0.9 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.7 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.6 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.5 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.4 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.3 test/unit/cms_tags/snippet_test.rb
comfortable_mexican_sofa-1.0.2 test/unit/cms_tags/snippet_test.rb