Sha256: 357dda349861abbba62844ebe99862805b33e18b436a639246103d5de8970966

Contents?: true

Size: 1.2 KB

Versions: 22

Compression:

Stored size: 1.2 KB

Contents

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

class HelperTest < ActiveSupport::TestCase
  
  def test_initialize_tag
    assert CmsTag::Helper.initialize_tag(cms_pages(:default), '{{ cms:helper:method_name }}')
  end
  
  def test_initialize_tag_with_parameters
    assert tag = CmsTag::Helper.initialize_tag(cms_pages(:default), '{{ cms:helper:method_name:param1:param2 }}')
    assert tag.label = 'method_name'
    assert tag.params = 'param1:param2'
  end
  
  def test_initialize_tag_failure
    [
      '{{cms:helper}}',
      '{{cms:not_helper:method_name}}',
      '{not_a_tag}'
    ].each do |tag_signature|
      assert_nil CmsTag::Helper.initialize_tag(cms_pages(:default), tag_signature)
    end
  end
  
  def test_content_and_render
    tag = CmsTag::Helper.initialize_tag(cms_pages(:default), '{{cms:helper:method_name}}')
    assert_equal "<%= method_name() %>", tag.content
    assert_equal "<%= method_name() %>", tag.render
    
    tag = CmsTag::Helper.initialize_tag(cms_pages(:default), '{{cms:helper:method_name:param1:param2}}')
    assert_equal "<%= method_name('param1', 'param2') %>", tag.content
    assert_equal "<%= method_name('param1', 'param2') %>", tag.render
  end
  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.0.32 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.31 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.30 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.29 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.28 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.27 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.26 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.25 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.24 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.23 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.22 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.21 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.20 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.19 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.18 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.17 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.16 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.15 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.14 test/unit/cms_tags/helper_test.rb
comfortable_mexican_sofa-1.0.13 test/unit/cms_tags/helper_test.rb