minitest-rails 5.1.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -2
  3. data/README.md +47 -6
  4. data/lib/generators/minitest/controller/controller_generator.rb +2 -0
  5. data/lib/generators/minitest/controller/templates/functional_spec.rb.tt +2 -2
  6. data/lib/generators/minitest/controller/templates/functional_test.rb.tt +1 -1
  7. data/lib/generators/minitest/generator/generator_generator.rb +4 -2
  8. data/lib/generators/minitest/generator/templates/generator_spec.rb.tt +2 -2
  9. data/lib/generators/minitest/install/install_generator.rb +1 -0
  10. data/lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt +25 -0
  11. data/lib/generators/minitest/install/templates/test/test_helper.rb.tt +14 -6
  12. data/lib/generators/minitest/integration/templates/integration_spec.rb.tt +1 -1
  13. data/lib/generators/minitest/integration/templates/integration_test.rb.tt +1 -1
  14. data/lib/generators/minitest/job/templates/unit_spec.rb.tt +1 -1
  15. data/lib/generators/minitest/job/templates/unit_test.rb.tt +1 -1
  16. data/lib/generators/minitest/mailer/templates/functional_test.rb.tt +1 -1
  17. data/lib/generators/minitest/model/templates/unit_test.rb.tt +1 -1
  18. data/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt +1 -1
  19. data/lib/generators/minitest/scaffold/scaffold_generator.rb +9 -4
  20. data/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt +3 -3
  21. data/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt +3 -3
  22. data/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt +5 -5
  23. data/lib/generators/minitest/scaffold/templates/functional_test.rb.tt +5 -5
  24. data/lib/generators/minitest/scaffold/templates/system_spec.rb.tt +10 -12
  25. data/lib/generators/minitest/scaffold/templates/system_test.rb.tt +6 -8
  26. data/lib/generators/minitest/system/templates/system_spec.rb.tt +3 -4
  27. data/lib/generators/minitest/system/templates/system_test.rb.tt +2 -3
  28. data/lib/generators/minitest.rb +1 -1
  29. data/lib/minitest/rails/assertions/action_cable.rb +232 -0
  30. data/lib/minitest/rails/assertions/action_mailer.rb +42 -4
  31. data/lib/minitest/rails/assertions/active_job.rb +5 -0
  32. data/lib/minitest/rails/assertions/active_support.rb +4 -4
  33. data/lib/minitest/rails/assertions.rb +1 -0
  34. data/lib/minitest/rails/capybara.rb +1 -0
  35. data/lib/minitest/rails/expectations/action_cable.rb +197 -0
  36. data/lib/minitest/rails/expectations/action_mailer.rb +43 -4
  37. data/lib/minitest/rails/expectations/active_job.rb +4 -0
  38. data/lib/minitest/rails/expectations/active_support.rb +4 -4
  39. data/lib/minitest/rails/expectations.rb +1 -0
  40. data/lib/minitest/rails/parallelize.rb +41 -0
  41. data/lib/minitest/rails/version.rb +1 -1
  42. data/lib/minitest/rails.rb +44 -8
  43. metadata +26 -21
@@ -12,7 +12,7 @@ module Minitest
12
12
  # end }.must_change "User.count", from: 5, to: 8
13
13
  #
14
14
  # See also ActiveSupport::TestCase#assert_difference
15
- # See https://api.rubyonrails.org/v5.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes
15
+ # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_changes
16
16
  #
17
17
  # :method: must_change
18
18
  # :args: expression, from: UNTRACKED, to: UNTRACKED
@@ -27,7 +27,7 @@ module Minitest
27
27
  # end
28
28
  #
29
29
  # See also ActiveSupport::TestCase#assert_difference
30
- # See https://api.rubyonrails.org/v5.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes
30
+ # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_changes
31
31
  #
32
32
  # :method: wont_change
33
33
  # :args: expression
@@ -43,7 +43,7 @@ module Minitest
43
43
  # end }.must_differ "User.count", 3
44
44
  #
45
45
  # See also ActiveSupport::TestCase#assert_difference
46
- # See https://api.rubyonrails.org/v5.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference
46
+ # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference
47
47
  #
48
48
  # :method: must_differ
49
49
  # :args: expression, *args
@@ -56,7 +56,7 @@ module Minitest
56
56
  # value { User.new }.wont_differ "User.count"
57
57
  #
58
58
  # See also ActiveSupport::TestCase#refute_difference
59
- # See https://api.rubyonrails.org/v5.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference
59
+ # See https://api.rubyonrails.org/v7.1/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_no_difference
60
60
  #
61
61
  # :method: wont_differ
62
62
  # :args: expression
@@ -1,4 +1,5 @@
1
1
  require "minitest/rails/expectations/active_support"
2
2
  require "minitest/rails/expectations/action_dispatch"
3
3
  require "minitest/rails/expectations/active_job" if defined? ActiveJob
4
+ require "minitest/rails/expectations/action_cable" if defined? ActionCable
4
5
  require "minitest/rails/expectations/action_mailer" if defined? ActionMailer
@@ -0,0 +1,41 @@
1
+ require "pathname"
2
+ require "rails"
3
+
4
+ # :stopdoc:
5
+
6
+ ##
7
+ # These changes are here to support the spec DSL when using Rails parallelize.
8
+ # The issue is the spec DSL creates Class objects that are not assigned to
9
+ # a Ruby constant. When those Class objects are passed through Drb they are
10
+ # wrapped in a DrbObject and cannot be run. The solution is to assign each Class
11
+ # object to a constant. Hopefully the constant name is consistent enough that
12
+ # the constant can be passed across processes (or even machines).
13
+
14
+ module Minitest
15
+ module Rails
16
+ ##
17
+ # This module is a placeholder for all the Test classes created using the
18
+ # spec DSL. Normally all classes are created but not assigned to a constant.
19
+ # This module is where constants will be created for these classes.
20
+ module SpecTests # :nodoc:
21
+ end
22
+ end
23
+ end
24
+
25
+ module Kernel # :nodoc:
26
+ alias describe_before_minitest_spec_constant_fix describe
27
+ private :describe_before_minitest_spec_constant_fix
28
+ def describe *args, &block
29
+ cls = describe_before_minitest_spec_constant_fix(*args, &block)
30
+ cls_const = "Test__#{cls.name.to_s.split(/\W/).reject(&:empty?).join('_'.freeze)}"
31
+ if block.source_location
32
+ source_path, line_num = block.source_location
33
+ source_path = Pathname.new(File.expand_path(source_path)).relative_path_from(Rails.root).to_s
34
+ source_path = source_path.split(/\W/).reject(&:empty?).join("_".freeze)
35
+ cls_const += "__#{source_path}__#{line_num}"
36
+ end
37
+ cls_const += "_1" while Minitest::Rails::SpecTests.const_defined? cls_const
38
+ Minitest::Rails::SpecTests.const_set cls_const, cls
39
+ cls
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Rails
3
- VERSION = "5.1.0".freeze
3
+ VERSION = "7.1.0".freeze
4
4
  end
5
5
  end
@@ -92,17 +92,47 @@ class ActionDispatch::IntegrationTest
92
92
  end
93
93
  end
94
94
 
95
- # TODO: Rails::Generators::TestCase require?
95
+ if defined? Rails::Generators
96
+ require "rails/generators/test_unit"
96
97
 
97
- class Rails::Generators::TestCase
98
- # Use R::G::TC for the base class when describing a generator
99
- register_spec_type(self) do |desc|
100
- desc < Rails::Generators::Base if desc.is_a?(Class)
98
+ class Rails::Generators::TestCase
99
+ # Use R::G::TC for the base class when describing a generator
100
+ register_spec_type(self) do |desc|
101
+ desc < Rails::Generators::Base if desc.is_a?(Class)
102
+ end
103
+
104
+ # Use R::G::TC for the base class when described using :generator
105
+ register_spec_type(self) do |_desc, *addl|
106
+ addl.include? :generator
107
+ end
101
108
  end
109
+ end
102
110
 
103
- # Use R::G::TC for the base class when described using :generator
104
- register_spec_type(self) do |_desc, *addl|
105
- addl.include? :generator
111
+ if defined? ActionCable
112
+ # TODO: require?
113
+
114
+ class ActionCable::Channel::TestCase
115
+ # Use AC::Ch::TC for the base class when describing a channel
116
+ register_spec_type(self) do |desc|
117
+ desc < ActionCable::Channel::Base if desc.is_a?(Class)
118
+ end
119
+
120
+ # Use AC::Ch::TC for the base class when described using :channel
121
+ register_spec_type(self) do |_desc, *addl|
122
+ addl.include? :channel
123
+ end
124
+ end
125
+
126
+ class ActionCable::Connection::TestCase
127
+ # Use AC::Co::TC for the base class when describing a connection
128
+ register_spec_type(self) do |desc|
129
+ desc < ActionCable::Connection::Base if desc.is_a?(Class)
130
+ end
131
+
132
+ # Use AC::Co::TC for the base class when described using :connection
133
+ register_spec_type(self) do |_desc, *addl|
134
+ addl.include? :connection
135
+ end
106
136
  end
107
137
  end
108
138
 
@@ -113,6 +143,12 @@ end
113
143
  require "minitest/rails/assertions"
114
144
  require "minitest/rails/expectations"
115
145
 
146
+ ################################################################################
147
+ # Support Rails parallelize
148
+ ################################################################################
149
+
150
+ require "minitest/rails/parallelize"
151
+
116
152
  # :stopdoc:
117
153
 
118
154
  ################################################################################
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-18 00:00:00.000000000 Z
11
+ date: 2023-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.10'
19
+ version: '5.20'
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.10'
26
+ version: '5.20'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.1.0
33
+ version: 7.1.0
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.1.0
40
+ version: 7.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest-autotest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '1.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
54
+ version: '1.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest-focus
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: '1.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.1'
68
+ version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest-rg
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '6.0'
89
+ version: '6.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '6.0'
96
+ version: '6.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.64.0
103
+ version: 1.57.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.64.0
110
+ version: 1.57.0
111
111
  description: Adds Minitest as the default testing library in Rails
112
112
  email:
113
113
  - mike@blowmage.com
@@ -129,6 +129,7 @@ files:
129
129
  - lib/generators/minitest/helper/helper_generator.rb
130
130
  - lib/generators/minitest/install/install_generator.rb
131
131
  - lib/generators/minitest/install/templates/test/application_system_test_case.rb.tt
132
+ - lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt
132
133
  - lib/generators/minitest/install/templates/test/test_helper.rb.tt
133
134
  - lib/generators/minitest/integration/integration_generator.rb
134
135
  - lib/generators/minitest/integration/templates/integration_spec.rb.tt
@@ -161,6 +162,7 @@ files:
161
162
  - lib/minitest-rails.rb
162
163
  - lib/minitest/rails.rb
163
164
  - lib/minitest/rails/assertions.rb
165
+ - lib/minitest/rails/assertions/action_cable.rb
164
166
  - lib/minitest/rails/assertions/action_dispatch.rb
165
167
  - lib/minitest/rails/assertions/action_mailer.rb
166
168
  - lib/minitest/rails/assertions/action_view.rb
@@ -168,17 +170,20 @@ files:
168
170
  - lib/minitest/rails/assertions/active_support.rb
169
171
  - lib/minitest/rails/capybara.rb
170
172
  - lib/minitest/rails/expectations.rb
173
+ - lib/minitest/rails/expectations/action_cable.rb
171
174
  - lib/minitest/rails/expectations/action_dispatch.rb
172
175
  - lib/minitest/rails/expectations/action_mailer.rb
173
176
  - lib/minitest/rails/expectations/active_job.rb
174
177
  - lib/minitest/rails/expectations/active_support.rb
178
+ - lib/minitest/rails/parallelize.rb
175
179
  - lib/minitest/rails/railtie.rb
176
180
  - lib/minitest/rails/version.rb
177
- homepage: http://blowmage.com/minitest-rails
181
+ homepage: http://minitest.github.io/minitest-rails/
178
182
  licenses:
179
183
  - MIT
180
- metadata: {}
181
- post_install_message:
184
+ metadata:
185
+ rubygems_mfa_required: 'true'
186
+ post_install_message:
182
187
  rdoc_options: []
183
188
  require_paths:
184
189
  - lib
@@ -186,15 +191,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
191
  requirements:
187
192
  - - ">="
188
193
  - !ruby/object:Gem::Version
189
- version: 2.3.0
194
+ version: 2.7.0
190
195
  required_rubygems_version: !ruby/object:Gem::Requirement
191
196
  requirements:
192
197
  - - ">="
193
198
  - !ruby/object:Gem::Version
194
199
  version: '0'
195
200
  requirements: []
196
- rubygems_version: 3.0.3
197
- signing_key:
201
+ rubygems_version: 3.4.12
202
+ signing_key:
198
203
  specification_version: 4
199
204
  summary: Minitest integration for Rails
200
205
  test_files: []