Sha256: a50b1d08a59f3b5a8c51fe874b9cc78f85d3ab229122945e58d902e641cacee1
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'test_helper' require 'tempfile' class GreenmatBinTest < Greenmat::TestCase def setup @fixture_file = Tempfile.new('bin') @fixture_path = @fixture_file.path @fixture_file.write "A ==simple== fixture file -- with " \ "a [link](https://github.com)." @fixture_file.rewind end def teardown @fixture_file.unlink end def test_vanilla_bin run_bin(@fixture_path) expected = "<p>A ==simple== fixture file -- with " \ "a <a href=\"https://github.com\">link</a>.</p>\n" assert_equal expected, @output end def test_enabling_a_parse_option run_bin("--parse", "highlight", @fixture_path) assert_output "<mark>" refute_output "==" end def test_enabling_a_render_option run_bin("--render", "no-links", @fixture_path) assert_output "[link]" refute_output "</a>" end def test_enabling_smarty_pants run_bin("--smarty", @fixture_path) assert_output "&ndash" refute_output "--" end def test_version_option run_bin("--version") assert_output "Greenmat #{Greenmat::VERSION}" end def test_legacy_option_parsing run_bin("--parse-highlight", "--render-no-links", @fixture_path) assert_output "<mark>" refute_output "==" assert_output "[link]" refute_output "</a>" end private def run_bin(*args) bin_path = File.expand_path('../../bin/greenmat', __FILE__) IO.popen("#{bin_path} #{args.join(" ")}") do |stream| @output = stream.read end end def assert_output(pattern) assert_match pattern, @output end def refute_output(pattern) refute_match Regexp.new(pattern), @output end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
greenmat-3.2.0.2 | test/greenmat_bin_test.rb |