Sha256: 56b47f69fe60003c3800f0c7aa9b1081913d01086eded0bb71f26e363c7381e7

Contents?: true

Size: 624 Bytes

Versions: 13

Compression:

Stored size: 624 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/test_helper'
require 'webgen/tag/date'
require 'time'

class TestTagDate < Minitest::Test

  include Webgen::TestHelper

  def test_call
    context = setup_context
    time = Time.now
    context[:config] = {'tag.date.format' => '%Y%m%d'}
    context[:chain] = [Webgen::Node.new(@website.tree.dummy_root, '/', '/', 'created_at' => time)]

    assert_equal(Time.now.strftime("%Y%m%d"), Webgen::Tag::Date.call('date', '', context))

    context[:config]['tag.date.mi'] = 'created_at'
    assert_equal(time.strftime("%Y%m%d"), Webgen::Tag::Date.call('date', '', context))
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
webgen-1.7.3 test/webgen/tag/test_date.rb
webgen-1.7.2 test/webgen/tag/test_date.rb
webgen-1.7.1 test/webgen/tag/test_date.rb
webgen-1.7.0 test/webgen/tag/test_date.rb
webgen-1.6.0 test/webgen/tag/test_date.rb
webgen-1.5.2 test/webgen/tag/test_date.rb
webgen-1.5.1 test/webgen/tag/test_date.rb
webgen-1.5.0 test/webgen/tag/test_date.rb
webgen-1.4.1 test/webgen/tag/test_date.rb
webgen-1.4.0 test/webgen/tag/test_date.rb
webgen-1.3.0 test/webgen/tag/test_date.rb
webgen-1.2.1 test/webgen/tag/test_date.rb
webgen-1.2.0 test/webgen/tag/test_date.rb