mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
150f40998d
When running Active Record MySQL test, this warning is printed in the console: warning: instance variable errno not initialized It turns out that this is a warning from `mysql` gem in MySQL::Error object. However, since the `mysql` gem is no longer maintained, and there won't be a newer version, it make sense for us to just silence this warning to make the output cleaner.
30 lines
730 B
Ruby
30 lines
730 B
Ruby
require "cases/helper"
|
|
|
|
class TestRecord < ActiveRecord::Base
|
|
end
|
|
|
|
class TestDisconnectedAdapter < ActiveRecord::TestCase
|
|
self.use_transactional_tests = false
|
|
|
|
def setup
|
|
@connection = ActiveRecord::Base.connection
|
|
end
|
|
|
|
teardown do
|
|
return if in_memory_db?
|
|
spec = ActiveRecord::Base.connection_config
|
|
ActiveRecord::Base.establish_connection(spec)
|
|
end
|
|
|
|
unless in_memory_db?
|
|
test "can't execute statements while disconnected" do
|
|
@connection.execute "SELECT count(*) from products"
|
|
@connection.disconnect!
|
|
assert_raises(ActiveRecord::StatementInvalid) do
|
|
silence_warnings do
|
|
@connection.execute "SELECT count(*) from products"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|