require 'test_helper' class CuttingBoardTest < Test::Unit::TestCase context "basic behavior" do setup do @board = Flannel::CuttingBoard.new end should "strip and convert underscores to pre tags" do markup = "_foo\n\n bar\n_" assert_equal "
foo\n\n   bar
", @board.cut(markup) end should "preformat text when both start and end line have the markers" do markup = "_foo\n\n_ bar" assert_equal "
foo\n\n   bar
", @board.cut(markup) end should "not replace in preformatted text" do markup = "_4 - 2 > 2 - 2\n_" assert_equal '
4 - 2 > 2 - 2
', @board.cut(markup) end end context "When block starts with one or more equals signs, it" do setup do @board = Flannel::CuttingBoard.new end should "convert one equals to a header one" do markup = "= Some header" result = "

Some header

" assert_equal result, @board.cut(markup) end should "convert two equals to a header two" do markup = "== Some header" result = "

Some header

" assert_equal result, @board.cut(markup) end end context "When block starts with a star, it" do should "tell square that it's a list, so that it will be wrapped in ul tags" do board = Flannel::CuttingBoard.new markup = "* Yadda" result = "" assert_equal result, board.cut(markup) end end end