require "test/unit" require "shoulda" require "webmock/test_unit" require "yaml" require "lib/jkl" class TextCleaningTest < Test::Unit::TestCase context "Cleaning Text" do should "Remove short lines" do input = <<-HTML the cat sat on the mat a short line HTML result = Jkl::Text::remove_short_lines input assert result == "the cat sat on the mat" end should "Remove script tags" do input = <<-HTML the cat sat on the mat a short line HTML result = Jkl::Text::remove_short_lines input assert result == "the cat sat on the mat" end should "Remove html comments" do input = <<-HTML the cat sat on the mat a short line HTML result = Jkl::Text::remove_short_lines input assert result == "the cat sat on the mat" end should "Remove blank lines" do input = <<-HTML the cat sat on the mat a short line HTML result = Jkl::Text::remove_short_lines input assert result == "the cat sat on the mat" end should "Strip all tags" do input = <<-HTML

the cat sat on the mat

HTML result = Jkl::Text::strip_all_tags input assert result == "the cat sat on the mat\n" #TODO fix carriage return end should "Clean text" do input = <<-HTML the cat sat on the mat

some para stuff here

some end stuff here HTML result = Jkl::Text::clean input assert result == "the cat sat on the mat" end end end