railties 5.0.4 → 5.0.5.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/minitest/rails_plugin.rb +49 -0
- data/lib/rails/.DS_Store +0 -0
- data/lib/rails/command/.DS_Store +0 -0
- data/lib/rails/commands/.DS_Store +0 -0
- data/lib/rails/commands/generate/.DS_Store +0 -0
- data/lib/rails/commands/test.rb +3 -4
- data/lib/rails/engine/.DS_Store +0 -0
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/test.tt +4 -4
- data/lib/rails/test_help.rb +0 -1
- data/lib/rails/test_unit/line_filtering.rb +2 -68
- data/lib/rails/test_unit/reporter.rb +6 -1
- data/lib/rails/test_unit/runner.rb +138 -0
- data/lib/rails/test_unit/testing.rake +13 -13
- metadata +17 -12
- data/lib/rails/test_unit/minitest_plugin.rb +0 -134
- data/lib/rails/test_unit/test_requirer.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fc8513181d9478eb66b82425938d379d271dd94
|
4
|
+
data.tar.gz: 171241e22916d1cf85d07944acb4476242934531
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ff37e2fb736b9cb9161b091588058a781ba4dbc5465daf11303e6a8a9da222a8df4d4d8e8c1623510f45e1d82226c77fbaa76047414e177259aae3e844cb767
|
7
|
+
data.tar.gz: 4c8b35c7219c6de06e16ced2ca82b972b975152fd0dc42be6a7aa5a17876c4b5dfcbef5dbf6a51991a965b9772e065c013c698c9352a947fc38592f06f29716e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Rails 5.0.5.rc1 (July 19, 2017) ##
|
2
|
+
|
3
|
+
* Make Rails' test runner work better with minitest plugins.
|
4
|
+
|
5
|
+
By demoting the Rails test runner to just another minitest plugin —
|
6
|
+
and thereby not eager loading it — we can co-exist much better with
|
7
|
+
other minitest plugins such as pride and minitest-focus.
|
8
|
+
|
9
|
+
*Kasper Timm Hansen*
|
10
|
+
|
1
11
|
## Rails 5.0.4 (June 19, 2017) ##
|
2
12
|
|
3
13
|
* No changes.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "active_support/core_ext/module/attribute_accessors"
|
2
|
+
require "rails/test_unit/reporter"
|
3
|
+
|
4
|
+
module Minitest
|
5
|
+
class SuppressedSummaryReporter < SummaryReporter
|
6
|
+
# Disable extra failure output after a run if output is inline.
|
7
|
+
def aggregated_results(*)
|
8
|
+
super unless options[:output_inline]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.plugin_rails_options(opts, options)
|
13
|
+
opts.on("-b", "--backtrace", "Show the complete backtrace") do
|
14
|
+
options[:full_backtrace] = true
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on("-d", "--defer-output", "Output test failures and errors after the test run") do
|
18
|
+
options[:output_inline] = false
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("-f", "--fail-fast", "Abort test run on first failure or error") do
|
22
|
+
options[:fail_fast] = true
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-c", "--[no-]color", "Enable color in the output") do |value|
|
26
|
+
options[:color] = value
|
27
|
+
end
|
28
|
+
|
29
|
+
options[:color] = true
|
30
|
+
options[:output_inline] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# Owes great inspiration to test runner trailblazers like RSpec,
|
34
|
+
# minitest-reporters, maxitest and others.
|
35
|
+
def self.plugin_rails_init(options)
|
36
|
+
unless options[:full_backtrace] || ENV["BACKTRACE"]
|
37
|
+
# Plugin can run without Rails loaded, check before filtering.
|
38
|
+
Minitest.backtrace_filter = ::Rails.backtrace_cleaner if ::Rails.respond_to?(:backtrace_cleaner)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Replace progress reporter for colors.
|
42
|
+
reporter.reporters.delete_if { |reporter| reporter.kind_of?(SummaryReporter) || reporter.kind_of?(ProgressReporter) }
|
43
|
+
reporter << SuppressedSummaryReporter.new(options[:io], options)
|
44
|
+
reporter << ::Rails::TestUnitReporter.new(options[:io], options)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Backwardscompatibility with Rails 5.0 generated plugin test scripts
|
48
|
+
mattr_reader(:run_via) { Hash.new }
|
49
|
+
end
|
data/lib/rails/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/rails/commands/test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require "rails/test_unit/
|
1
|
+
require "rails/test_unit/runner"
|
2
2
|
|
3
3
|
if defined?(ENGINE_ROOT)
|
4
4
|
$LOAD_PATH << File.expand_path("test", ENGINE_ROOT)
|
@@ -6,6 +6,5 @@ else
|
|
6
6
|
$LOAD_PATH << File.expand_path("../../test", APP_PATH)
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
require "active_support/testing/autorun"
|
9
|
+
Rails::TestUnit::Runner.parse_options(ARGV)
|
10
|
+
Rails::TestUnit::Runner.run(ARGV)
|
Binary file
|
data/lib/rails/gem_version.rb
CHANGED
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
<%- end -%>
|
9
9
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
10
10
|
|
11
|
-
Rails.application.config.raise_on_unfiltered_parameters = true
|
11
|
+
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
|
12
12
|
<%- unless options[:api] -%>
|
13
13
|
|
14
14
|
# Enable per-form CSRF tokens. Previous versions had false.
|
@@ -1,10 +1,10 @@
|
|
1
1
|
$: << File.expand_path(File.expand_path('../../test', __FILE__))
|
2
2
|
|
3
3
|
require 'bundler/setup'
|
4
|
-
require 'rails/test_unit/
|
4
|
+
require 'rails/test_unit/runner'
|
5
|
+
require 'rails/test_unit/reporter'
|
5
6
|
|
6
7
|
Rails::TestUnitReporter.executable = 'bin/test'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
require "active_support/testing/autorun"
|
9
|
+
Rails::TestUnit::Runner.parse_options(ARGV)
|
10
|
+
Rails::TestUnit::Runner.run(ARGV)
|
data/lib/rails/test_help.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
# so fixtures aren't loaded into that environment
|
3
3
|
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
|
4
4
|
|
5
|
-
require "rails/test_unit/minitest_plugin"
|
6
5
|
require 'active_support/test_case'
|
7
6
|
require 'action_controller'
|
8
7
|
require 'action_controller/test_case'
|
@@ -1,78 +1,12 @@
|
|
1
1
|
require 'method_source'
|
2
|
+
require "rails/test_unit/runner"
|
2
3
|
|
3
4
|
module Rails
|
4
5
|
module LineFiltering # :nodoc:
|
5
6
|
def run(reporter, options = {})
|
6
|
-
|
7
|
-
options[:filter] = \
|
8
|
-
CompositeFilter.new(self, options[:filter], options[:patterns])
|
9
|
-
end
|
7
|
+
options[:filter] = Rails::TestUnit::Runner.compose_filter(self, options[:filter])
|
10
8
|
|
11
9
|
super
|
12
10
|
end
|
13
11
|
end
|
14
|
-
|
15
|
-
class CompositeFilter # :nodoc:
|
16
|
-
attr_reader :named_filter
|
17
|
-
|
18
|
-
def initialize(runnable, filter, patterns)
|
19
|
-
@runnable = runnable
|
20
|
-
@named_filter = derive_named_filter(filter)
|
21
|
-
@filters = [ @named_filter, *derive_line_filters(patterns) ].compact
|
22
|
-
end
|
23
|
-
|
24
|
-
# Minitest uses === to find matching filters.
|
25
|
-
def ===(method)
|
26
|
-
@filters.any? { |filter| filter === method }
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
def derive_named_filter(filter)
|
31
|
-
if filter.respond_to?(:named_filter)
|
32
|
-
filter.named_filter
|
33
|
-
elsif filter =~ %r%/(.*)/% # Regexp filtering copied from Minitest.
|
34
|
-
Regexp.new $1
|
35
|
-
elsif filter.is_a?(String)
|
36
|
-
filter
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def derive_line_filters(patterns)
|
41
|
-
patterns.flat_map do |file_and_line|
|
42
|
-
file, *lines = file_and_line.split(':')
|
43
|
-
|
44
|
-
if lines.empty?
|
45
|
-
Filter.new(@runnable, file, nil) if file
|
46
|
-
else
|
47
|
-
lines.map { |line| Filter.new(@runnable, file, line) }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
class Filter # :nodoc:
|
54
|
-
def initialize(runnable, file, line)
|
55
|
-
@runnable, @file = runnable, File.expand_path(file)
|
56
|
-
@line = line.to_i if line
|
57
|
-
end
|
58
|
-
|
59
|
-
def ===(method)
|
60
|
-
return unless @runnable.method_defined?(method)
|
61
|
-
|
62
|
-
if @line
|
63
|
-
test_file, test_range = definition_for(@runnable.instance_method(method))
|
64
|
-
test_file == @file && test_range.include?(@line)
|
65
|
-
else
|
66
|
-
@runnable.instance_method(method).source_location.first == @file
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
def definition_for(method)
|
72
|
-
file, start_line = method.source_location
|
73
|
-
end_line = method.source.count("\n") + start_line - 1
|
74
|
-
|
75
|
-
return file, start_line..end_line
|
76
|
-
end
|
77
|
-
end
|
78
12
|
end
|
@@ -72,7 +72,12 @@ module Rails
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def app_root
|
75
|
-
@app_root ||=
|
75
|
+
@app_root ||=
|
76
|
+
if defined?(ENGINE_ROOT)
|
77
|
+
ENGINE_ROOT
|
78
|
+
elsif Rails.respond_to?(:root)
|
79
|
+
Rails.root
|
80
|
+
end
|
76
81
|
end
|
77
82
|
|
78
83
|
def colored_output?
|
@@ -0,0 +1,138 @@
|
|
1
|
+
require "shellwords"
|
2
|
+
require "method_source"
|
3
|
+
require "rake/file_list"
|
4
|
+
require "active_support/core_ext/module/attribute_accessors"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module TestUnit
|
8
|
+
class Runner
|
9
|
+
mattr_reader(:filters) { [] }
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def options(opts)
|
13
|
+
opts.on("--warnings", "-w", "Run with Ruby warnings enabled") {}
|
14
|
+
opts.on("--environment", "-e", "Run tests in the ENV environment") {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse_options(argv)
|
18
|
+
# Perform manual parsing and cleanup since option parser raises on unknown options.
|
19
|
+
env_index = argv.index("--environment") || argv.index("-e")
|
20
|
+
if env_index
|
21
|
+
argv.delete_at(env_index)
|
22
|
+
environment = argv.delete_at(env_index).strip
|
23
|
+
end
|
24
|
+
ENV["RAILS_ENV"] = environment || "test"
|
25
|
+
|
26
|
+
w_index = argv.index("--warnings") || argv.index("-w")
|
27
|
+
$VERBOSE = argv.delete_at(w_index) if w_index
|
28
|
+
end
|
29
|
+
|
30
|
+
def rake_run(argv = [])
|
31
|
+
ARGV.replace Shellwords.split(ENV["TESTOPTS"] || "")
|
32
|
+
|
33
|
+
run(argv)
|
34
|
+
end
|
35
|
+
|
36
|
+
def run(argv = [])
|
37
|
+
load_tests(argv)
|
38
|
+
|
39
|
+
require "active_support/testing/autorun"
|
40
|
+
end
|
41
|
+
|
42
|
+
def load_tests(argv)
|
43
|
+
patterns = extract_filters(argv)
|
44
|
+
|
45
|
+
tests = Rake::FileList[patterns.any? ? patterns : "test/**/*_test.rb"]
|
46
|
+
tests.to_a.each { |path| require File.expand_path(path) }
|
47
|
+
end
|
48
|
+
|
49
|
+
def compose_filter(runnable, filter)
|
50
|
+
if filters.any? { |_, lines| lines.any? }
|
51
|
+
CompositeFilter.new(runnable, filter, filters)
|
52
|
+
else
|
53
|
+
filter
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
def extract_filters(argv)
|
59
|
+
argv.select { |arg| arg =~ /^\w+\// }.map do |path|
|
60
|
+
case
|
61
|
+
when path =~ /(:\d+)+$/
|
62
|
+
file, *lines = path.split(":")
|
63
|
+
filters << [ file, lines ]
|
64
|
+
file
|
65
|
+
when Dir.exist?(path)
|
66
|
+
"#{path}/**/*_test.rb"
|
67
|
+
else
|
68
|
+
filters << [ path, [] ]
|
69
|
+
path
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class CompositeFilter # :nodoc:
|
77
|
+
attr_reader :named_filter
|
78
|
+
|
79
|
+
def initialize(runnable, filter, patterns)
|
80
|
+
@runnable = runnable
|
81
|
+
@named_filter = derive_named_filter(filter)
|
82
|
+
@filters = [ @named_filter, *derive_line_filters(patterns) ].compact
|
83
|
+
end
|
84
|
+
|
85
|
+
# Minitest uses === to find matching filters.
|
86
|
+
def ===(method)
|
87
|
+
@filters.any? { |filter| filter === method }
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
def derive_named_filter(filter)
|
92
|
+
if filter.respond_to?(:named_filter)
|
93
|
+
filter.named_filter
|
94
|
+
elsif filter =~ %r%/(.*)/% # Regexp filtering copied from Minitest.
|
95
|
+
Regexp.new $1
|
96
|
+
elsif filter.is_a?(String)
|
97
|
+
filter
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def derive_line_filters(patterns)
|
102
|
+
patterns.flat_map do |file, lines|
|
103
|
+
if lines.empty?
|
104
|
+
Filter.new(@runnable, file, nil) if file
|
105
|
+
else
|
106
|
+
lines.map { |line| Filter.new(@runnable, file, line) }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class Filter # :nodoc:
|
113
|
+
def initialize(runnable, file, line)
|
114
|
+
@runnable, @file = runnable, File.expand_path(file)
|
115
|
+
@line = line.to_i if line
|
116
|
+
end
|
117
|
+
|
118
|
+
def ===(method)
|
119
|
+
return unless @runnable.method_defined?(method)
|
120
|
+
|
121
|
+
if @line
|
122
|
+
test_file, test_range = definition_for(@runnable.instance_method(method))
|
123
|
+
test_file == @file && test_range.include?(@line)
|
124
|
+
else
|
125
|
+
@runnable.instance_method(method).source_location.first == @file
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
def definition_for(method)
|
131
|
+
file, start_line = method.source_location
|
132
|
+
end_line = method.source.count("\n") + start_line - 1
|
133
|
+
|
134
|
+
return file, start_line..end_line
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
gem
|
2
|
-
require
|
3
|
-
|
1
|
+
gem "minitest"
|
2
|
+
require "minitest"
|
3
|
+
require_relative "runner"
|
4
4
|
|
5
5
|
task default: :test
|
6
6
|
|
7
7
|
desc "Runs all tests in test folder"
|
8
8
|
task :test do
|
9
9
|
$: << "test"
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
|
11
|
+
if ENV.key?("TEST")
|
12
|
+
Rails::TestUnit::Runner.rake_run([ENV["TEST"]])
|
13
|
+
else
|
14
|
+
Rails::TestUnit::Runner.rake_run
|
15
|
+
end
|
16
16
|
end
|
17
17
|
|
18
18
|
namespace :test do
|
@@ -29,22 +29,22 @@ namespace :test do
|
|
29
29
|
["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
|
30
30
|
task name => "test:prepare" do
|
31
31
|
$: << "test"
|
32
|
-
|
32
|
+
Rails::TestUnit::Runner.rake_run(["test/#{name}"])
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
task :generators => "test:prepare" do
|
37
37
|
$: << "test"
|
38
|
-
|
38
|
+
Rails::TestUnit::Runner.rake_run(["test/lib/generators"])
|
39
39
|
end
|
40
40
|
|
41
41
|
task :units => "test:prepare" do
|
42
42
|
$: << "test"
|
43
|
-
|
43
|
+
Rails::TestUnit::Runner.rake_run(["test/models", "test/helpers", "test/unit"])
|
44
44
|
end
|
45
45
|
|
46
46
|
task :functionals => "test:prepare" do
|
47
47
|
$: << "test"
|
48
|
-
|
48
|
+
Rails::TestUnit::Runner.rake_run(["test/controllers", "test/mailers", "test/functional"])
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.5.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0.
|
19
|
+
version: 5.0.5.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.0.
|
26
|
+
version: 5.0.5.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.0.
|
33
|
+
version: 5.0.5.rc1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.0.
|
40
|
+
version: 5.0.5.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - '='
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 5.0.
|
95
|
+
version: 5.0.5.rc1
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 5.0.
|
102
|
+
version: 5.0.5.rc1
|
103
103
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
104
104
|
email: david@loudthinking.com
|
105
105
|
executables:
|
@@ -112,7 +112,9 @@ files:
|
|
112
112
|
- RDOC_MAIN.rdoc
|
113
113
|
- README.rdoc
|
114
114
|
- exe/rails
|
115
|
+
- lib/minitest/rails_plugin.rb
|
115
116
|
- lib/rails.rb
|
117
|
+
- lib/rails/.DS_Store
|
116
118
|
- lib/rails/all.rb
|
117
119
|
- lib/rails/api/task.rb
|
118
120
|
- lib/rails/app_loader.rb
|
@@ -127,7 +129,9 @@ files:
|
|
127
129
|
- lib/rails/cli.rb
|
128
130
|
- lib/rails/code_statistics.rb
|
129
131
|
- lib/rails/code_statistics_calculator.rb
|
132
|
+
- lib/rails/command/.DS_Store
|
130
133
|
- lib/rails/commands.rb
|
134
|
+
- lib/rails/commands/.DS_Store
|
131
135
|
- lib/rails/commands/application.rb
|
132
136
|
- lib/rails/commands/commands_tasks.rb
|
133
137
|
- lib/rails/commands/console.rb
|
@@ -135,6 +139,7 @@ files:
|
|
135
139
|
- lib/rails/commands/dbconsole.rb
|
136
140
|
- lib/rails/commands/destroy.rb
|
137
141
|
- lib/rails/commands/generate.rb
|
142
|
+
- lib/rails/commands/generate/.DS_Store
|
138
143
|
- lib/rails/commands/plugin.rb
|
139
144
|
- lib/rails/commands/rake_proxy.rb
|
140
145
|
- lib/rails/commands/runner.rb
|
@@ -145,6 +150,7 @@ files:
|
|
145
150
|
- lib/rails/console/helpers.rb
|
146
151
|
- lib/rails/dev_caching.rb
|
147
152
|
- lib/rails/engine.rb
|
153
|
+
- lib/rails/engine/.DS_Store
|
148
154
|
- lib/rails/engine/commands.rb
|
149
155
|
- lib/rails/engine/commands_tasks.rb
|
150
156
|
- lib/rails/engine/configuration.rb
|
@@ -375,10 +381,9 @@ files:
|
|
375
381
|
- lib/rails/templates/rails/welcome/index.html.erb
|
376
382
|
- lib/rails/test_help.rb
|
377
383
|
- lib/rails/test_unit/line_filtering.rb
|
378
|
-
- lib/rails/test_unit/minitest_plugin.rb
|
379
384
|
- lib/rails/test_unit/railtie.rb
|
380
385
|
- lib/rails/test_unit/reporter.rb
|
381
|
-
- lib/rails/test_unit/
|
386
|
+
- lib/rails/test_unit/runner.rb
|
382
387
|
- lib/rails/test_unit/testing.rake
|
383
388
|
- lib/rails/version.rb
|
384
389
|
- lib/rails/welcome_controller.rb
|
@@ -399,9 +404,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
399
404
|
version: 2.2.2
|
400
405
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
401
406
|
requirements:
|
402
|
-
- - "
|
407
|
+
- - ">"
|
403
408
|
- !ruby/object:Gem::Version
|
404
|
-
version:
|
409
|
+
version: 1.3.1
|
405
410
|
requirements: []
|
406
411
|
rubyforge_project:
|
407
412
|
rubygems_version: 2.6.12
|
@@ -1,134 +0,0 @@
|
|
1
|
-
require "active_support/core_ext/module/attribute_accessors"
|
2
|
-
require "rails/test_unit/reporter"
|
3
|
-
require "rails/test_unit/test_requirer"
|
4
|
-
require 'shellwords'
|
5
|
-
|
6
|
-
module Minitest
|
7
|
-
class SuppressedSummaryReporter < SummaryReporter
|
8
|
-
# Disable extra failure output after a run if output is inline.
|
9
|
-
def aggregated_results(*)
|
10
|
-
super unless options[:output_inline]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.plugin_rails_options(opts, options)
|
15
|
-
executable = ::Rails::TestUnitReporter.executable
|
16
|
-
opts.separator ""
|
17
|
-
opts.separator "Usage: #{executable} [options] [files or directories]"
|
18
|
-
opts.separator "You can run a single test by appending a line number to a filename:"
|
19
|
-
opts.separator ""
|
20
|
-
opts.separator " #{executable} test/models/user_test.rb:27"
|
21
|
-
opts.separator ""
|
22
|
-
opts.separator "You can run multiple files and directories at the same time:"
|
23
|
-
opts.separator ""
|
24
|
-
opts.separator " #{executable} test/controllers test/integration/login_test.rb"
|
25
|
-
opts.separator ""
|
26
|
-
opts.separator "By default test failures and errors are reported inline during a run."
|
27
|
-
opts.separator ""
|
28
|
-
|
29
|
-
opts.separator "Rails options:"
|
30
|
-
opts.on("-e", "--environment ENV",
|
31
|
-
"Run tests in the ENV environment") do |env|
|
32
|
-
options[:environment] = env.strip
|
33
|
-
end
|
34
|
-
|
35
|
-
opts.on("-b", "--backtrace",
|
36
|
-
"Show the complete backtrace") do
|
37
|
-
options[:full_backtrace] = true
|
38
|
-
end
|
39
|
-
|
40
|
-
opts.on("-d", "--defer-output",
|
41
|
-
"Output test failures and errors after the test run") do
|
42
|
-
options[:output_inline] = false
|
43
|
-
end
|
44
|
-
|
45
|
-
opts.on("-f", "--fail-fast",
|
46
|
-
"Abort test run on first failure or error") do
|
47
|
-
options[:fail_fast] = true
|
48
|
-
end
|
49
|
-
|
50
|
-
opts.on("-c", "--[no-]color",
|
51
|
-
"Enable color in the output") do |value|
|
52
|
-
options[:color] = value
|
53
|
-
end
|
54
|
-
|
55
|
-
options[:color] = true
|
56
|
-
options[:output_inline] = true
|
57
|
-
options[:patterns] = opts.order! unless run_via.rake?
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.rake_run(patterns) # :nodoc:
|
61
|
-
self.run_via = :rake unless run_via.set?
|
62
|
-
::Rails::TestRequirer.require_files(patterns)
|
63
|
-
autorun
|
64
|
-
end
|
65
|
-
|
66
|
-
module RunRespectingRakeTestopts
|
67
|
-
def run(args = [])
|
68
|
-
if run_via.rake?
|
69
|
-
args = Shellwords.split(ENV["TESTOPTS"] || "")
|
70
|
-
end
|
71
|
-
|
72
|
-
super
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
singleton_class.prepend RunRespectingRakeTestopts
|
77
|
-
|
78
|
-
# Owes great inspiration to test runner trailblazers like RSpec,
|
79
|
-
# minitest-reporters, maxitest and others.
|
80
|
-
def self.plugin_rails_init(options)
|
81
|
-
ENV["RAILS_ENV"] = options[:environment] || "test"
|
82
|
-
|
83
|
-
# If run via `ruby` we've been passed the files to run directly, or if run
|
84
|
-
# via `rake` then they have already been eagerly required.
|
85
|
-
unless run_via.ruby? || run_via.rake?
|
86
|
-
::Rails::TestRequirer.require_files(options[:patterns])
|
87
|
-
end
|
88
|
-
|
89
|
-
unless options[:full_backtrace] || ENV["BACKTRACE"]
|
90
|
-
# Plugin can run without Rails loaded, check before filtering.
|
91
|
-
Minitest.backtrace_filter = ::Rails.backtrace_cleaner if ::Rails.respond_to?(:backtrace_cleaner)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Replace progress reporter for colors.
|
95
|
-
reporter.reporters.delete_if { |reporter| reporter.kind_of?(SummaryReporter) || reporter.kind_of?(ProgressReporter) }
|
96
|
-
reporter << SuppressedSummaryReporter.new(options[:io], options)
|
97
|
-
reporter << ::Rails::TestUnitReporter.new(options[:io], options)
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.run_via=(runner)
|
101
|
-
if run_via.set?
|
102
|
-
raise ArgumentError, "run_via already assigned"
|
103
|
-
else
|
104
|
-
run_via.runner = runner
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
class RunVia
|
109
|
-
attr_accessor :runner
|
110
|
-
alias set? runner
|
111
|
-
|
112
|
-
# Backwardscompatibility with Rails 5.0 generated plugin test scripts.
|
113
|
-
def []=(runner, *)
|
114
|
-
@runner = runner
|
115
|
-
end
|
116
|
-
|
117
|
-
def ruby?
|
118
|
-
runner == :ruby
|
119
|
-
end
|
120
|
-
|
121
|
-
def rake?
|
122
|
-
runner == :rake
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
mattr_reader(:run_via) { RunVia.new }
|
127
|
-
end
|
128
|
-
|
129
|
-
# Put Rails as the first plugin minitest initializes so other plugins
|
130
|
-
# can override or replace our default reporter setup.
|
131
|
-
# Since minitest only loads plugins if its extensions are empty we have
|
132
|
-
# to call `load_plugins` first.
|
133
|
-
Minitest.load_plugins
|
134
|
-
Minitest.extensions.unshift 'rails'
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/object/blank'
|
2
|
-
require 'rake/file_list'
|
3
|
-
|
4
|
-
module Rails
|
5
|
-
class TestRequirer # :nodoc:
|
6
|
-
class << self
|
7
|
-
def require_files(patterns)
|
8
|
-
patterns = expand_patterns(patterns)
|
9
|
-
|
10
|
-
Rake::FileList[patterns.compact.presence || 'test/**/*_test.rb'].to_a.each do |file|
|
11
|
-
require File.expand_path(file)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
def expand_patterns(patterns)
|
17
|
-
patterns.map do |arg|
|
18
|
-
arg = arg.gsub(/(:\d+)+?$/, '')
|
19
|
-
if Dir.exist?(arg)
|
20
|
-
"#{arg}/**/*_test.rb"
|
21
|
-
else
|
22
|
-
arg
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|