minitest 2.5.1 → 2.6.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.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,14 @@
1
+ === 2.6.0 / 2011-09-13
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added specify alias for it and made desc optional.
6
+ * Spec#must_be and #wont_be can be used with predicates (metaskills)
7
+
8
+ * 1 bug fix:
9
+
10
+ * Fixed Mock.respond_to?(var) to work with strings. (holli)
11
+
1
12
  === 2.5.1 / 2011-08-27
2
13
 
3
14
  * 2 minor enhancements:
data/README.txt CHANGED
@@ -1,13 +1,24 @@
1
1
  = minitest/{unit,spec,mock,benchmark}
2
2
 
3
3
  home :: https://github.com/seattlerb/minitest
4
- rdoc :: http://bfts.rubyforge.org/minitest
4
+ rdoc :: http://docs.seattlerb.org/minitest
5
5
 
6
6
  == DESCRIPTION:
7
7
 
8
8
  minitest provides a complete suite of testing facilities supporting
9
9
  TDD, BDD, mocking, and benchmarking.
10
10
 
11
+ "I had a class with Jim Weirich on testing last week and we were
12
+ allowed to choose our testing frameworks. Kirk Haines and I were
13
+ paired up and we cracked open the code for a few test
14
+ frameworks...
15
+
16
+ I MUST say that mintiest is *very* readable / understandable
17
+ compared to the 'other two' options we looked at. Nicely done and
18
+ thank you for helping us keep our mental sanity."
19
+
20
+ -- Wayne E. Seguin
21
+
11
22
  minitest/unit is a small and incredibly fast unit testing framework.
12
23
  It provides a rich set of assertions to make your tests clean and
13
24
  readable.
@@ -32,6 +43,11 @@ implementors that need a minimal set of methods to bootstrap a working
32
43
  test suite. For example, there is no magic involved for test-case
33
44
  discovery.
34
45
 
46
+ "Again, I can’t praise enough the idea of a testing/specing
47
+ framework that I can actually read in full in one sitting!"
48
+
49
+ -- Piotr Szotkowski
50
+
35
51
  == FEATURES/PROBLEMS:
36
52
 
37
53
  * minitest/autorun - the easy and explicit way to run all your tests.
@@ -93,7 +93,7 @@ module MiniTest
93
93
  end
94
94
 
95
95
  def respond_to?(sym) # :nodoc:
96
- return true if @expected_calls.has_key?(sym)
96
+ return true if @expected_calls.has_key?(sym.to_sym)
97
97
  return __respond_to?(sym)
98
98
  end
99
99
  end
@@ -186,10 +186,12 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
186
186
  # write specs don't like class inheritence, so this goes way out of
187
187
  # its way to make sure that expectations aren't inherited.
188
188
  #
189
+ # This is also aliased to #specify and doesn't require a +desc+ arg.
190
+ #
189
191
  # Hint: If you _do_ want inheritence, use minitest/unit. You can mix
190
192
  # and match between assertions and expectations as much as you want.
191
193
 
192
- def self.it desc, &block
194
+ def self.it desc = "anonymous", &block
193
195
  block ||= proc { skip "(no tests defined)" }
194
196
 
195
197
  @specs ||= 0
@@ -235,6 +237,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
235
237
  # :stopdoc:
236
238
  class << self
237
239
  attr_reader :name, :desc
240
+ alias :specify :it
238
241
  end
239
242
  # :startdoc:
240
243
  end
@@ -328,9 +331,13 @@ module MiniTest::Expectations
328
331
  #
329
332
  # n.must_be :<=, 42
330
333
  #
334
+ # This can also do predicates:
335
+ #
336
+ # str.must_be :empty?
337
+ #
331
338
  # :method: must_be
332
339
 
333
- infect_an_assertion :assert_operator, :must_be
340
+ infect_an_assertion :assert_operator, :must_be, :reverse
334
341
 
335
342
  ##
336
343
  # See MiniTest::Assertions#assert_output
@@ -485,9 +492,13 @@ module MiniTest::Expectations
485
492
  #
486
493
  # n.wont_be :<=, 42
487
494
  #
495
+ # This can also do predicates:
496
+ #
497
+ # str.wont_be :empty?
498
+ #
488
499
  # :method: wont_be
489
500
 
490
- infect_an_assertion :refute_operator, :wont_be
501
+ infect_an_assertion :refute_operator, :wont_be, :reverse
491
502
 
492
503
  ##
493
504
  # See MiniTest::Assertions#refute_respond_to
@@ -285,12 +285,16 @@ module MiniTest
285
285
  assert obj.nil?, msg
286
286
  end
287
287
 
288
+ UNDEFINED = Object.new
289
+ def UNDEFINED.inspect; "UNDEFINED"; end
290
+
288
291
  ##
289
- # For testing equality operators and so-forth.
292
+ # For testing with binary operators.
290
293
  #
291
294
  # assert_operator 5, :<=, 4
292
295
 
293
- def assert_operator o1, op, o2, msg = nil
296
+ def assert_operator o1, op, o2 = UNDEFINED, msg = nil
297
+ return assert_predicate o1, op, msg if o2 == UNDEFINED
294
298
  msg = message(msg) { "Expected #{mu_pp(o1)} to be #{op} #{mu_pp(o2)}" }
295
299
  assert o1.__send__(op, o2), msg
296
300
  end
@@ -313,6 +317,20 @@ module MiniTest
313
317
  (!stdout || x) && (!stderr || y)
314
318
  end
315
319
 
320
+ ##
321
+ # For testing with predicates.
322
+ #
323
+ # assert_predicate str, :empty?
324
+ #
325
+ # This is really meant for specs and is front-ended by assert_operator:
326
+ #
327
+ # str.must_be :empty?
328
+
329
+ def assert_predicate o1, op, msg = nil
330
+ msg = message(msg) { "Expected #{mu_pp(o1)} to be #{op}" }
331
+ assert o1.__send__(op), msg
332
+ end
333
+
316
334
  ##
317
335
  # Fails unless the block raises one of +exp+
318
336
 
@@ -576,13 +594,26 @@ module MiniTest
576
594
  # refute_operator 1, :>, 2 #=> pass
577
595
  # refute_operator 1, :<, 2 #=> fail
578
596
 
579
- def refute_operator o1, op, o2, msg = nil
580
- msg = message(msg) {
581
- "Expected #{mu_pp(o1)} to not be #{op} #{mu_pp(o2)}"
582
- }
597
+ def refute_operator o1, op, o2 = UNDEFINED, msg = nil
598
+ return refute_predicate o1, op if o2 == UNDEFINED
599
+ msg = message(msg) { "Expected #{mu_pp(o1)} to not be #{op} #{mu_pp(o2)}"}
583
600
  refute o1.__send__(op, o2), msg
584
601
  end
585
602
 
603
+ ##
604
+ # For testing with predicates.
605
+ #
606
+ # refute_predicate str, :empty?
607
+ #
608
+ # This is really meant for specs and is front-ended by refute_operator:
609
+ #
610
+ # str.wont_be :empty?
611
+
612
+ def refute_predicate o1, op, msg = nil
613
+ msg = message(msg) { "Expected #{mu_pp(o1)} to not be #{op}" }
614
+ refute o1.__send__(op), msg
615
+ end
616
+
586
617
  ##
587
618
  # Fails if +obj+ responds to the message +meth+.
588
619
 
@@ -614,7 +645,7 @@ module MiniTest
614
645
  end
615
646
 
616
647
  class Unit
617
- VERSION = "2.5.1" # :nodoc:
648
+ VERSION = "2.6.0" # :nodoc:
618
649
 
619
650
  attr_accessor :report, :failures, :errors, :skips # :nodoc:
620
651
  attr_accessor :test_count, :assertion_count # :nodoc:
@@ -85,6 +85,7 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
85
85
 
86
86
  def test_respond_appropriately
87
87
  assert @mock.respond_to?(:foo)
88
+ assert @mock.respond_to?('foo')
88
89
  assert !@mock.respond_to?(:bar)
89
90
  end
90
91
 
@@ -89,11 +89,16 @@ describe MiniTest::Spec do
89
89
  proc { 42.must_be_nil }.must_raise MiniTest::Assertion
90
90
  end
91
91
 
92
- it "needs to verify using any operator" do
92
+ it "needs to verify using any binary operator" do
93
93
  41.must_be(:<, 42).must_equal true
94
94
  proc { 42.must_be(:<, 41) }.must_raise MiniTest::Assertion
95
95
  end
96
96
 
97
+ it "needs to verify using any predicate" do
98
+ "".must_be(:empty?).must_equal true
99
+ proc { "blah".must_be(:empty?) }.must_raise MiniTest::Assertion
100
+ end
101
+
97
102
  it "needs to catch an expected exception" do
98
103
  @assertion_count = 2
99
104
 
@@ -150,6 +155,11 @@ describe MiniTest::Spec do
150
155
  proc { "blah".wont_match(/\w+/) }.must_raise MiniTest::Assertion
151
156
  end
152
157
 
158
+ it "needs to verify using any (negative) predicate" do
159
+ "blah".wont_be(:empty?).must_equal false
160
+ proc { "".wont_be(:empty?) }.must_raise MiniTest::Assertion
161
+ end
162
+
153
163
  it "needs to verify non-nil" do
154
164
  42.wont_be_nil.must_equal false
155
165
  proc { nil.wont_be_nil }.must_raise MiniTest::Assertion
@@ -271,6 +281,9 @@ class TestMeta < MiniTest::Unit::TestCase
271
281
  before { before_list << 3 }
272
282
  after { after_list << 3 }
273
283
  it "inner-it" do end
284
+
285
+ it {} # ignore me
286
+ specify {} # anonymous it
274
287
  end
275
288
  end
276
289
  end
@@ -322,11 +335,13 @@ class TestMeta < MiniTest::Unit::TestCase
322
335
  assert_equal "very inner thingy", z.desc
323
336
 
324
337
  top_methods = %w(test_0001_top_level_it)
325
- inner_methods = %w(test_0001_inner_it)
338
+ inner_methods1 = %w(test_0001_inner_it)
339
+ inner_methods2 = inner_methods1 +
340
+ %w(test_0002_anonymous test_0003_anonymous)
326
341
 
327
- assert_equal top_methods, x.instance_methods(false).sort.map {|o| o.to_s }
328
- assert_equal inner_methods, y.instance_methods(false).sort.map {|o| o.to_s }
329
- assert_equal inner_methods, z.instance_methods(false).sort.map {|o| o.to_s }
342
+ assert_equal top_methods, x.instance_methods(false).sort.map(&:to_s)
343
+ assert_equal inner_methods1, y.instance_methods(false).sort.map(&:to_s)
344
+ assert_equal inner_methods2, z.instance_methods(false).sort.map(&:to_s)
330
345
  end
331
346
 
332
347
  def test_setup_teardown_behavior
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 5
9
- - 1
10
- version: 2.5.1
8
+ - 6
9
+ - 0
10
+ version: 2.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2011-08-27 00:00:00 Z
39
+ date: 2011-09-13 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hoe
@@ -53,33 +53,26 @@ dependencies:
53
53
  version: "2.12"
54
54
  type: :development
55
55
  version_requirements: *id001
56
- description: |-
57
- minitest provides a complete suite of testing facilities supporting
58
- TDD, BDD, mocking, and benchmarking.
59
-
60
- minitest/unit is a small and incredibly fast unit testing framework.
61
- It provides a rich set of assertions to make your tests clean and
62
- readable.
63
-
64
- minitest/spec is a functionally complete spec engine. It hooks onto
65
- minitest/unit and seamlessly bridges test assertions over to spec
66
- expectations.
67
-
68
- minitest/benchmark is an awesome way to assert the performance of your
69
- algorithms in a repeatable manner. Now you can assert that your newb
70
- co-worker doesn't replace your linear algorithm with an exponential
71
- one!
72
-
73
- minitest/mock by Steven Baker, is a beautifully tiny mock object
74
- framework.
75
-
76
- minitest/pride shows pride in testing and adds coloring to your test
77
- output. I guess it is an example of how to write IO pipes too. :P
78
-
79
- minitest/unit is meant to have a clean implementation for language
80
- implementors that need a minimal set of methods to bootstrap a working
81
- test suite. For example, there is no magic involved for test-case
82
- discovery.
56
+ description: "minitest provides a complete suite of testing facilities supporting\n\
57
+ TDD, BDD, mocking, and benchmarking.\n\n \"I had a class with Jim Weirich on testing last week and we were\n allowed to choose our testing frameworks. Kirk Haines and I were\n paired up and we cracked open the code for a few test\n frameworks...\n\n I MUST say that mintiest is *very* readable / understandable\n compared to the 'other two' options we looked at. Nicely done and\n thank you for helping us keep our mental sanity.\"\n\n -- Wayne E. Seguin\n\n\
58
+ minitest/unit is a small and incredibly fast unit testing framework.\n\
59
+ It provides a rich set of assertions to make your tests clean and\n\
60
+ readable.\n\n\
61
+ minitest/spec is a functionally complete spec engine. It hooks onto\n\
62
+ minitest/unit and seamlessly bridges test assertions over to spec\n\
63
+ expectations.\n\n\
64
+ minitest/benchmark is an awesome way to assert the performance of your\n\
65
+ algorithms in a repeatable manner. Now you can assert that your newb\n\
66
+ co-worker doesn't replace your linear algorithm with an exponential\n\
67
+ one!\n\n\
68
+ minitest/mock by Steven Baker, is a beautifully tiny mock object\n\
69
+ framework.\n\n\
70
+ minitest/pride shows pride in testing and adds coloring to your test\n\
71
+ output. I guess it is an example of how to write IO pipes too. :P\n\n\
72
+ minitest/unit is meant to have a clean implementation for language\n\
73
+ implementors that need a minimal set of methods to bootstrap a working\n\
74
+ test suite. For example, there is no magic involved for test-case\n\
75
+ discovery.\n\n \"Again, I can\xE2\x80\x99t praise enough the idea of a testing/specing\n framework that I can actually read in full in one sitting!\"\n\n -- Piotr Szotkowski"
83
76
  email:
84
77
  - ryand-ruby@zenspider.com
85
78
  executables: []
@@ -139,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
132
  requirements: []
140
133
 
141
134
  rubyforge_project: bfts
142
- rubygems_version: 1.8.9
135
+ rubygems_version: 1.8.10
143
136
  signing_key:
144
137
  specification_version: 3
145
138
  summary: minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking
metadata.gz.sig CHANGED
Binary file