Skip to content

Commit 4e1a576

Browse files
authored
Merge pull request #1029 from suketa/fix-bind-with-time-test
Fix rubocop offenses in test_bind_with_time
2 parents c49c324 + 1e9ee2f commit 4e1a576

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/duckdb_test/prepared_statement_test.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,22 +800,36 @@ def test_bind_with_varchar
800800
end
801801

802802
def test_bind_with_time
803-
now = Time.now
804803
stmt = DuckDB::PreparedStatement.new(@con, 'SELECT * FROM a WHERE col_timestamp = $1')
805804

806805
stmt.bind(1, Time.mktime(2019, 11, 9, 12, 34, 56, 0))
807806

808807
assert_equal(expected_row, stmt.execute.each.first)
808+
end
809+
810+
def test_bind_with_time_microseconds
811+
stmt = DuckDB::PreparedStatement.new(@con, 'SELECT * FROM a WHERE col_timestamp = $1')
809812

810813
stmt.bind(1, Time.mktime(2019, 11, 9, 12, 34, 56, 123_456))
811814

812815
assert_nil(stmt.execute.each.first)
816+
end
817+
818+
def test_bind_with_time_now
819+
now = Time.now
820+
stmt = DuckDB::PreparedStatement.new(@con, 'SELECT * FROM a WHERE col_timestamp = $1')
813821

814822
@con.query("UPDATE a SET col_timestamp = '#{now.strftime('%Y/%m/%d %H:%M:%S.%N')}'")
815823
stmt.bind(1, now)
816824

817825
assert_equal(1, stmt.execute.each.first.first)
826+
end
827+
828+
def test_bind_with_time_string
829+
now = Time.now
830+
stmt = DuckDB::PreparedStatement.new(@con, 'SELECT * FROM a WHERE col_timestamp = $1')
818831

832+
@con.query("UPDATE a SET col_timestamp = '#{now.strftime('%Y/%m/%d %H:%M:%S.%N')}'")
819833
stmt.bind(1, now.strftime('%Y/%m/%d %H:%M:%S') + ".#{now.nsec + 1_000_000}")
820834

821835
assert_nil(stmt.execute.each.first)

0 commit comments

Comments
 (0)