Sha256: 92848799e812b90ea68506110b78c07ffe484d791acf2859587cfe39b50265d9

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

require File.join(File.dirname(__FILE__), "test_helper")
require 'lib/eeml/csv_parser_v2.rb'
class TestCsvParserV1 < Test::Unit::TestCase

  test "should raise exception if too many rows" do
    csv = "20,305\n30,1305"
    exception = assert_raises CsvEncodingError do
      CsvParserV1.make_environment_from_csv(csv)
    end
    assert_equal "Currently Pachube can only accept csv for your most recent set of values. You have submitted 2 rows of data.", exception.message
  end

  test "should parse and return Environment object with datastreams" do
    csv = "20,10n5,fsa,432,6"
    environment = CsvParserV1.make_environment_from_csv(csv)
    assert_equal 5, environment.datastreams.length
    csv.split(',').each_with_index do |value, index|
      assert_nil environment.datastreams[index].identifier
      assert_equal value, environment.datastreams[index].value
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eeml-0.0.25 test/test_csv_parser_v1.rb
eeml-0.0.24 test/test_csv_parser_v1.rb
eeml-0.0.23 test/test_csv_parser_v1.rb
eeml-0.0.22 test/test_csv_parser_v1.rb