Skip to content

Commit 5b2fb49

Browse files
committed
Add docs for assert_not TestCase aliases
Previously, these could be found in the Testing guide, but not in the api documentation. The assert_raise alias was moved to ActiveSupport::Testing::Assertions because that is where assert_raises is defined (and rdoc handles that case). The Minitest aliases are not easily handled by rdoc, so they are written by hand. We could copy the documentation for the aliased methods here, but linking to them seems sufficient.
1 parent 32819c5 commit 5b2fb49

File tree

2 files changed

+130
-2
lines changed

2 files changed

+130
-2
lines changed

activesupport/lib/active_support/test_case.rb

Lines changed: 129 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,147 @@ def parallelize_teardown(&block)
134134
include ActiveSupport::Testing::FileFixtures
135135
extend ActiveSupport::Testing::Declarative
136136

137-
# test/unit backwards compatibility methods
138-
alias :assert_raise :assert_raises
137+
##
138+
# :method: assert_not_empty
139+
#
140+
# :call-seq:
141+
# assert_not_empty(obj, msg = nil)
142+
#
143+
# Alias for: refute_empty[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_empty]
144+
145+
#
139146
alias :assert_not_empty :refute_empty
147+
148+
##
149+
# :method: assert_not_equal
150+
#
151+
# :call-seq:
152+
# assert_not_equal(exp, act, msg = nil)
153+
#
154+
# Alias for: refute_equal[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_equal]
155+
156+
#
140157
alias :assert_not_equal :refute_equal
158+
159+
##
160+
# :method: assert_not_in_delta
161+
#
162+
# :call-seq:
163+
# assert_not_in_delta(exp, act, delta = 0.001, msg = nil)
164+
#
165+
# Alias for: refute_in_delta[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_in_delta]
166+
167+
#
141168
alias :assert_not_in_delta :refute_in_delta
169+
170+
##
171+
# :method: assert_not_in_epsilon
172+
#
173+
# :call-seq:
174+
# assert_not_in_epsilon(a, b, epsilon = 0.001, msg = nil)
175+
#
176+
# Alias for: refute_in_epsilon[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_in_epsilon]
177+
178+
#
142179
alias :assert_not_in_epsilon :refute_in_epsilon
180+
181+
##
182+
# :method: assert_not_includes
183+
#
184+
# :call-seq:
185+
# assert_not_includes(collection, obj, msg = nil)
186+
#
187+
# Alias for: refute_includes[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_includes]
188+
189+
#
143190
alias :assert_not_includes :refute_includes
191+
192+
##
193+
# :method: assert_not_instance_of
194+
#
195+
# :call-seq:
196+
# assert_not_instance_of(cls, obj, msg = nil)
197+
#
198+
# Alias for: refute_instance_of[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_instance_of]
199+
200+
#
144201
alias :assert_not_instance_of :refute_instance_of
202+
203+
##
204+
# :method: assert_not_kind_of
205+
#
206+
# :call-seq:
207+
# assert_not_kind_of(cls, obj, msg = nil)
208+
#
209+
# Alias for: refute_kind_of[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_kind_of]
210+
211+
#
145212
alias :assert_not_kind_of :refute_kind_of
213+
214+
##
215+
# :method: assert_no_match
216+
#
217+
# :call-seq:
218+
# assert_no_match(matcher, obj, msg = nil)
219+
#
220+
# Alias for: refute_match[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_match]
221+
222+
#
146223
alias :assert_no_match :refute_match
224+
225+
##
226+
# :method: assert_not_nil
227+
#
228+
# :call-seq:
229+
# assert_not_nil(obj, msg = nil)
230+
#
231+
# Alias for: refute_nil[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_nil]
232+
233+
#
147234
alias :assert_not_nil :refute_nil
235+
236+
##
237+
# :method: assert_not_operator
238+
#
239+
# :call-seq:
240+
# assert_not_operator(o1, op, o2 = UNDEFINED, msg = nil)
241+
#
242+
# Alias for: refute_operator[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_operator]
243+
244+
#
148245
alias :assert_not_operator :refute_operator
246+
247+
##
248+
# :method: assert_not_predicate
249+
#
250+
# :call-seq:
251+
# assert_not_predicate(o1, op, msg = nil)
252+
#
253+
# Alias for: refute_predicate[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_predicate]
254+
255+
#
149256
alias :assert_not_predicate :refute_predicate
257+
258+
##
259+
# :method: assert_not_respond_to
260+
#
261+
# :call-seq:
262+
# assert_not_respond_to(obj, meth, msg = nil)
263+
#
264+
# Alias for: refute_respond_to[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_respond_to]
265+
266+
#
150267
alias :assert_not_respond_to :refute_respond_to
268+
269+
##
270+
# :method: assert_not_same
271+
#
272+
# :call-seq:
273+
# assert_not_same(exp, act, msg = nil)
274+
#
275+
# Alias for: refute_same[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_same]
276+
277+
#
151278
alias :assert_not_same :refute_same
152279

153280
ActiveSupport.run_load_hooks(:active_support_test_case, self)

activesupport/lib/active_support/testing/assertions.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def assert_raises(*exp, match: nil, &block)
3636
assert_match(match, error.message) if match
3737
error
3838
end
39+
alias :assert_raise :assert_raises
3940

4041
# Assertion that the block should not raise an exception.
4142
#

0 commit comments

Comments
 (0)