Sha256: ebb58bec345e338c3aa3a681a52dc4f6e7b809b88a010e3ac63e672fe8783eff

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require_relative "../../../test_helper"

class ContentTagsSnippetTest < ActiveSupport::TestCase

  setup do
    @page = comfy_cms_pages(:default)
  end

  def test_init
    tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(@page, "default")
    assert_equal "default", tag.identifier
    assert_equal comfy_cms_snippets(:default), tag.snippet
  end

  def test_init_without_identifier
    message = "Missing identifier for snippet tag"
    assert_exception_raised ComfortableMexicanSofa::Content::Tag::Error, message do
      ComfortableMexicanSofa::Content::Tag::Snippet.new(@page, "")
    end
  end

  def test_snippet_new_record
    tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(@page, "new")
    assert tag.snippet.new_record?
  end

  def test_content
    tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(@page, "default")
    assert_equal "snippet content", tag.content
  end

  def test_content_new_record
    tag = ComfortableMexicanSofa::Content::Tag::Snippet.new(@page, "new")
    assert_nil tag.content
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.8 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.7 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.6 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.5 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.4 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.3 test/lib/content/tags/snippet_test.rb