minitest 4.7.5 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,11 @@
1
1
  require "minitest/parallel_each"
2
2
 
3
- # :stopdoc:
4
- class Minitest::Unit::TestCase
3
+ class Minitest::Test
5
4
  class << self
6
- alias :old_test_order :test_order
5
+ alias :old_test_order :test_order # :nodoc:
7
6
 
8
- def test_order
7
+ def test_order # :nodoc:
9
8
  :parallel
10
9
  end
11
10
  end
12
11
  end
13
- # :startdoc:
@@ -1,11 +1,10 @@
1
1
  class MockExpectationError < StandardError; end # :nodoc:
2
2
 
3
- ##
4
- # A simple and clean mock object framework.
5
-
6
- module MiniTest # :nodoc:
3
+ module Minitest # :nodoc:
7
4
 
8
5
  ##
6
+ # A simple and clean mock object framework.
7
+ #
9
8
  # All mock objects are an instance of Mock
10
9
 
11
10
  class Mock
@@ -4,7 +4,7 @@
4
4
  # so all the goodies come along (tho not all are wrapped yet to
5
5
  # return another ParallelEach instance).
6
6
 
7
- class ParallelEach
7
+ class Minitest::ParallelEach
8
8
  require 'thread'
9
9
  include Enumerable
10
10
 
@@ -23,10 +23,6 @@ class ParallelEach
23
23
  N.times { @queue << nil }
24
24
  end
25
25
 
26
- def grep pattern # :nodoc:
27
- self.class.new super
28
- end
29
-
30
26
  def select(&block) # :nodoc:
31
27
  self.class.new super
32
28
  end
@@ -49,25 +45,76 @@ class ParallelEach
49
45
  threads.map(&:join)
50
46
  end
51
47
 
52
- def count
48
+ def count # :nodoc:
53
49
  [@queue.size - N, 0].max
54
50
  end
55
51
 
56
- alias_method :size, :count
52
+ alias_method :size, :count # :nodoc:
57
53
  end
58
54
 
59
- class MiniTest::Unit
60
- alias _old_run_suites _run_suites
55
+ module Minitest
56
+ class << self
57
+ remove_method :__run
58
+ end
59
+
60
+ class Test
61
+ @mutex = Mutex.new
62
+
63
+ def self.synchronize # :nodoc:
64
+ if @mutex then # see parallel_each.rb
65
+ @mutex.synchronize { yield }
66
+ else
67
+ yield
68
+ end
69
+ end
70
+
71
+ alias :simple_capture_io :capture_io
72
+
73
+ def capture_io(&b)
74
+ Test.synchronize do
75
+ simple_capture_io(&b)
76
+ end
77
+ end
78
+
79
+ alias :simple_capture_subprocess_io :capture_subprocess_io
80
+
81
+ def capture_subprocess_io(&b)
82
+ Test.synchronize do
83
+ simple_capture_subprocess_io(&b)
84
+ end
85
+ end
86
+ end
87
+
88
+ class Reporter
89
+ @mutex = Mutex.new
90
+
91
+ def self.synchronize # :nodoc:
92
+ if @mutex then # see parallel_each.rb
93
+ @mutex.synchronize { yield }
94
+ else
95
+ yield
96
+ end
97
+ end
98
+
99
+ alias :simple_record :record
100
+
101
+ def record result
102
+ Reporter.synchronize do
103
+ simple_record result
104
+ end
105
+ end
106
+ end
61
107
 
62
108
  ##
63
109
  # Runs all the +suites+ for a given +type+. Runs suites declaring
64
110
  # a test_order of +:parallel+ in parallel, and everything else
65
111
  # serial.
66
112
 
67
- def _run_suites suites, type
113
+ def self.__run reporter, options
114
+ suites = Runnable.runnables
68
115
  parallel, serial = suites.partition { |s| s.test_order == :parallel }
69
116
 
70
- ParallelEach.new(parallel).map { |suite| _run_suite suite, type } +
71
- serial.map { |suite| _run_suite suite, type }
117
+ ParallelEach.new(parallel).map { |suite| suite.run reporter, options } +
118
+ serial.map { |suite| suite.run reporter, options }
72
119
  end
73
120
  end
@@ -1,112 +1,4 @@
1
- require "minitest/unit"
1
+ require "minitest"
2
2
 
3
- ##
4
- # Show your testing pride!
5
-
6
- class PrideIO
7
-
8
- # Start an escape sequence
9
- ESC = "\e["
10
-
11
- # End the escape sequence
12
- NND = "#{ESC}0m"
13
-
14
- # The IO we're going to pipe through.
15
- attr_reader :io
16
-
17
- def initialize io # :nodoc:
18
- @io = io
19
- # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm
20
- # also reference http://en.wikipedia.org/wiki/ANSI_escape_code
21
- @colors ||= (31..36).to_a
22
- @size = @colors.size
23
- @index = 0
24
- # io.sync = true
25
- end
26
-
27
- ##
28
- # Wrap print to colorize the output.
29
-
30
- def print o
31
- case o
32
- when "." then
33
- io.print pride o
34
- when "E", "F" then
35
- io.print "#{ESC}41m#{ESC}37m#{o}#{NND}"
36
- else
37
- io.print o
38
- end
39
- end
40
-
41
- def puts(*o) # :nodoc:
42
- o.map! { |s|
43
- s.to_s.sub(/Finished tests/) {
44
- @index = 0
45
- 'Fabulous tests'.split(//).map { |c|
46
- pride(c)
47
- }.join
48
- }
49
- }
50
-
51
- super
52
- end
53
-
54
- ##
55
- # Color a string.
56
-
57
- def pride string
58
- string = "*" if string == "."
59
- c = @colors[@index % @size]
60
- @index += 1
61
- "#{ESC}#{c}m#{string}#{NND}"
62
- end
63
-
64
- def method_missing msg, *args # :nodoc:
65
- io.send(msg, *args)
66
- end
67
- end
68
-
69
- ##
70
- # If you thought the PrideIO was colorful...
71
- #
72
- # (Inspired by lolcat, but with clean math)
73
-
74
- class PrideLOL < PrideIO
75
- PI_3 = Math::PI / 3 # :nodoc:
76
-
77
- def initialize io # :nodoc:
78
- # walk red, green, and blue around a circle separated by equal thirds.
79
- #
80
- # To visualize, type this into wolfram-alpha:
81
- #
82
- # plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)
83
-
84
- # 6 has wide pretty gradients. 3 == lolcat, about half the width
85
- @colors = (0...(6 * 7)).map { |n|
86
- n *= 1.0 / 6
87
- r = (3 * Math.sin(n ) + 3).to_i
88
- g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
89
- b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
90
-
91
- # Then we take rgb and encode them in a single number using base 6.
92
- # For some mysterious reason, we add 16... to clear the bottom 4 bits?
93
- # Yes... they're ugly.
94
-
95
- 36 * r + 6 * g + b + 16
96
- }
97
-
98
- super
99
- end
100
-
101
- ##
102
- # Make the string even more colorful. Damnit.
103
-
104
- def pride string
105
- c = @colors[@index % @size]
106
- @index += 1
107
- "#{ESC}38;5;#{c}m#{string}#{NND}"
108
- end
109
- end
110
-
111
- klass = ENV['TERM'] =~ /^xterm|-256color$/ ? PrideLOL : PrideIO
112
- MiniTest::Unit.output = klass.new(MiniTest::Unit.output)
3
+ Minitest.load_plugins
4
+ Minitest::PrideIO.pride!
@@ -0,0 +1,143 @@
1
+ require "minitest/autorun"
2
+
3
+ module Minitest
4
+ def self.plugin_pride_options opts, options # :nodoc:
5
+ opts.on "-p", "--pride", "Pride. Show your testing pride!" do
6
+ PrideIO.pride!
7
+ end
8
+ end
9
+
10
+ def self.plugin_pride_init options # :nodoc:
11
+ if PrideIO.pride? then
12
+ klass = ENV["TERM"] =~ /^xterm|-256color$/ ? PrideLOL : PrideIO
13
+ io = klass.new options[:io]
14
+
15
+ self.reporter.reporters.grep(Minitest::Reporter).each do |rep|
16
+ rep.io = io
17
+ end
18
+ end
19
+ end
20
+
21
+ ##
22
+ # Show your testing pride!
23
+
24
+ class PrideIO
25
+ ##
26
+ # Activate the pride plugin. Called from both -p option and minitest/pride
27
+
28
+ def self.pride!
29
+ @pride = true
30
+ end
31
+
32
+ ##
33
+ # Are we showing our testing pride?
34
+
35
+ def self.pride?
36
+ @pride ||= false
37
+ end
38
+
39
+ # Start an escape sequence
40
+ ESC = "\e["
41
+
42
+ # End the escape sequence
43
+ NND = "#{ESC}0m"
44
+
45
+ # The IO we're going to pipe through.
46
+ attr_reader :io
47
+
48
+ def initialize io # :nodoc:
49
+ @io = io
50
+ # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm
51
+ # also reference http://en.wikipedia.org/wiki/ANSI_escape_code
52
+ @colors ||= (31..36).to_a
53
+ @size = @colors.size
54
+ @index = 0
55
+ # io.sync = true
56
+ end
57
+
58
+ ##
59
+ # Wrap print to colorize the output.
60
+
61
+ def print o
62
+ case o
63
+ when "." then
64
+ io.print pride o
65
+ when "E", "F" then
66
+ io.print "#{ESC}41m#{ESC}37m#{o}#{NND}"
67
+ when "S" then
68
+ io.print pride o
69
+ else
70
+ io.print o
71
+ end
72
+ end
73
+
74
+ def puts(*o) # :nodoc:
75
+ o.map! { |s|
76
+ s.to_s.sub(/Finished/) {
77
+ @index = 0
78
+ 'Fabulous run'.split(//).map { |c|
79
+ pride(c)
80
+ }.join
81
+ }
82
+ }
83
+
84
+ super
85
+ end
86
+
87
+ ##
88
+ # Color a string.
89
+
90
+ def pride string
91
+ string = "*" if string == "."
92
+ c = @colors[@index % @size]
93
+ @index += 1
94
+ "#{ESC}#{c}m#{string}#{NND}"
95
+ end
96
+
97
+ def method_missing msg, *args # :nodoc:
98
+ io.send(msg, *args)
99
+ end
100
+ end
101
+
102
+ ##
103
+ # If you thought the PrideIO was colorful...
104
+ #
105
+ # (Inspired by lolcat, but with clean math)
106
+
107
+ class PrideLOL < PrideIO
108
+ PI_3 = Math::PI / 3 # :nodoc:
109
+
110
+ def initialize io # :nodoc:
111
+ # walk red, green, and blue around a circle separated by equal thirds.
112
+ #
113
+ # To visualize, type this into wolfram-alpha:
114
+ #
115
+ # plot (3*sin(x)+3), (3*sin(x+2*pi/3)+3), (3*sin(x+4*pi/3)+3)
116
+
117
+ # 6 has wide pretty gradients. 3 == lolcat, about half the width
118
+ @colors = (0...(6 * 7)).map { |n|
119
+ n *= 1.0 / 6
120
+ r = (3 * Math.sin(n ) + 3).to_i
121
+ g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
122
+ b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
123
+
124
+ # Then we take rgb and encode them in a single number using base 6.
125
+ # For some mysterious reason, we add 16... to clear the bottom 4 bits?
126
+ # Yes... they're ugly.
127
+
128
+ 36 * r + 6 * g + b + 16
129
+ }
130
+
131
+ super
132
+ end
133
+
134
+ ##
135
+ # Make the string even more colorful. Damnit.
136
+
137
+ def pride string
138
+ c = @colors[@index % @size]
139
+ @index += 1
140
+ "#{ESC}38;5;#{c}m#{string}#{NND}"
141
+ end
142
+ end
143
+ end
@@ -9,39 +9,26 @@ class Module # :nodoc:
9
9
  def #{new_name} *args
10
10
  case
11
11
  when Proc === self then
12
- MiniTest::Spec.current.#{meth}(*args, &self)
12
+ Minitest::Spec.current.#{meth}(*args, &self)
13
13
  when #{!!dont_flip} then
14
- MiniTest::Spec.current.#{meth}(self, *args)
14
+ Minitest::Spec.current.#{meth}(self, *args)
15
15
  else
16
- MiniTest::Spec.current.#{meth}(args.first, self, *args[1..-1])
16
+ Minitest::Spec.current.#{meth}(args.first, self, *args[1..-1])
17
17
  end
18
18
  end
19
19
  EOM
20
20
  end
21
-
22
- ##
23
- # infect_with_assertions has been removed due to excessive clever.
24
- # Use infect_an_assertion directly instead.
25
-
26
- def infect_with_assertions(pos_prefix, neg_prefix,
27
- skip_re,
28
- dont_flip_re = /\c0/,
29
- map = {})
30
- abort "infect_with_assertions is dead. Use infect_an_assertion directly"
31
- end
32
21
  end
33
22
 
34
23
  module Kernel # :nodoc:
35
24
  ##
36
25
  # Describe a series of expectations for a given target +desc+.
37
26
  #
38
- # TODO: find good tutorial url.
39
- #
40
- # Defines a test class subclassing from either MiniTest::Spec or
27
+ # Defines a test class subclassing from either Minitest::Spec or
41
28
  # from the surrounding describe's class. The surrounding class may
42
- # subclass MiniTest::Spec manually in order to easily share code:
29
+ # subclass Minitest::Spec manually in order to easily share code:
43
30
  #
44
- # class MySpec < MiniTest::Spec
31
+ # class MySpec < Minitest::Spec
45
32
  # # ... shared code ...
46
33
  # end
47
34
  #
@@ -55,14 +42,26 @@ module Kernel # :nodoc:
55
42
  # end
56
43
  # end
57
44
  # end
45
+ #
46
+ # For more information on getting started with writing specs, see:
47
+ #
48
+ # http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html
49
+ #
50
+ # For some suggestions on how to improve your specs, try:
51
+ #
52
+ # http://betterspecs.org
53
+ #
54
+ # but do note that several items there are debatable or specific to
55
+ # rspec.
56
+
58
57
 
59
58
  def describe desc, additional_desc = nil, &block # :doc:
60
- stack = MiniTest::Spec.describe_stack
59
+ stack = Minitest::Spec.describe_stack
61
60
  name = [stack.last, desc, additional_desc].compact.join("::")
62
- sclas = stack.last || if Class === self && is_a?(MiniTest::Spec::DSL) then
61
+ sclas = stack.last || if Class === self && is_a?(Minitest::Spec::DSL) then
63
62
  self
64
63
  else
65
- MiniTest::Spec.spec_type desc
64
+ Minitest::Spec.spec_type desc
66
65
  end
67
66
 
68
67
  cls = sclas.create name, desc
@@ -76,14 +75,23 @@ module Kernel # :nodoc:
76
75
  end
77
76
 
78
77
  ##
79
- # MiniTest::Spec -- The faster, better, less-magical spec framework!
78
+ # Minitest::Spec -- The faster, better, less-magical spec framework!
80
79
  #
81
- # For a list of expectations, see MiniTest::Expectations.
80
+ # For a list of expectations, see Minitest::Expectations.
82
81
 
83
- class MiniTest::Spec < MiniTest::Unit::TestCase
82
+ class Minitest::Spec < Minitest::Test
83
+
84
+ def self.current # :nodoc:
85
+ Thread.current[:current_spec]
86
+ end
87
+
88
+ def initialize name # :nodoc:
89
+ super
90
+ Thread.current[:current_spec] = self
91
+ end
84
92
 
85
93
  ##
86
- # Oh look! A MiniTest::Spec::DSL module! Eat your heart out DHH.
94
+ # Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
87
95
 
88
96
  module DSL
89
97
  ##
@@ -93,7 +101,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
93
101
  #
94
102
  # See: register_spec_type and spec_type
95
103
 
96
- TYPES = [[//, MiniTest::Spec]]
104
+ TYPES = [[//, Minitest::Spec]]
97
105
 
98
106
  ##
99
107
  # Register a new type of spec that matches the spec's description.
@@ -103,11 +111,11 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
103
111
  #
104
112
  # Eg:
105
113
  #
106
- # register_spec_type(/Controller$/, MiniTest::Spec::Rails)
114
+ # register_spec_type(/Controller$/, Minitest::Spec::Rails)
107
115
  #
108
116
  # or:
109
117
  #
110
- # register_spec_type(MiniTest::Spec::RailsModel) do |desc|
118
+ # register_spec_type(Minitest::Spec::RailsModel) do |desc|
111
119
  # desc.superclass == ActiveRecord::Base
112
120
  # end
113
121
 
@@ -123,7 +131,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
123
131
  ##
124
132
  # Figure out the spec class to use based on a spec's description. Eg:
125
133
  #
126
- # spec_type("BlahController") # => MiniTest::Spec::Rails
134
+ # spec_type("BlahController") # => Minitest::Spec::Rails
127
135
 
128
136
  def spec_type desc
129
137
  TYPES.find { |matcher, klass|
@@ -135,8 +143,9 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
135
143
  }.last
136
144
  end
137
145
 
146
+ @@describe_stack = []
138
147
  def describe_stack # :nodoc:
139
- Thread.current[:describe_stack] ||= []
148
+ @@describe_stack
140
149
  end
141
150
 
142
151
  ##
@@ -157,7 +166,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
157
166
  #
158
167
  # NOTE: +type+ is ignored and is only there to make porting easier.
159
168
  #
160
- # Equivalent to MiniTest::Unit::TestCase#setup.
169
+ # Equivalent to Minitest::Test#setup.
161
170
 
162
171
  def before type = nil, &block
163
172
  define_method :setup do
@@ -171,7 +180,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
171
180
  #
172
181
  # NOTE: +type+ is ignored and is only there to make porting easier.
173
182
  #
174
- # Equivalent to MiniTest::Unit::TestCase#teardown.
183
+ # Equivalent to Minitest::Test#teardown.
175
184
 
176
185
  def after type = nil, &block
177
186
  define_method :teardown do
@@ -260,285 +269,8 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
260
269
  TYPES = DSL::TYPES # :nodoc:
261
270
  end
262
271
 
263
- ##
264
- # It's where you hide your "assertions".
265
-
266
- module MiniTest::Expectations
267
- ##
268
- # See MiniTest::Assertions#assert_empty.
269
- #
270
- # collection.must_be_empty
271
- #
272
- # :method: must_be_empty
273
-
274
- infect_an_assertion :assert_empty, :must_be_empty, :unary
275
-
276
- ##
277
- # See MiniTest::Assertions#assert_equal
278
- #
279
- # a.must_equal b
280
- #
281
- # :method: must_equal
282
-
283
- infect_an_assertion :assert_equal, :must_equal
284
-
285
- ##
286
- # See MiniTest::Assertions#assert_in_delta
287
- #
288
- # n.must_be_close_to m [, delta]
289
- #
290
- # :method: must_be_close_to
291
-
292
- infect_an_assertion :assert_in_delta, :must_be_close_to
293
-
294
- alias :must_be_within_delta :must_be_close_to # :nodoc:
295
-
296
- ##
297
- # See MiniTest::Assertions#assert_in_epsilon
298
- #
299
- # n.must_be_within_epsilon m [, epsilon]
300
- #
301
- # :method: must_be_within_epsilon
302
-
303
- infect_an_assertion :assert_in_epsilon, :must_be_within_epsilon
304
-
305
- ##
306
- # See MiniTest::Assertions#assert_includes
307
- #
308
- # collection.must_include obj
309
- #
310
- # :method: must_include
311
-
312
- infect_an_assertion :assert_includes, :must_include, :reverse
313
-
314
- ##
315
- # See MiniTest::Assertions#assert_instance_of
316
- #
317
- # obj.must_be_instance_of klass
318
- #
319
- # :method: must_be_instance_of
320
-
321
- infect_an_assertion :assert_instance_of, :must_be_instance_of
322
-
323
- ##
324
- # See MiniTest::Assertions#assert_kind_of
325
- #
326
- # obj.must_be_kind_of mod
327
- #
328
- # :method: must_be_kind_of
329
-
330
- infect_an_assertion :assert_kind_of, :must_be_kind_of
331
-
332
- ##
333
- # See MiniTest::Assertions#assert_match
334
- #
335
- # a.must_match b
336
- #
337
- # :method: must_match
338
-
339
- infect_an_assertion :assert_match, :must_match
340
-
341
- ##
342
- # See MiniTest::Assertions#assert_nil
343
- #
344
- # obj.must_be_nil
345
- #
346
- # :method: must_be_nil
347
-
348
- infect_an_assertion :assert_nil, :must_be_nil, :unary
349
-
350
- ##
351
- # See MiniTest::Assertions#assert_operator
352
- #
353
- # n.must_be :<=, 42
354
- #
355
- # This can also do predicates:
356
- #
357
- # str.must_be :empty?
358
- #
359
- # :method: must_be
360
-
361
- infect_an_assertion :assert_operator, :must_be, :reverse
362
-
363
- ##
364
- # See MiniTest::Assertions#assert_output
365
- #
366
- # proc { ... }.must_output out_or_nil [, err]
367
- #
368
- # :method: must_output
369
-
370
- infect_an_assertion :assert_output, :must_output
371
-
372
- ##
373
- # See MiniTest::Assertions#assert_raises
374
- #
375
- # proc { ... }.must_raise exception
376
- #
377
- # :method: must_raise
378
-
379
- infect_an_assertion :assert_raises, :must_raise
380
-
381
- ##
382
- # See MiniTest::Assertions#assert_respond_to
383
- #
384
- # obj.must_respond_to msg
385
- #
386
- # :method: must_respond_to
387
-
388
- infect_an_assertion :assert_respond_to, :must_respond_to, :reverse
389
-
390
- ##
391
- # See MiniTest::Assertions#assert_same
392
- #
393
- # a.must_be_same_as b
394
- #
395
- # :method: must_be_same_as
396
-
397
- infect_an_assertion :assert_same, :must_be_same_as
398
-
399
- ##
400
- # See MiniTest::Assertions#assert_send
401
- # TODO: remove me
402
- #
403
- # a.must_send
404
- #
405
- # :method: must_send
406
-
407
- infect_an_assertion :assert_send, :must_send
408
-
409
- ##
410
- # See MiniTest::Assertions#assert_silent
411
- #
412
- # proc { ... }.must_be_silent
413
- #
414
- # :method: must_be_silent
415
-
416
- infect_an_assertion :assert_silent, :must_be_silent
417
-
418
- ##
419
- # See MiniTest::Assertions#assert_throws
420
- #
421
- # proc { ... }.must_throw sym
422
- #
423
- # :method: must_throw
424
-
425
- infect_an_assertion :assert_throws, :must_throw
426
-
427
- ##
428
- # See MiniTest::Assertions#refute_empty
429
- #
430
- # collection.wont_be_empty
431
- #
432
- # :method: wont_be_empty
433
-
434
- infect_an_assertion :refute_empty, :wont_be_empty, :unary
435
-
436
- ##
437
- # See MiniTest::Assertions#refute_equal
438
- #
439
- # a.wont_equal b
440
- #
441
- # :method: wont_equal
442
-
443
- infect_an_assertion :refute_equal, :wont_equal
444
-
445
- ##
446
- # See MiniTest::Assertions#refute_in_delta
447
- #
448
- # n.wont_be_close_to m [, delta]
449
- #
450
- # :method: wont_be_close_to
451
-
452
- infect_an_assertion :refute_in_delta, :wont_be_close_to
453
-
454
- alias :wont_be_within_delta :wont_be_close_to # :nodoc:
455
-
456
- ##
457
- # See MiniTest::Assertions#refute_in_epsilon
458
- #
459
- # n.wont_be_within_epsilon m [, epsilon]
460
- #
461
- # :method: wont_be_within_epsilon
462
-
463
- infect_an_assertion :refute_in_epsilon, :wont_be_within_epsilon
464
-
465
- ##
466
- # See MiniTest::Assertions#refute_includes
467
- #
468
- # collection.wont_include obj
469
- #
470
- # :method: wont_include
471
-
472
- infect_an_assertion :refute_includes, :wont_include, :reverse
473
-
474
- ##
475
- # See MiniTest::Assertions#refute_instance_of
476
- #
477
- # obj.wont_be_instance_of klass
478
- #
479
- # :method: wont_be_instance_of
480
-
481
- infect_an_assertion :refute_instance_of, :wont_be_instance_of
482
-
483
- ##
484
- # See MiniTest::Assertions#refute_kind_of
485
- #
486
- # obj.wont_be_kind_of mod
487
- #
488
- # :method: wont_be_kind_of
489
-
490
- infect_an_assertion :refute_kind_of, :wont_be_kind_of
491
-
492
- ##
493
- # See MiniTest::Assertions#refute_match
494
- #
495
- # a.wont_match b
496
- #
497
- # :method: wont_match
498
-
499
- infect_an_assertion :refute_match, :wont_match
500
-
501
- ##
502
- # See MiniTest::Assertions#refute_nil
503
- #
504
- # obj.wont_be_nil
505
- #
506
- # :method: wont_be_nil
507
-
508
- infect_an_assertion :refute_nil, :wont_be_nil, :unary
509
-
510
- ##
511
- # See MiniTest::Assertions#refute_operator
512
- #
513
- # n.wont_be :<=, 42
514
- #
515
- # This can also do predicates:
516
- #
517
- # str.wont_be :empty?
518
- #
519
- # :method: wont_be
520
-
521
- infect_an_assertion :refute_operator, :wont_be, :reverse
522
-
523
- ##
524
- # See MiniTest::Assertions#refute_respond_to
525
- #
526
- # obj.wont_respond_to msg
527
- #
528
- # :method: wont_respond_to
529
-
530
- infect_an_assertion :refute_respond_to, :wont_respond_to, :reverse
531
-
532
- ##
533
- # See MiniTest::Assertions#refute_same
534
- #
535
- # a.wont_be_same_as b
536
- #
537
- # :method: wont_be_same_as
538
-
539
- infect_an_assertion :refute_same, :wont_be_same_as
540
- end
272
+ require "minitest/expectations"
541
273
 
542
274
  class Object # :nodoc:
543
- include MiniTest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
275
+ include Minitest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
544
276
  end