Merge pull request #45216 from yahonda/rubocop_minitest_020_enables_skip_ensure_cop

Do not run tests that have `ensure` instead of `skip`
This commit is contained in:
Yasuo Honda 2022-09-21 08:09:32 +09:00 committed by GitHub
commit 859af30e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 77 deletions

View File

@ -423,9 +423,8 @@ module ActiveRecord
rd.close
end
if current_adapter?(:SQLite3Adapter)
def test_pool_from_any_process_for_uses_most_recent_spec
skip unless current_adapter?(:SQLite3Adapter)
file = Tempfile.new "lol.sqlite3"
rd, wr = IO.pipe
@ -461,3 +460,4 @@ module ActiveRecord
end
end
end
end

View File

@ -565,9 +565,9 @@ class QueryCacheTest < ActiveRecord::TestCase
}.call({})
end
# with in memory db, reading role won't be able to see database on writing role
unless in_memory_db?
def test_clear_query_cache_is_called_on_all_connections
skip "with in memory db, reading role won't be able to see database on writing role" if in_memory_db?
ActiveRecord::Base.connected_to(role: :reading) do
db_config = ActiveRecord::Base.configurations.configs_for(env_name: "arunit", name: "primary")
ActiveRecord::Base.establish_connection(db_config)
@ -597,6 +597,7 @@ class QueryCacheTest < ActiveRecord::TestCase
ensure
clean_up_connection_handler
end
end
test "query cache is enabled in threads with shared connection" do
ActiveRecord::Base.connection_pool.lock_thread = true

View File

@ -18,8 +18,8 @@ module ConsoleHelpers
assert_includes output, expected, "#{expected.inspect} expected, but got:\n\n#{output}"
end
end
def available_pty?
defined?(PTY) && PTY.respond_to?(:open)
end
end

View File

@ -30,9 +30,8 @@ class Rails::Engine::CommandsTest < ActiveSupport::TestCase
assert_equal "test", output.strip
end
if available_pty?
def test_console_command_work_inside_engine
skip "PTY unavailable" unless available_pty?
primary, replica = PTY.open
cmd = "console --singleline"
spawn_command(cmd, replica)
@ -42,8 +41,6 @@ class Rails::Engine::CommandsTest < ActiveSupport::TestCase
end
def test_dbconsole_command_work_inside_engine
skip "PTY unavailable" unless available_pty?
primary, replica = PTY.open
spawn_command("dbconsole", replica)
assert_output("sqlite>", primary)
@ -52,14 +49,13 @@ class Rails::Engine::CommandsTest < ActiveSupport::TestCase
end
def test_server_command_work_inside_engine
skip "PTY unavailable" unless available_pty?
primary, replica = PTY.open
pid = spawn_command("server", replica)
assert_output("Listening on", primary)
ensure
kill(pid)
end
end
private
def plugin_path