@@ -7,6 +7,8 @@ module Rails
7
7
if ::Rails ::VERSION ::STRING >= '4.1.0'
8
8
gem 'minitest'
9
9
require 'minitest/assertions'
10
+ # Constant aliased to either Minitest or TestUnit, depending on what is
11
+ # loaded.
10
12
Assertions = Minitest ::Assertions
11
13
else
12
14
begin
@@ -16,12 +18,13 @@ module Rails
16
18
require 'rubysl-test-unit' if defined? ( RUBY_ENGINE ) && RUBY_ENGINE == 'rbx'
17
19
require 'test/unit/assertions'
18
20
end
21
+ # Constant aliased to either Minitest or TestUnit, depending on what is
22
+ # loaded.
19
23
Assertions = Test ::Unit ::Assertions
20
24
end
21
25
22
- # @api private
26
+ # @private
23
27
class AssertionDelegator < Module
24
- # @api private
25
28
def initialize ( *assertion_modules )
26
29
assertion_class = Class . new ( SimpleDelegator ) do
27
30
include ::RSpec ::Rails ::Assertions
@@ -30,12 +33,10 @@ def initialize(*assertion_modules)
30
33
end
31
34
32
35
super ( ) do
33
- # @api private
34
36
define_method :build_assertion_instance do
35
37
assertion_class . new ( self )
36
38
end
37
39
38
- # @api private
39
40
def assertion_instance
40
41
@assertion_instance ||= build_assertion_instance
41
42
end
@@ -54,7 +55,7 @@ def assertion_instance
54
55
55
56
# Adapts example groups for `Minitest::Test::LifecycleHooks`
56
57
#
57
- # @api private
58
+ # @private
58
59
module MinitestLifecycleAdapter
59
60
extend ActiveSupport ::Concern
60
61
@@ -82,26 +83,22 @@ def after_teardown
82
83
end
83
84
end
84
85
85
- # @api private
86
+ # @private
86
87
module MinitestCounters
87
- # @api private
88
88
def assertions
89
89
@assertions ||= 0
90
90
end
91
91
92
- # @api private
93
92
def assertions = ( assertions )
94
93
@assertions = assertions
95
94
end
96
95
end
97
96
98
- # @api private
97
+ # @private
99
98
module SetupAndTeardownAdapter
100
99
extend ActiveSupport ::Concern
101
100
102
101
module ClassMethods
103
- # @api private
104
- #
105
102
# Wraps `setup` calls from within Rails' testing framework in `before`
106
103
# hooks.
107
104
def setup ( *methods )
@@ -123,7 +120,6 @@ def teardown(*methods)
123
120
end
124
121
end
125
122
126
- # @api private
127
123
def method_name
128
124
@example
129
125
end
@@ -133,9 +129,8 @@ def method_name
133
129
module MinitestAssertionAdapter
134
130
extend ActiveSupport ::Concern
135
131
132
+ # @private
136
133
module ClassMethods
137
- # @api private
138
- #
139
134
# Returns the names of assertion methods that we want to expose to
140
135
# examples without exposing non-assertion methods in Test::Unit or
141
136
# Minitest.
@@ -144,7 +139,6 @@ def assertion_method_names
144
139
[ :build_message ]
145
140
end
146
141
147
- # @api private
148
142
def define_assertion_delegators
149
143
assertion_method_names . each do |m |
150
144
define_method ( m . to_sym ) do |*args , &block |
@@ -154,13 +148,11 @@ def define_assertion_delegators
154
148
end
155
149
end
156
150
157
- # @api private
158
151
class AssertionDelegator
159
152
include ::RSpec ::Rails ::Assertions
160
153
include ::RSpec ::Rails ::MinitestCounters
161
154
end
162
155
163
- # @api private
164
156
def assertion_delegator
165
157
@assertion_delegator ||= AssertionDelegator . new
166
158
end
@@ -173,7 +165,7 @@ def assertion_delegator
173
165
# Backwards compatibility. It's unlikely that anyone is using this
174
166
# constant, but we had forgotten to mark it as `@private` earlier
175
167
#
176
- # @api private
168
+ # @private
177
169
TestUnitAssertionAdapter = MinitestAssertionAdapter
178
170
end
179
171
end
0 commit comments