Sha256: a545d2c92a5c6847cf6c9756e4f575af3862519248cc991f9e9af49f2d021c64

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 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(context: @page, params: ["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(context: @page)
    end
  end

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

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

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.9 test/lib/content/tags/snippet_test.rb