Skip to content

Commit f08d4ef

Browse files
committed
test that we allow nil to be passed into table_exists? (details at #460)
1 parent bbfc0f2 commit f08d4ef

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/arjdbc/db2/as400.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ def execute_and_auto_confirm(sql, name = nil)
9191

9292
# disable all schemas browsing when default schema is specified
9393
def table_exists?(name)
94-
schema ?
95-
@connection.table_exists?(name, schema) :
96-
@connection.table_exists?(name)
94+
return false unless name
95+
schema ? @connection.table_exists?(name, schema) : @connection.table_exists?(name)
9796
end
9897

9998
DRIVER_NAME = 'com.ibm.as400.access.AS400JDBCDriver'.freeze

test/simple.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def test_tables
195195
def test_table_exists?
196196
assert_true ActiveRecord::Base.connection.table_exists? 'entries'
197197
assert_false ActiveRecord::Base.connection.table_exists? 'blahbls'
198+
assert ! ActiveRecord::Base.connection.table_exists?(nil)
198199
end
199200

200201
def test_entries_empty

0 commit comments

Comments
 (0)