test/tc_row.rb in fastercsv-1.2.3 vs test/tc_row.rb in fastercsv-1.4.0
- old
+ new
@@ -283,6 +283,23 @@
def test_array_delegation
assert(!@row.empty?, "Row was empty.")
assert_equal([@row.headers.size, @row.fields.size].max, @row.size)
end
+
+ def test_inspect_shows_header_field_pairs
+ str = @row.inspect
+ @row.each do |header, field|
+ assert( str.include?("#{header.inspect}:#{field.inspect}"),
+ "Header field pair not found." )
+ end
+ end
+
+ def test_inspect_shows_symbol_headers_as_bare_attributes
+ str = FasterCSV::Row.new( @row.headers.map { |h| h.to_sym },
+ @row.fields ).inspect
+ @row.each do |header, field|
+ assert( str.include?("#{header}:#{field.inspect}"),
+ "Header field pair not found." )
+ end
+ end
end