Sha256: 8ce7cd03a55754bcbec428aa2750541a23ef4c02301624649888fb13ac4ce759

Contents?: true

Size: 1.42 KB

Versions: 23

Compression:

Stored size: 1.42 KB

Contents

require File.expand_path('../../test_helper', File.dirname(__FILE__))

class PageTextTagTest < ActiveSupport::TestCase
  
  def test_initialize_tag
    assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag(
      cms_pages(:default), '{{ cms:page:content:text }}'
    )
    assert_equal 'content', tag.label
    assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag(
      cms_pages(:default), '{{cms:page:content}}'
    )
    assert_equal 'content', tag.label
    assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag(
      cms_pages(:default), '{{cms:page:content:text}}'
    )
    assert_equal 'content', tag.label
    assert tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag(
      cms_pages(:default), '{{cms:page:dash-content}}'
    )
    assert_equal 'dash-content', tag.label
  end
  
  def test_initialize_tag_failure
    [
      '{{cms:page:content:not_text}}',
      '{{cms:not_page:content}}',
      '{not_a_tag}'
    ].each do |tag_signature|
      assert_nil ComfortableMexicanSofa::Tag::PageText.initialize_tag(
        cms_pages(:default), tag_signature
      )
    end
  end
  
  def test_content_and_render
    tag = ComfortableMexicanSofa::Tag::PageText.initialize_tag(
      cms_pages(:default), '{{cms:page:content}}'
    )
    assert tag.content.blank?
    tag.content = 'test_content'
    assert_equal 'test_content', tag.content
    assert_equal 'test_content', tag.render
  end
  
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.22 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.21 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.20 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.19 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.18 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.17 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.16 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.15 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.14 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.13 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.12 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.11 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.10 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.9 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.8 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.7 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.6 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.5 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.4 test/unit/tags/page_text_test.rb
comfortable_mexican_sofa-1.4.3 test/unit/tags/page_text_test.rb