Sha256: fed4624eec263aa3dbd862b98c8af7c6f2813c30805e89f18b143498ba01e211

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

require 'test_helper'

class MarkdownEngineTest < ActiveSupport::TestCase

  def setup
    @default_setup = Maildown::MarkdownEngine.block
  end

  def teardown
    Maildown::MarkdownEngine.set(&@default_setup)
  end

  test "can set engine" do
    Maildown::MarkdownEngine.set do |text|
      "foo: #{text}"
    end
    assert_equal "foo: bar", Maildown::MarkdownEngine.to_html("bar")
  end

  test "default works in multiple threads" do
    thread = Thread.new do
      assert_equal "<p>bar</p>\n", Maildown::MarkdownEngine.to_html("bar")
    end
    thread.join
  end

  test "custom engine works in multiple threads" do
    Maildown::MarkdownEngine.set do |text|
      "foo: #{text}"
    end

    thread = Thread.new do
      assert_equal "foo: bar", Maildown::MarkdownEngine.to_html("bar")
    end
    thread.join
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maildown-2.0.1 test/unit/markdown_engine_test.rb