Sha256: ea4e69936bbcd532dd713be10a5a10a042a8a8199cb7bf18ddb7356505c75482

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')

require 'scout/tsv'

class TestTSVPersist < Test::Unit::TestCase
  def test_persist
    content =<<-'EOF'
#: :sep=/\s+/#:type=:double#:merge=:concat
#Id    ValueA    ValueB    OtherID
row1    a|aa|aaa    b    Id1|Id2
row2    A    B    Id3
row2    a    a    id3
    EOF


    tsv = Persist.persist("TEST Persist TSV", :tsv) do 
      TmpFile.with_file(content) do |filename|
        TSV.open(filename)
      end
    end

    assert_include tsv.keys, 'row1'
    assert_include tsv.keys, 'row2'

    tsv = Persist.persist("TEST Persist TSV", :tsv) do 
      TmpFile.with_file(content) do |filename|
        TSV.open(filename)
      end
    end

    assert_include tsv.keys, 'row1'
    assert_include tsv.keys, 'row2'

    assert_nothing_raised do
      tsv = Persist.persist("TEST Persist TSV", :tsv) do 
        raise
      end
    end

    assert_include tsv.keys, 'row1'
    assert_include tsv.keys, 'row2'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scout-gear-10.4.0 test/scout/tsv/test_persist.rb
scout-gear-10.3.0 test/scout/tsv/test_persist.rb
scout-gear-10.2.0 test/scout/tsv/test_persist.rb
scout-gear-10.1.0 test/scout/tsv/test_persist.rb
scout-gear-10.0.1 test/scout/tsv/test_persist.rb
scout-gear-9.1.0 test/scout/tsv/test_persist.rb
scout-gear-9.0.0 test/scout/tsv/test_persist.rb
scout-gear-8.1.0 test/scout/tsv/test_persist.rb
scout-gear-8.0.0 test/scout/tsv/test_persist.rb