Sha256: c172f61c53fd9da51972f0eae9ee02302435c38472e808e707b7e28d0f057ad4

Contents?: true

Size: 915 Bytes

Versions: 3

Compression:

Stored size: 915 Bytes

Contents

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

require 'webgen/test_helper'
require 'webgen/content_processor/tags'
require 'webgen/utils/tag_parser'

class TestContentProcessorTags < MiniTest::Unit::TestCase

  include Webgen::TestHelper

  class SimpleTag

    def set_block(&block)
      @block = block
    end

    def call(tag, params, body, context)
      @block.call(tag, params, body, context)
    end

    def replace_tags(content, &block)
      Webgen::Utils::TagParser.new.replace_tags(content, &block)
    end

  end

  def test_static_call
    setup_context
    cp = Webgen::ContentProcessor::Tags

    @context.content = '{test: }'
    stag = SimpleTag.new
    @website.ext.tag = stag

    stag.set_block do |tag, params, body, local_context|
      assert_equal('test', tag)
      assert_equal(nil, params)
      assert_equal('', body)
      assert_equal(@context, local_context)
    end
    cp.call(@context)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 test/webgen/content_processor/test_tags.rb
webgen-1.0.0.beta2 test/webgen/content_processor/test_tags.rb
webgen-1.0.0.beta1 test/webgen/content_processor/test_tags.rb