Sha256: 78410b0a6ee716c31ed77d8b26c0a63552f89c0f1c7910d38126e30f9778ee4e

Contents?: true

Size: 1.53 KB

Versions: 2

Compression:

Stored size: 1.53 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 full tag " do
      markup = ":feed http://www.example.com/rss"

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flannel-0.2.7 test/block_cutter_test.rb
flannel-0.2.6 test/block_cutter_test.rb