class TestToCsv

Public Instance Methods

setup() click to toggle source
# File test/test_to_csv.rb, line 8
def setup
  @parser = Class.new(CSVobj)
end
teardown() click to toggle source
# File test/test_to_csv.rb, line 12
def teardown
  @parser = nil 
end
test_one_object_sans_headers() click to toggle source
# File test/test_to_csv.rb, line 16
def test_one_object_sans_headers
  s = "foo,bar,baz\n1,2,3\n"
  objs = @parser.parse(s)
  assert_equal(1, objs.size)
  assert_equal("1,2,3\n", objs.first.to_s)
end
test_one_object_with_headers() click to toggle source
# File test/test_to_csv.rb, line 23
def test_one_object_with_headers
  s = "foo,bar,baz\n1,2,3\n"
  objs = @parser.parse(s)
  assert_equal(1, objs.size)
  assert_equal(s, objs.first.to_s_with_headers)
end