52d058ceda
This commit implementes `rake test:isolated` for Action Text. While many of modules have `rake test:isolated`, Action Text does not. This could find #46113 in advance. - Usage ``` cd actiontext bundle exec rake test:isolated ``` - It detects #46113 by reverting the merge commit via #46119 ``` $ git revert -m 1 4e7f876 $ bundle exec rake test:isolated /home/yahonda/.rbenv/versions/3.1.2/bin/ruby -w -Ilib -Itest test/integration/controller_render_test.rb ... snip ... E Error: ActionText::ControllerRenderTest#test_renders_as_HTML_when_the_request_format_is_not_HTML: NoMethodError: undefined method `render_to_string' for nil:NilClass (renderer || default_renderer).render_to_string(*args, &block) ^^^^^^^^^^^^^^^^^ test/integration/controller_render_test.rb:19:in `block in <class:ControllerRenderTest>' bin/test test/integration/controller_render_test.rb:17 ``` To run isolated tests at Rails CI, https://github.com/rails/buildkite-config also needs updated.
30 lines
668 B
Ruby
30 lines
668 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "bundler/setup"
|
|
require "bundler/gem_tasks"
|
|
require "rake/testtask"
|
|
|
|
task :package
|
|
|
|
Rake::TestTask.new do |t|
|
|
t.libs << "test"
|
|
t.test_files = FileList["test/**/*_test.rb"].exclude("test/system/**/*", "test/dummy/**/*")
|
|
t.verbose = true
|
|
end
|
|
|
|
Rake::TestTask.new "test:system" do |t|
|
|
t.libs << "test"
|
|
t.test_files = FileList["test/system/**/*_test.rb"]
|
|
t.verbose = true
|
|
end
|
|
|
|
namespace :test do
|
|
task :isolated do
|
|
FileList["test/**/*_test.rb"].exclude("test/system/**/*", "test/dummy/**/*").all? do |file|
|
|
sh(Gem.ruby, "-w", "-Ilib", "-Itest", file)
|
|
end || raise("Failures")
|
|
end
|
|
end
|
|
|
|
task default: :test
|