Sha256: fd68c1aeb38205c16a6c760aa53ec2037b2200e4237c4f901a8fb2cc3332e837

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

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

require 'webgen/test_helper'
require 'webgen/tag/coderay'

class TestTagCoderay < MiniTest::Unit::TestCase

  include Webgen::TestHelper

  def test_call
    setup_context
    @website.ext.content_processor = Object.new
    @website.ext.content_processor.define_singleton_method(:call) {|_, context| context}
    root = Webgen::Node.new(@website.tree.dummy_root, '/', '/', {'title' => 'Hallo'})
    @context[:chain] = [root]

    assert_result_includes('TestData', @context, 'TestData', 'html', false, 'style')
    assert_result_includes('title', @context, '{title:}', :ruby, true, 'other')
    assert_result_includes('class="constant"', @context, 'TestData', 'ruby', false, 'other')
  end

  def assert_result_includes(string, context, body, lang, process, css)
    @context[:config] = {'tag.coderay.lang' => lang,
      'tag.coderay.process_body' => process,
      'tag.coderay.css' => css,
      'tag.coderay.wrap' => 'span',
      'tag.coderay.line_number_start' => 1,
      'tag.coderay.tab_width' => 8,
      'tag.coderay.bold_every' => 10}
    assert(Webgen::Tag::Coderay.call('coderay', body, @context).include?(string), "Result should include #{string}")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 test/webgen/tag/test_coderay.rb