Sha256: d9f8fc2590abe91fcdf350e778fc871cf57726d2d72e5e3661386d791c0610fc
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
require 'test/unit' require 'time' class TestTimeStamp < Test::Unit::TestCase include Marjoree def setup @timestamp = '2006-09-22 11:31:35.923' $db.do( "CREATE TABLE TEST_TABLE( time DATETIME NOT NULL )" ) $db.do( "INSERT INTO TEST_TABLE ( time ) VALUES( '#{@timestamp}' )" ) end def test_timestamp_correct expected = ExpectedResultSet.new expected.columns = [:time] expected.rows << [ODBC::TimeStamp.new( @timestamp )] result_set = select "TEST_TABLE" assert_results( expected, result_set) end def test_timestamp_incorrect expected = ExpectedResultSet.new expected.columns = [:time] expected.rows << [ODBC::TimeStamp.new( '2006-09-23' )] result_set = select "TEST_TABLE" assert_not_equal_results( expected, result_set) end def test_timestamp_formatting time_text = '2006-09-22 11:31:35' testee = ODBC::TimeStamp.new( time_text ) assert_equal( time_text, testee.to_s ) time_text = '2006-09-22 11:31:35.923' testee = ODBC::TimeStamp.new( time_text ) assert_equal( time_text, testee.to_s ) end def test_from_date date = Time.parse '10/10/06 15:30:35' testee = ODBC::TimeStamp.from_date(date) assert_equal '2006-10-10 00:00:00', testee.to_s end def test_from_time time = Time.parse '10/10/06 15:30:35' testee = ODBC::TimeStamp.from_time(time) assert_equal '2006-10-10 15:30:35', testee.to_s end def teardown $db.do( "DROP TABLE TEST_TABLE" ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marjoree-0.0.9 | ./tests/marjoree/test_time_stamp.rb |