Sha256: 02495f138196376931099f4e2a3c1cd971a9f1e782139e24f3b3f161bcc0ed4e

Contents?: true

Size: 1.02 KB

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.2 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.1 test/lib/content/tags/snippet_test.rb
comfortable_mexican_sofa-2.0.0 test/lib/content/tags/snippet_test.rb