stop adding singleton methods to the SQLite3 connection
This commit is contained in:
parent
6828ae7779
commit
46c57ec4d9
@ -21,8 +21,8 @@ def setup
|
||||
)
|
||||
eosql
|
||||
|
||||
@conn.extend(LogIntercepter)
|
||||
@conn.intercepted = true
|
||||
@subscriber = SQLSubscriber.new
|
||||
ActiveSupport::Notifications.subscribe('sql.active_record', @subscriber)
|
||||
end
|
||||
|
||||
def test_valid_column
|
||||
@ -31,16 +31,16 @@ def test_valid_column
|
||||
end
|
||||
|
||||
# sqlite databases should be able to support any type and not
|
||||
# just the ones mentioned in the native_database_types.
|
||||
# Therefore test_invalid column should always return true
|
||||
# just the ones mentioned in the native_database_types.
|
||||
# Therefore test_invalid column should always return true
|
||||
# even if the type is not valid.
|
||||
def test_invalid_column
|
||||
assert @conn.valid_type?(:foobar)
|
||||
end
|
||||
|
||||
def teardown
|
||||
@conn.intercepted = false
|
||||
@conn.logged = []
|
||||
ActiveSupport::Notifications.unsubscribe(@subscriber)
|
||||
super
|
||||
end
|
||||
|
||||
def test_column_types
|
||||
@ -256,7 +256,7 @@ def test_tables
|
||||
def test_tables_logs_name
|
||||
assert_logged [['SCHEMA', []]] do
|
||||
@conn.tables('hello')
|
||||
assert_not_nil @conn.logged.first.shift
|
||||
assert_not_nil @subscriber.logged.first.shift
|
||||
end
|
||||
end
|
||||
|
||||
@ -268,7 +268,7 @@ def test_indexes_logs_name
|
||||
|
||||
def test_table_exists_logs_name
|
||||
assert @conn.table_exists?('items')
|
||||
assert_equal 'SCHEMA', @conn.logged[0][1]
|
||||
assert_equal 'SCHEMA', @subscriber.logged[0][1]
|
||||
end
|
||||
|
||||
def test_columns
|
||||
@ -306,10 +306,10 @@ def test_columns_with_not_null
|
||||
end
|
||||
|
||||
def test_indexes_logs
|
||||
assert_difference('@conn.logged.length') do
|
||||
assert_difference('@subscriber.logged.length') do
|
||||
@conn.indexes('items')
|
||||
end
|
||||
assert_match(/items/, @conn.logged.last.first)
|
||||
assert_match(/items/, @subscriber.logged.last.first)
|
||||
end
|
||||
|
||||
def test_no_indexes
|
||||
@ -370,7 +370,7 @@ def test_respond_to_disable_extension
|
||||
|
||||
def assert_logged logs
|
||||
yield
|
||||
assert_equal logs, @conn.logged
|
||||
assert_equal logs, @subscriber.logged
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user