Sha256: b714e88fb49a1c78d8e5e99481d69d1689600ef80962dc7e23af55a49de9d836

Contents?: true

Size: 1.21 KB

Versions: 15

Compression:

Stored size: 1.21 KB

Contents

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

require 'webgen/test_helper'

class TestTagCoderay < Minitest::Test

  include Webgen::TestHelper

  def test_call
    require 'webgen/tag/coderay' rescue skip("Library coderay not installed")

    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

15 entries across 15 versions & 1 rubygems

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