Sha256: 924975a00c8f68a3fe965c690b951b39b436d701905a0b1bf2858b5ad96fd5a9

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

# Copyright (C) 2013  Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

class TestDecomposersCSV< Test::Unit::TestCase
  include Helper

  def setup
    @decomposer = ChupaText::Decomposers::CSV.new({})
  end

  sub_test_case("decompose") do
    def test_body
      csv = <<-CSV
Hello,World
Ruby,ChupaText
      CSV
      assert_equal([csv.gsub(/,/, " ")],
                   decompose(csv).collect(&:body))
    end

    private
    def decompose(csv)
      data = ChupaText::Data.new
      data.path = "hello.csv"
      data.mime_type = "text/csv"
      data.body = csv

      decomposed = []
      @decomposer.decompose(data) do |decomposed_data|
        decomposed << decomposed_data
      end
      decomposed
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
chupa-text-1.1.5 test/decomposers/test-csv.rb
chupa-text-1.1.4 test/decomposers/test-csv.rb
chupa-text-1.1.3 test/decomposers/test-csv.rb
chupa-text-1.1.2 test/decomposers/test-csv.rb
chupa-text-1.1.1 test/decomposers/test-csv.rb
chupa-text-1.1.0 test/decomposers/test-csv.rb
chupa-text-1.0.9 test/decomposers/test-csv.rb
chupa-text-1.0.8 test/decomposers/test-csv.rb
chupa-text-1.0.7 test/decomposers/test-csv.rb
chupa-text-1.0.6 test/decomposers/test-csv.rb
chupa-text-1.0.5 test/decomposers/test-csv.rb
chupa-text-1.0.4 test/decomposers/test-csv.rb
chupa-text-1.0.3 test/decomposers/test-csv.rb
chupa-text-1.0.2 test/decomposers/test-csv.rb
chupa-text-1.0.1 test/decomposers/test-csv.rb
chupa-text-1.0.0 test/decomposers/test-csv.rb