class TestToA

Public Instance Methods

setup() click to toggle source
# File test/test_to_a.rb, line 8
def setup
  @parser = Class.new(CSVobj)
end
teardown() click to toggle source
# File test/test_to_a.rb, line 12
def teardown
  @parser = nil 
end
test_one_complete_object() click to toggle source
# File test/test_to_a.rb, line 16
def test_one_complete_object
  s = "foo,bar,baz\n1,2,3\n"
  objs = @parser.parse(s)
  assert_equal(1, objs.size)
  assert_equal(%w[ 1 2 3 ], objs[0].to_a)
end
test_one_object_missing_data_cell() click to toggle source
# File test/test_to_a.rb, line 23
def test_one_object_missing_data_cell
  s = "foo,bar,baz\n1,2\n"
  objs = @parser.parse(s)
  assert_equal(1, objs.size)
  assert_equal([ '1', '2', nil ], objs[0].to_a)
end
test_one_object_missing_header() click to toggle source
# File test/test_to_a.rb, line 30
def test_one_object_missing_header
  s = "foo,bar\n1,2,3\n"
  objs = @parser.parse(s)
  assert_equal(1, objs.size)
  assert_equal(%w[ 1 2 ], objs[0].to_a)
end