aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/erb.rb4
-rw-r--r--railties/lib/rails/test_help.rb13
-rw-r--r--railties/lib/rails/test_unit/minitest_plugin.rb12
-rw-r--r--railties/lib/rails/test_unit/test_requirer.rb7
-rw-r--r--railties/lib/rails/test_unit/testing.rake10
5 files changed, 21 insertions, 25 deletions
diff --git a/railties/lib/rails/generators/erb.rb b/railties/lib/rails/generators/erb.rb
index d5e326d6ee..97d9ab29d4 100644
--- a/railties/lib/rails/generators/erb.rb
+++ b/railties/lib/rails/generators/erb.rb
@@ -17,8 +17,8 @@ module Erb # :nodoc:
:erb
end
- def filename_with_extensions(name, format = self.format)
- [name, format, handler].compact.join(".")
+ def filename_with_extensions(name, file_format = format)
+ [name, file_format, handler].compact.join(".")
end
end
end
diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb
index 8e290239bd..0f9bf98737 100644
--- a/railties/lib/rails/test_help.rb
+++ b/railties/lib/rails/test_help.rb
@@ -11,10 +11,6 @@ require "rails/generators/test_case"
require "active_support/testing/autorun"
-if defined?(Capybara) && defined?(Puma)
- require "action_dispatch/system_test_case"
-end
-
if defined?(ActiveRecord::Base)
ActiveRecord::Migration.maintain_test_schema!
@@ -48,12 +44,3 @@ class ActionDispatch::IntegrationTest
super
end
end
-
-if defined?(Capybara) && defined?(Puma)
- class ActionDispatch::SystemTestCase
- def before_setup # :nodoc:
- @routes = Rails.application.routes
- super
- end
- end
-end
diff --git a/railties/lib/rails/test_unit/minitest_plugin.rb b/railties/lib/rails/test_unit/minitest_plugin.rb
index e44fe78bbd..8decdb0f4f 100644
--- a/railties/lib/rails/test_unit/minitest_plugin.rb
+++ b/railties/lib/rails/test_unit/minitest_plugin.rb
@@ -62,9 +62,9 @@ module Minitest
options[:patterns] = opts.order! unless run_via.rake?
end
- def self.rake_run(patterns) # :nodoc:
+ def self.rake_run(patterns, exclude_patterns = []) # :nodoc:
self.run_via = :rake unless run_via.set?
- ::Rails::TestRequirer.require_files(patterns)
+ ::Rails::TestRequirer.require_files(patterns, exclude_patterns)
autorun
end
@@ -88,7 +88,13 @@ module Minitest
# If run via `ruby` we've been passed the files to run directly, or if run
# via `rake` then they have already been eagerly required.
unless run_via.ruby? || run_via.rake?
- ::Rails::TestRequirer.require_files(options[:patterns])
+ # If there are no given patterns, we can assume that the user
+ # simply runs the `bin/rails test` command without extra arguments.
+ if options[:patterns].empty?
+ ::Rails::TestRequirer.require_files(options[:patterns], ["test/system/**/*"])
+ else
+ ::Rails::TestRequirer.require_files(options[:patterns])
+ end
end
unless options[:full_backtrace] || ENV["BACKTRACE"]
diff --git a/railties/lib/rails/test_unit/test_requirer.rb b/railties/lib/rails/test_unit/test_requirer.rb
index fe35934abc..92e5fcf0bc 100644
--- a/railties/lib/rails/test_unit/test_requirer.rb
+++ b/railties/lib/rails/test_unit/test_requirer.rb
@@ -4,10 +4,13 @@ require "rake/file_list"
module Rails
class TestRequirer # :nodoc:
class << self
- def require_files(patterns)
+ def require_files(patterns, exclude_patterns = [])
patterns = expand_patterns(patterns)
- Rake::FileList[patterns.compact.presence || "test/**/*_test.rb"].to_a.each do |file|
+ file_list = Rake::FileList[patterns.compact.presence || "test/**/*_test.rb"]
+ file_list.exclude(exclude_patterns)
+
+ file_list.to_a.each do |file|
require File.expand_path(file)
end
end
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index 4dde3d3c97..ef19bd7626 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -4,15 +4,15 @@ require "rails/test_unit/minitest_plugin"
task default: :test
-desc "Runs all tests in test folder"
+desc "Runs all tests in test folder except system ones"
task :test do
$: << "test"
- pattern = if ENV.key?("TEST")
- ENV["TEST"]
+
+ if ENV.key?("TEST")
+ Minitest.rake_run([ENV["TEST"]])
else
- "test"
+ Minitest.rake_run(["test"], ["test/system/**/*"])
end
- Minitest.rake_run([pattern])
end
namespace :test do