Sha256: 5d9be764a217d7e8e1c9a3b8ca3beaf74c7d43bdd8a4bd4d4c7d5a652c8d27dc

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

require 'test_helper'

class BlockCutterTest < Test::Unit::TestCase
  context "basic behavior" do
    setup do
      @block_cutter = Flannel::BlockCutter.new
    end

    should "split a flannel document into squares based on blank lines" do
      markup = "foo\n\nbar"

      squares = @block_cutter.cut markup
      assert_equal 2, squares.length
      assert_equal "foo", squares[0].to_s
      assert_equal "bar", squares[1].to_s
    end

    should "not split preformatted text based on blank lines" do
      markup = "_foo\n\nbar\n_"

      squares = @block_cutter.cut markup
      assert_equal 1, squares.length
      assert_equal :preformatted, squares[0].style
    end


    should "separate preformatted blocks" do
      markup = "_foo\n_\n\n_bar\n_"

      squares = @block_cutter.cut markup
      assert_equal 2, squares.length
      assert_equal :preformatted, squares[0].style
      assert_equal :preformatted, squares[1].style
    end

    should "strip preformatted markers when found" do
      markup = "_foo\n\nbar\n_"

      squares = @block_cutter.cut markup
      assert_equal "foo\n\nbar",  squares[0].to_s
    end
    
    should "set square style to feed based on ampersand " do
      markup = "& http://www.example.com/rss"

      squares = @block_cutter.cut markup
      assert_equal :feed, squares[0].style
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flannel-0.2.5 test/block_cutter_test.rb
flannel-0.2.4 test/block_cutter_test.rb
flannel-0.2.3 test/block_cutter_test.rb