minitest 1.3.0 → 6.0.6

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 (54) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +2 -0
  3. data/History.rdoc +1860 -0
  4. data/Manifest.txt +38 -8
  5. data/README.rdoc +763 -0
  6. data/Rakefile +70 -56
  7. data/bin/minitest +5 -0
  8. data/design_rationale.rb +54 -0
  9. data/lib/hoe/minitest.rb +30 -0
  10. data/lib/minitest/assertions.rb +821 -0
  11. data/lib/minitest/autorun.rb +5 -0
  12. data/lib/minitest/benchmark.rb +452 -0
  13. data/lib/minitest/bisect.rb +304 -0
  14. data/lib/minitest/complete.rb +56 -0
  15. data/lib/minitest/compress.rb +94 -0
  16. data/lib/minitest/error_on_warning.rb +11 -0
  17. data/lib/minitest/expectations.rb +321 -0
  18. data/lib/minitest/find_minimal_combination.rb +127 -0
  19. data/lib/minitest/hell.rb +11 -0
  20. data/lib/minitest/manual_plugins.rb +4 -0
  21. data/lib/minitest/parallel.rb +72 -0
  22. data/lib/minitest/path_expander.rb +432 -0
  23. data/lib/minitest/pride.rb +4 -0
  24. data/lib/minitest/pride_plugin.rb +135 -0
  25. data/lib/minitest/server.rb +49 -0
  26. data/lib/minitest/server_plugin.rb +88 -0
  27. data/lib/minitest/spec.rb +306 -64
  28. data/lib/minitest/sprint.rb +105 -0
  29. data/lib/minitest/sprint_plugin.rb +39 -0
  30. data/lib/minitest/test.rb +232 -0
  31. data/lib/minitest/test_task.rb +331 -0
  32. data/lib/minitest.rb +1232 -0
  33. data/test/minitest/metametameta.rb +150 -0
  34. data/test/minitest/test_bisect.rb +249 -0
  35. data/test/minitest/test_find_minimal_combination.rb +138 -0
  36. data/test/minitest/test_minitest_assertions.rb +1729 -0
  37. data/test/minitest/test_minitest_benchmark.rb +151 -0
  38. data/test/minitest/test_minitest_reporter.rb +437 -0
  39. data/test/minitest/test_minitest_spec.rb +1095 -0
  40. data/test/minitest/test_minitest_test.rb +1295 -0
  41. data/test/minitest/test_minitest_test_task.rb +57 -0
  42. data/test/minitest/test_path_expander.rb +229 -0
  43. data/test/minitest/test_server.rb +146 -0
  44. data.tar.gz.sig +1 -0
  45. metadata +235 -62
  46. metadata.gz.sig +0 -0
  47. data/.autotest +0 -15
  48. data/History.txt +0 -114
  49. data/README.txt +0 -56
  50. data/lib/minitest/mock.rb +0 -31
  51. data/lib/minitest/unit.rb +0 -482
  52. data/test/test_mini_mock.rb +0 -77
  53. data/test/test_mini_spec.rb +0 -149
  54. data/test/test_mini_test.rb +0 -829
metadata CHANGED
@@ -1,78 +1,251 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
- version: !ruby/object:Gem::Version
4
- version: 1.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 6.0.6
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Ryan Davis
8
- autorequire:
9
8
  bindir: bin
10
- cert_chain: []
11
-
12
- date: 2008-10-09 00:00:00 -07:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
9
+ cert_chain:
10
+ - |
11
+ -----BEGIN CERTIFICATE-----
12
+ MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
14
+ GRYDY29tMB4XDTI2MDEwNzAxMDkxNFoXDTI3MDEwNzAxMDkxNFowRTETMBEGA1UE
15
+ AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
16
+ JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
17
+ b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
18
+ taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
19
+ oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
20
+ GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
21
+ qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
22
+ gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
23
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
24
+ AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
25
+ 2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
26
+ rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
27
+ xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
28
+ 6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
29
+ snGe1hrppvBRdcyEzvhfIPjI
30
+ -----END CERTIFICATE-----
31
+ date: 1980-01-02 00:00:00.000000000 Z
32
+ dependencies:
33
+ - !ruby/object:Gem::Dependency
34
+ name: prism
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.5'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.5'
47
+ - !ruby/object:Gem::Dependency
48
+ name: drb
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rdoc
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '6.0'
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '8'
17
71
  type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
21
75
  - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.0
24
- version:
25
- description: minitest/unit is a small and fast replacement for ruby's huge and slow test/unit. This is meant to be clean and easy to use both as a regular test writer and for language implementors that need a minimal set of methods to bootstrap a working unit test suite. mini/spec is a functionally complete spec engine. mini/mock, by Steven Baker, is a beautifully tiny mock object framework. (This package was called miniunit once upon a time)
26
- email:
27
- - ryand-ruby@zenspider.com
28
- executables: []
76
+ - !ruby/object:Gem::Version
77
+ version: '6.0'
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '8'
81
+ - !ruby/object:Gem::Dependency
82
+ name: simplecov
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0.21'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '0.21'
95
+ - !ruby/object:Gem::Dependency
96
+ name: hoe
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '4.7'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '4.7'
109
+ description: |-
110
+ minitest provides a complete suite of testing facilities supporting
111
+ TDD, BDD, and benchmarking.
29
112
 
30
- extensions: []
113
+ "I had a class with Jim Weirich on testing last week and we were
114
+ allowed to choose our testing frameworks. Kirk Haines and I were
115
+ paired up and we cracked open the code for a few test
116
+ frameworks...
117
+
118
+ I MUST say that minitest is *very* readable / understandable
119
+ compared to the 'other two' options we looked at. Nicely done and
120
+ thank you for helping us keep our mental sanity."
121
+
122
+ -- Wayne E. Seguin
123
+
124
+ minitest/test is a small and incredibly fast unit testing framework.
125
+ It provides a rich set of assertions to make your tests clean and
126
+ readable.
127
+
128
+ minitest/spec is a functionally complete spec engine. It hooks onto
129
+ minitest/test and seamlessly bridges test assertions over to spec
130
+ expectations.
131
+
132
+ minitest/benchmark is an awesome way to assert the performance of your
133
+ algorithms in a repeatable manner. Now you can assert that your newb
134
+ co-worker doesn't replace your linear algorithm with an exponential
135
+ one!
31
136
 
32
- extra_rdoc_files:
33
- - History.txt
137
+ minitest/pride shows pride in testing and adds coloring to your test
138
+ output. I guess it is an example of how to write IO pipes too. :P
139
+
140
+ minitest/test is meant to have a clean implementation for language
141
+ implementors that need a minimal set of methods to bootstrap a working
142
+ test suite. For example, there is no magic involved for test-case
143
+ discovery.
144
+
145
+ "Again, I can't praise enough the idea of a testing/specing
146
+ framework that I can actually read in full in one sitting!"
147
+
148
+ -- Piotr Szotkowski
149
+
150
+ Comparing to rspec:
151
+
152
+ rspec is a testing DSL. minitest is ruby.
153
+
154
+ -- Adam Hawkins, "Bow Before MiniTest"
155
+
156
+ minitest doesn't reinvent anything that ruby already provides, like:
157
+ classes, modules, inheritance, methods. This means you only have to
158
+ learn ruby to use minitest and all of your regular OO practices like
159
+ extract-method refactorings still apply.
160
+
161
+ == Features/Problems:
162
+
163
+ * minitest/autorun - the easy and explicit way to run all your tests.
164
+ * minitest/test - a very fast, simple, and clean test system.
165
+ * minitest/spec - a very fast, simple, and clean spec system.
166
+ * minitest/benchmark - an awesome way to assert your algorithm's performance.
167
+ * minitest/pride - show your pride in testing!
168
+ * minitest/test_task - a full-featured and clean rake task generator.
169
+ * Incredibly small and fast runner, but no bells and whistles.
170
+ * Written by squishy human beings. Software can never be perfect. We will all eventually die.
171
+ email:
172
+ - ryand-ruby@zenspider.com
173
+ executables:
174
+ - minitest
175
+ extensions: []
176
+ extra_rdoc_files:
177
+ - History.rdoc
34
178
  - Manifest.txt
35
- - README.txt
36
- files:
37
- - .autotest
38
- - History.txt
179
+ - README.rdoc
180
+ files:
181
+ - History.rdoc
39
182
  - Manifest.txt
40
- - README.txt
183
+ - README.rdoc
41
184
  - Rakefile
42
- - lib/minitest/mock.rb
185
+ - bin/minitest
186
+ - design_rationale.rb
187
+ - lib/hoe/minitest.rb
188
+ - lib/minitest.rb
189
+ - lib/minitest/assertions.rb
190
+ - lib/minitest/autorun.rb
191
+ - lib/minitest/benchmark.rb
192
+ - lib/minitest/bisect.rb
193
+ - lib/minitest/complete.rb
194
+ - lib/minitest/compress.rb
195
+ - lib/minitest/error_on_warning.rb
196
+ - lib/minitest/expectations.rb
197
+ - lib/minitest/find_minimal_combination.rb
198
+ - lib/minitest/hell.rb
199
+ - lib/minitest/manual_plugins.rb
200
+ - lib/minitest/parallel.rb
201
+ - lib/minitest/path_expander.rb
202
+ - lib/minitest/pride.rb
203
+ - lib/minitest/pride_plugin.rb
204
+ - lib/minitest/server.rb
205
+ - lib/minitest/server_plugin.rb
43
206
  - lib/minitest/spec.rb
44
- - lib/minitest/unit.rb
45
- - test/test_mini_mock.rb
46
- - test/test_mini_spec.rb
47
- - test/test_mini_test.rb
48
- has_rdoc: true
49
- homepage: http://rubyforge.org/projects/bfts
50
- post_install_message:
51
- rdoc_options:
52
- - --main
53
- - README.txt
54
- require_paths:
207
+ - lib/minitest/sprint.rb
208
+ - lib/minitest/sprint_plugin.rb
209
+ - lib/minitest/test.rb
210
+ - lib/minitest/test_task.rb
211
+ - test/minitest/metametameta.rb
212
+ - test/minitest/test_bisect.rb
213
+ - test/minitest/test_find_minimal_combination.rb
214
+ - test/minitest/test_minitest_assertions.rb
215
+ - test/minitest/test_minitest_benchmark.rb
216
+ - test/minitest/test_minitest_reporter.rb
217
+ - test/minitest/test_minitest_spec.rb
218
+ - test/minitest/test_minitest_test.rb
219
+ - test/minitest/test_minitest_test_task.rb
220
+ - test/minitest/test_path_expander.rb
221
+ - test/minitest/test_server.rb
222
+ homepage: https://minite.st/
223
+ licenses:
224
+ - MIT
225
+ metadata:
226
+ homepage_uri: https://minite.st/
227
+ source_code_uri: https://github.com/minitest/minitest
228
+ bug_tracker_uri: https://github.com/minitest/minitest/issues
229
+ documentation_uri: https://docs.seattlerb.org/minitest
230
+ changelog_uri: https://github.com/minitest/minitest/blob/master/History.rdoc
231
+ rdoc_options:
232
+ - "--main"
233
+ - README.rdoc
234
+ require_paths:
55
235
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
57
- requirements:
236
+ required_ruby_version: !ruby/object:Gem::Requirement
237
+ requirements:
58
238
  - - ">="
59
- - !ruby/object:Gem::Version
60
- version: "0"
61
- version:
62
- required_rubygems_version: !ruby/object:Gem::Requirement
63
- requirements:
239
+ - !ruby/object:Gem::Version
240
+ version: '3.2'
241
+ required_rubygems_version: !ruby/object:Gem::Requirement
242
+ requirements:
64
243
  - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
67
- version:
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
68
246
  requirements: []
69
-
70
- rubyforge_project: bfts
71
- rubygems_version: 1.3.0
72
- signing_key:
73
- specification_version: 2
74
- summary: minitest/unit is a small and fast replacement for ruby's huge and slow test/unit
75
- test_files:
76
- - test/test_mini_mock.rb
77
- - test/test_mini_spec.rb
78
- - test/test_mini_test.rb
247
+ rubygems_version: 3.7.2
248
+ specification_version: 4
249
+ summary: minitest provides a complete suite of testing facilities supporting TDD,
250
+ BDD, and benchmarking
251
+ test_files: []
metadata.gz.sig ADDED
Binary file
data/.autotest DELETED
@@ -1,15 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'autotest/restart'
4
-
5
- Autotest.add_hook :initialize do |at|
6
- at.extra_class_map["MiniSpec"] = "test/test_mini_spec.rb"
7
- at.extra_class_map["TestMiniTestTestCase"] = "test/test_mini_test.rb"
8
-
9
- at.add_exception 'coverage.info'
10
- at.add_exception 'coverage'
11
- end
12
-
13
- require 'autotest/rcov'
14
- Autotest::RCov.command = 'rcov_info'
15
-
data/History.txt DELETED
@@ -1,114 +0,0 @@
1
- === 1.3.0 / 2008-10-09
2
-
3
- * 2 major enhancements:
4
-
5
- * renamed to minitest and pulled out test/unit compatibility.
6
- * mini/test.rb is now minitest/unit.rb, everything else maps directly.
7
-
8
- * 12 minor enhancements:
9
-
10
- * assert_match now checks that act can call =~ and converts exp to a
11
- regexp only if needed.
12
- * Added assert_send... seems useless to me tho.
13
- * message now forces to string... ruby-core likes to pass classes and arrays :(
14
- * Added -v handling and switched to @verbose from $DEBUG.
15
- * Verbose output now includes test class name and adds a sortable running time!
16
- * Switched message generation into procs for message deferment.
17
- * Added skip and renamed fail to flunk.
18
- * Improved output failure messages for assert_instance_of, assert_kind_of
19
- * Improved output for assert_respond_to, assert_same.
20
- * at_exit now exits false instead of errors+failures.
21
- * Made the tests happier and more readable imhfo.
22
- * Switched index(s) == 0 to rindex(s, 0) on nobu's suggestion. Faster.
23
-
24
- * 5 bug fixes:
25
-
26
- * 1.9: Added encoding normalization in mu_pp.
27
- * 1.9: Fixed backtrace filtering (BTs are expanded now)
28
- * Added back exception_details to assert_raises. DOH.
29
- * Fixed shadowed variable in mock.rb
30
- * Fixed stupid muscle memory message bug in assert_send.
31
-
32
- === 1.2.1 / 2008-06-10
33
-
34
- * 7 minor enhancements:
35
-
36
- * Added deprecations everywhere in test/unit.
37
- * Added test_order to TestCase. :random on mini, :sorted on test/unit (for now).
38
- * Big cleanup in test/unit for rails. Thanks Jeremy Kemper!
39
- * Minor readability cleanup.
40
- * Pushed setup/run/teardown down to testcase allowing specialized testcases.
41
- * Removed pp. Tests run 2x faster. :/
42
- * Renamed deprecation methods and moved to test/unit/deprecate.rb.
43
-
44
- === 1.2.0 / 2008-06-09
45
-
46
- * 2 major enhancements:
47
-
48
- * Added Mini::Spec.
49
- * Added Mini::Mock. Thanks Steven Baker!!
50
-
51
- * 23 minor enhancements:
52
-
53
- * Added bin/use_miniunit to make it easy to test out miniunit.
54
- * Added -n filtering, thanks to Phil Hagelberg!
55
- * Added args argument to #run, takes ARGV from at_exit.
56
- * Added test name output if $DEBUG.
57
- * Added a refute (was deny) for every assert.
58
- * Added capture_io and a bunch of nice assertions from zentest.
59
- * Added deprecation mechanism for assert_no/not methods to test/unit/assertions.
60
- * Added pp output when available.
61
- * Added tests for all assertions. Pretty much maxed out coverage.
62
- * Added tests to verify consistency and good naming.
63
- * Aliased and deprecated all ugly assertions.
64
- * Cleaned out test/unit. Moved autorun there.
65
- * Code cleanup to make extensions easier. Thanks Chad!
66
- * Got spec args reversed in all but a couple assertions. Much more readable.
67
- * Improved error messages across the board. Adds your message to the default.
68
- * Moved into Mini namespace, renamed to Mini::Test and Mini::Spec.
69
- * Pulled the assertions into their own module...
70
- * Removed as much code as I could while still maintaining full functionality.
71
- * Moved filter_backtrace into MiniTest.
72
- * Removed MiniTest::Unit::run. Unnecessary.
73
- * Removed location_of_failure. Unnecessary.
74
- * Rewrote test/unit's filter_backtrace. Flog from 37.0 to 18.1
75
- * Removed assert_send. Google says it is never used.
76
- * Renamed MiniTest::Unit.autotest to #run.
77
- * Renamed deny to refute.
78
- * Rewrote some ugly/confusing default assertion messages.
79
- * assert_in_delta now defaults to 0.001 precision. Makes specs prettier.
80
-
81
- * 9 bug fixes:
82
-
83
- * Fixed assert_raises to raise outside of the inner-begin/rescue.
84
- * Fixed for ruby 1.9 and rubinius.
85
- * No longer exits 0 if exception in code PRE-test run causes early exit.
86
- * Removed implementors method list from mini/test.rb - too stale.
87
- * assert_nothing_raised takes a class as an arg. wtf? STUPID
88
- * ".EF" output is now unbuffered.
89
- * Bunch of changes to get working with rails... UGH.
90
- * Added stupid hacks to deal with rails not requiring their dependencies.
91
- * Now bitch loudly if someone defines one of my classes instead of requiring.
92
- * Fixed infect method to work better on 1.9.
93
- * Fixed all shadowed variable warnings in 1.9.
94
-
95
- === 1.1.0 / 2007-11-08
96
-
97
- * 4 major enhancements:
98
-
99
- * Finished writing all missing assertions.
100
- * Output matches original test/unit.
101
- * Documented every method needed by language implementor.
102
- * Fully switched over to self-testing setup.
103
-
104
- * 2 minor enhancements:
105
-
106
- * Added deny (assert ! test), our favorite extension to test/unit.
107
- * Added .autotest and fairly complete unit tests. (thanks Chad for help here)
108
-
109
- === 1.0.0 / 2006-10-30
110
-
111
- * 1 major enhancement
112
-
113
- * Birthday!
114
-
data/README.txt DELETED
@@ -1,56 +0,0 @@
1
- = minitest/{unit,spec,mock}
2
-
3
- * http://rubyforge.org/projects/bfts
4
-
5
- == DESCRIPTION:
6
-
7
- minitest/unit is a small and fast replacement for ruby's huge and slow
8
- test/unit. This is meant to be clean and easy to use both as a regular
9
- test writer and for language implementors that need a minimal set of
10
- methods to bootstrap a working unit test suite.
11
-
12
- mini/spec is a functionally complete spec engine.
13
-
14
- mini/mock, by Steven Baker, is a beautifully tiny mock object framework.
15
-
16
- (This package was called miniunit once upon a time)
17
-
18
- == FEATURES/PROBLEMS:
19
-
20
- * Contains minitest/unit - a simple and clean test system (301 lines!).
21
- * Contains minitest/spec - a simple and clean spec system (52 lines!).
22
- * Contains minitest/mock - a simple and clean mock system (35 lines!).
23
- * Incredibly small and fast runner, but no bells and whistles.
24
-
25
- == REQUIREMENTS:
26
-
27
- + Ruby 1.8, maybe even 1.6 or lower. No magic is involved.
28
-
29
- == INSTALL:
30
-
31
- + sudo gem install minitest
32
-
33
- == LICENSE:
34
-
35
- (The MIT License)
36
-
37
- Copyright (c) Ryan Davis, Seattle.rb
38
-
39
- Permission is hereby granted, free of charge, to any person obtaining
40
- a copy of this software and associated documentation files (the
41
- 'Software'), to deal in the Software without restriction, including
42
- without limitation the rights to use, copy, modify, merge, publish,
43
- distribute, sublicense, and/or sell copies of the Software, and to
44
- permit persons to whom the Software is furnished to do so, subject to
45
- the following conditions:
46
-
47
- The above copyright notice and this permission notice shall be
48
- included in all copies or substantial portions of the Software.
49
-
50
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
51
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
52
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
53
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
54
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
55
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
56
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/lib/minitest/mock.rb DELETED
@@ -1,31 +0,0 @@
1
- class MockExpectationError < StandardError; end
2
-
3
- module MiniTest
4
- class Mock
5
- def initialize
6
- @expected_calls = {}
7
- @actual_calls = Hash.new {|h,k| h[k] = [] }
8
- end
9
-
10
- def expect(name, retval, args=[])
11
- n, r, a = name, retval, args # for the closure below
12
- @expected_calls[name] = { :retval => retval, :args => args }
13
- self.class.__send__(:define_method, name) { |*x|
14
- raise ArgumentError unless @expected_calls[n][:args].size == x.size
15
- @actual_calls[n] << { :retval => r, :args => x }
16
- retval
17
- }
18
- self
19
- end
20
-
21
- def verify
22
- @expected_calls.each_key do |name|
23
- expected = @expected_calls[name]
24
- msg = "expected #{name}, #{expected.inspect}"
25
- raise MockExpectationError, msg unless
26
- @actual_calls.has_key? name and @actual_calls[name].include?(expected)
27
- end
28
- true
29
- end
30
- end
31
- end