Sha256: 1c35a3dad11830e37a992fa46c28abb129d6bd0268918430b8eaf1e9ac07a7f9

Contents?: true

Size: 905 Bytes

Versions: 6

Compression:

Stored size: 905 Bytes

Contents

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

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

class TestContentProcessorTags < Minitest::Test

  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

6 entries across 6 versions & 1 rubygems

Version Path
webgen-1.4.0 test/webgen/content_processor/test_tags.rb
webgen-1.3.0 test/webgen/content_processor/test_tags.rb
webgen-1.2.1 test/webgen/content_processor/test_tags.rb
webgen-1.2.0 test/webgen/content_processor/test_tags.rb
webgen-1.1.0 test/webgen/content_processor/test_tags.rb
webgen-1.0.0 test/webgen/content_processor/test_tags.rb