Sha256: cbfcd7a5c0925f4f1cafaa2d96f0ead830ad8d911f2b7bbbfea1284700ec065a

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require_relative '../../test_case'

class ContentTagTest < TestCase
  let(:tag) { Staticpress::Content::Tag.new :name => 'charlotte' }

  def test_tags
    assert_equal [ 'charlotte' ], Staticpress::Content::Tag.tags
  end

  def test_pages_count
    assert_equal 1, tag.pages_count
  end

  def test_optional_param_defaults
    expected = { :number => 1 }
    assert_equal expected, Staticpress::Content::Tag.new(:name => 'charlotte').optional_param_defaults
    assert_equal expected, Staticpress::Content::Tag.new(:name => 'charlotte', :number => nil).optional_param_defaults
  end

  def test_sub_content
    expected = [
      Staticpress::Content::Post.new(:year => '2011', :month => '08', :day => '06', :title => 'in-charlotte')
    ]
    assert_equal expected, tag.sub_content
  end

  def test_all
    expected = [
      Staticpress::Content::Tag.new(:name => 'charlotte', :number => 1)
    ]
    assert_equal expected, Staticpress::Content::Tag.all
  end

  def test_content_by_tag
    [
      Staticpress::Content::Post.new(:year => '2011', :month => '08', :day => '06', :title => 'in-charlotte')
    ].each { |content| assert_includes Staticpress::Content::Tag.content_by_tag['charlotte'], content }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
staticpress-0.6.2 tests/staticpress/content/tag_test.rb
staticpress-0.6.1 tests/staticpress/content/tag_test.rb
staticpress-0.6.0 tests/staticpress/content/tag_test.rb