mercadopago-custom-checkout 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +5 -5
  2. data/.gs/bin/rake +12 -8
  3. data/.gs/specifications/rake-10.5.0.gemspec +24 -28
  4. data/.tool-versions +1 -0
  5. data/lib/mercadopago/custom_checkout/version.rb +1 -1
  6. data/mercadopago-custom-checkout.gemspec +3 -3
  7. metadata +14 -125
  8. data/.gs/cache/faraday-0.9.2.gem +0 -0
  9. data/.gs/cache/minitest-5.9.0.gem +0 -0
  10. data/.gs/cache/multi_json-1.12.1.gem +0 -0
  11. data/.gs/cache/multipart-post-2.0.0.gem +0 -0
  12. data/.gs/gems/faraday-0.9.2/LICENSE.md +0 -20
  13. data/.gs/gems/faraday-0.9.2/README.md +0 -245
  14. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http.rb +0 -237
  15. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http_ssl_patch.rb +0 -56
  16. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony/parallel_manager.rb +0 -66
  17. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony.rb +0 -100
  18. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/excon.rb +0 -81
  19. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/httpclient.rb +0 -117
  20. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb +0 -130
  21. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb +0 -49
  22. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/patron.rb +0 -78
  23. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/rack.rb +0 -58
  24. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/test.rb +0 -162
  25. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/typhoeus.rb +0 -123
  26. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter.rb +0 -46
  27. data/.gs/gems/faraday-0.9.2/lib/faraday/autoload.rb +0 -84
  28. data/.gs/gems/faraday-0.9.2/lib/faraday/connection.rb +0 -437
  29. data/.gs/gems/faraday-0.9.2/lib/faraday/error.rb +0 -53
  30. data/.gs/gems/faraday-0.9.2/lib/faraday/middleware.rb +0 -37
  31. data/.gs/gems/faraday-0.9.2/lib/faraday/options.rb +0 -359
  32. data/.gs/gems/faraday-0.9.2/lib/faraday/parameters.rb +0 -197
  33. data/.gs/gems/faraday-0.9.2/lib/faraday/rack_builder.rb +0 -213
  34. data/.gs/gems/faraday-0.9.2/lib/faraday/request/authorization.rb +0 -42
  35. data/.gs/gems/faraday-0.9.2/lib/faraday/request/basic_authentication.rb +0 -13
  36. data/.gs/gems/faraday-0.9.2/lib/faraday/request/instrumentation.rb +0 -36
  37. data/.gs/gems/faraday-0.9.2/lib/faraday/request/multipart.rb +0 -63
  38. data/.gs/gems/faraday-0.9.2/lib/faraday/request/retry.rb +0 -154
  39. data/.gs/gems/faraday-0.9.2/lib/faraday/request/token_authentication.rb +0 -15
  40. data/.gs/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb +0 -36
  41. data/.gs/gems/faraday-0.9.2/lib/faraday/request.rb +0 -92
  42. data/.gs/gems/faraday-0.9.2/lib/faraday/response/logger.rb +0 -59
  43. data/.gs/gems/faraday-0.9.2/lib/faraday/response/raise_error.rb +0 -21
  44. data/.gs/gems/faraday-0.9.2/lib/faraday/response.rb +0 -93
  45. data/.gs/gems/faraday-0.9.2/lib/faraday/upload_io.rb +0 -67
  46. data/.gs/gems/faraday-0.9.2/lib/faraday/utils.rb +0 -309
  47. data/.gs/gems/faraday-0.9.2/lib/faraday.rb +0 -268
  48. data/.gs/gems/minitest-5.9.0/.autotest +0 -34
  49. data/.gs/gems/minitest-5.9.0/History.rdoc +0 -1176
  50. data/.gs/gems/minitest-5.9.0/Manifest.txt +0 -26
  51. data/.gs/gems/minitest-5.9.0/README.rdoc +0 -656
  52. data/.gs/gems/minitest-5.9.0/Rakefile +0 -72
  53. data/.gs/gems/minitest-5.9.0/design_rationale.rb +0 -52
  54. data/.gs/gems/minitest-5.9.0/lib/hoe/minitest.rb +0 -26
  55. data/.gs/gems/minitest-5.9.0/lib/minitest/assertions.rb +0 -674
  56. data/.gs/gems/minitest-5.9.0/lib/minitest/autorun.rb +0 -13
  57. data/.gs/gems/minitest-5.9.0/lib/minitest/benchmark.rb +0 -424
  58. data/.gs/gems/minitest-5.9.0/lib/minitest/expectations.rb +0 -284
  59. data/.gs/gems/minitest-5.9.0/lib/minitest/hell.rb +0 -17
  60. data/.gs/gems/minitest-5.9.0/lib/minitest/mock.rb +0 -232
  61. data/.gs/gems/minitest-5.9.0/lib/minitest/parallel.rb +0 -69
  62. data/.gs/gems/minitest-5.9.0/lib/minitest/pride.rb +0 -4
  63. data/.gs/gems/minitest-5.9.0/lib/minitest/pride_plugin.rb +0 -142
  64. data/.gs/gems/minitest-5.9.0/lib/minitest/spec.rb +0 -331
  65. data/.gs/gems/minitest-5.9.0/lib/minitest/test.rb +0 -284
  66. data/.gs/gems/minitest-5.9.0/lib/minitest/unit.rb +0 -45
  67. data/.gs/gems/minitest-5.9.0/lib/minitest.rb +0 -815
  68. data/.gs/gems/minitest-5.9.0/test/minitest/metametameta.rb +0 -90
  69. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_benchmark.rb +0 -137
  70. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_mock.rb +0 -512
  71. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_reporter.rb +0 -281
  72. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_spec.rb +0 -967
  73. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_test.rb +0 -1983
  74. data/.gs/gems/multi_json-1.12.1/CHANGELOG.md +0 -245
  75. data/.gs/gems/multi_json-1.12.1/CONTRIBUTING.md +0 -46
  76. data/.gs/gems/multi_json-1.12.1/LICENSE.md +0 -20
  77. data/.gs/gems/multi_json-1.12.1/README.md +0 -121
  78. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter.rb +0 -49
  79. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter_error.rb +0 -15
  80. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/gson.rb +0 -20
  81. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/jr_jackson.rb +0 -25
  82. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_common.rb +0 -23
  83. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_gem.rb +0 -11
  84. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_pure.rb +0 -11
  85. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/nsjsonserialization.rb +0 -32
  86. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/oj.rb +0 -25
  87. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/ok_json.rb +0 -23
  88. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/yajl.rb +0 -19
  89. data/.gs/gems/multi_json-1.12.1/lib/multi_json/convertible_hash_keys.rb +0 -43
  90. data/.gs/gems/multi_json-1.12.1/lib/multi_json/options.rb +0 -39
  91. data/.gs/gems/multi_json-1.12.1/lib/multi_json/options_cache.rb +0 -29
  92. data/.gs/gems/multi_json-1.12.1/lib/multi_json/parse_error.rb +0 -17
  93. data/.gs/gems/multi_json-1.12.1/lib/multi_json/vendor/okjson.rb +0 -606
  94. data/.gs/gems/multi_json-1.12.1/lib/multi_json/version.rb +0 -17
  95. data/.gs/gems/multi_json-1.12.1/lib/multi_json.rb +0 -161
  96. data/.gs/gems/multi_json-1.12.1/multi_json.gemspec +0 -20
  97. data/.gs/gems/multipart-post-2.0.0/.gitignore +0 -6
  98. data/.gs/gems/multipart-post-2.0.0/.travis.yml +0 -7
  99. data/.gs/gems/multipart-post-2.0.0/Gemfile +0 -14
  100. data/.gs/gems/multipart-post-2.0.0/History.txt +0 -60
  101. data/.gs/gems/multipart-post-2.0.0/Manifest.txt +0 -9
  102. data/.gs/gems/multipart-post-2.0.0/README.md +0 -77
  103. data/.gs/gems/multipart-post-2.0.0/Rakefile +0 -9
  104. data/.gs/gems/multipart-post-2.0.0/lib/composite_io.rb +0 -108
  105. data/.gs/gems/multipart-post-2.0.0/lib/multipart_post.rb +0 -9
  106. data/.gs/gems/multipart-post-2.0.0/lib/multipartable.rb +0 -29
  107. data/.gs/gems/multipart-post-2.0.0/lib/net/http/post/multipart.rb +0 -27
  108. data/.gs/gems/multipart-post-2.0.0/lib/parts.rb +0 -96
  109. data/.gs/gems/multipart-post-2.0.0/multipart-post.gemspec +0 -22
  110. data/.gs/gems/multipart-post-2.0.0/test/multibyte.txt +0 -1
  111. data/.gs/gems/multipart-post-2.0.0/test/net/http/post/test_multipart.rb +0 -110
  112. data/.gs/gems/multipart-post-2.0.0/test/test_composite_io.rb +0 -115
  113. data/.gs/gems/multipart-post-2.0.0/test/test_parts.rb +0 -86
  114. data/.gs/specifications/faraday-0.9.2.gemspec +0 -31
  115. data/.gs/specifications/minitest-5.9.0.gemspec +0 -39
  116. data/.gs/specifications/multi_json-1.12.1.gemspec +0 -33
  117. data/.gs/specifications/multipart-post-2.0.0.gemspec +0 -22
  118. data/.ruby-version +0 -1
@@ -1,424 +0,0 @@
1
- require "minitest/unit"
2
- require "minitest/spec"
3
-
4
- module Minitest
5
- ##
6
- # Subclass Benchmark to create your own benchmark runs. Methods
7
- # starting with "bench_" get executed on a per-class.
8
- #
9
- # See Minitest::Assertions
10
-
11
- class Benchmark < Test
12
- def self.io # :nodoc:
13
- @io
14
- end
15
-
16
- def io # :nodoc:
17
- self.class.io
18
- end
19
-
20
- def self.run reporter, options = {} # :nodoc:
21
- @io = reporter.io
22
- super
23
- end
24
-
25
- def self.runnable_methods # :nodoc:
26
- methods_matching(/^bench_/)
27
- end
28
-
29
- ##
30
- # Returns a set of ranges stepped exponentially from +min+ to
31
- # +max+ by powers of +base+. Eg:
32
- #
33
- # bench_exp(2, 16, 2) # => [2, 4, 8, 16]
34
-
35
- def self.bench_exp min, max, base = 10
36
- min = (Math.log10(min) / Math.log10(base)).to_i
37
- max = (Math.log10(max) / Math.log10(base)).to_i
38
-
39
- (min..max).map { |m| base ** m }.to_a
40
- end
41
-
42
- ##
43
- # Returns a set of ranges stepped linearly from +min+ to +max+ by
44
- # +step+. Eg:
45
- #
46
- # bench_linear(20, 40, 10) # => [20, 30, 40]
47
-
48
- def self.bench_linear min, max, step = 10
49
- (min..max).step(step).to_a
50
- rescue LocalJumpError # 1.8.6
51
- r = []; (min..max).step(step) { |n| r << n }; r
52
- end
53
-
54
- ##
55
- # Specifies the ranges used for benchmarking for that class.
56
- # Defaults to exponential growth from 1 to 10k by powers of 10.
57
- # Override if you need different ranges for your benchmarks.
58
- #
59
- # See also: ::bench_exp and ::bench_linear.
60
-
61
- def self.bench_range
62
- bench_exp 1, 10_000
63
- end
64
-
65
- ##
66
- # Runs the given +work+, gathering the times of each run. Range
67
- # and times are then passed to a given +validation+ proc. Outputs
68
- # the benchmark name and times in tab-separated format, making it
69
- # easy to paste into a spreadsheet for graphing or further
70
- # analysis.
71
- #
72
- # Ranges are specified by ::bench_range.
73
- #
74
- # Eg:
75
- #
76
- # def bench_algorithm
77
- # validation = proc { |x, y| ... }
78
- # assert_performance validation do |n|
79
- # @obj.algorithm(n)
80
- # end
81
- # end
82
-
83
- def assert_performance validation, &work
84
- range = self.class.bench_range
85
-
86
- io.print "#{self.name}"
87
-
88
- times = []
89
-
90
- range.each do |x|
91
- GC.start
92
- t0 = Minitest.clock_time
93
- instance_exec(x, &work)
94
- t = Minitest.clock_time - t0
95
-
96
- io.print "\t%9.6f" % t
97
- times << t
98
- end
99
- io.puts
100
-
101
- validation[range, times]
102
- end
103
-
104
- ##
105
- # Runs the given +work+ and asserts that the times gathered fit to
106
- # match a constant rate (eg, linear slope == 0) within a given
107
- # +threshold+. Note: because we're testing for a slope of 0, R^2
108
- # is not a good determining factor for the fit, so the threshold
109
- # is applied against the slope itself. As such, you probably want
110
- # to tighten it from the default.
111
- #
112
- # See http://www.graphpad.com/curvefit/goodness_of_fit.htm for
113
- # more details.
114
- #
115
- # Fit is calculated by #fit_linear.
116
- #
117
- # Ranges are specified by ::bench_range.
118
- #
119
- # Eg:
120
- #
121
- # def bench_algorithm
122
- # assert_performance_constant 0.9999 do |n|
123
- # @obj.algorithm(n)
124
- # end
125
- # end
126
-
127
- def assert_performance_constant threshold = 0.99, &work
128
- validation = proc do |range, times|
129
- a, b, rr = fit_linear range, times
130
- assert_in_delta 0, b, 1 - threshold
131
- [a, b, rr]
132
- end
133
-
134
- assert_performance validation, &work
135
- end
136
-
137
- ##
138
- # Runs the given +work+ and asserts that the times gathered fit to
139
- # match a exponential curve within a given error +threshold+.
140
- #
141
- # Fit is calculated by #fit_exponential.
142
- #
143
- # Ranges are specified by ::bench_range.
144
- #
145
- # Eg:
146
- #
147
- # def bench_algorithm
148
- # assert_performance_exponential 0.9999 do |n|
149
- # @obj.algorithm(n)
150
- # end
151
- # end
152
-
153
- def assert_performance_exponential threshold = 0.99, &work
154
- assert_performance validation_for_fit(:exponential, threshold), &work
155
- end
156
-
157
- ##
158
- # Runs the given +work+ and asserts that the times gathered fit to
159
- # match a logarithmic curve within a given error +threshold+.
160
- #
161
- # Fit is calculated by #fit_logarithmic.
162
- #
163
- # Ranges are specified by ::bench_range.
164
- #
165
- # Eg:
166
- #
167
- # def bench_algorithm
168
- # assert_performance_logarithmic 0.9999 do |n|
169
- # @obj.algorithm(n)
170
- # end
171
- # end
172
-
173
- def assert_performance_logarithmic threshold = 0.99, &work
174
- assert_performance validation_for_fit(:logarithmic, threshold), &work
175
- end
176
-
177
- ##
178
- # Runs the given +work+ and asserts that the times gathered fit to
179
- # match a straight line within a given error +threshold+.
180
- #
181
- # Fit is calculated by #fit_linear.
182
- #
183
- # Ranges are specified by ::bench_range.
184
- #
185
- # Eg:
186
- #
187
- # def bench_algorithm
188
- # assert_performance_linear 0.9999 do |n|
189
- # @obj.algorithm(n)
190
- # end
191
- # end
192
-
193
- def assert_performance_linear threshold = 0.99, &work
194
- assert_performance validation_for_fit(:linear, threshold), &work
195
- end
196
-
197
- ##
198
- # Runs the given +work+ and asserts that the times gathered curve
199
- # fit to match a power curve within a given error +threshold+.
200
- #
201
- # Fit is calculated by #fit_power.
202
- #
203
- # Ranges are specified by ::bench_range.
204
- #
205
- # Eg:
206
- #
207
- # def bench_algorithm
208
- # assert_performance_power 0.9999 do |x|
209
- # @obj.algorithm
210
- # end
211
- # end
212
-
213
- def assert_performance_power threshold = 0.99, &work
214
- assert_performance validation_for_fit(:power, threshold), &work
215
- end
216
-
217
- ##
218
- # Takes an array of x/y pairs and calculates the general R^2 value.
219
- #
220
- # See: http://en.wikipedia.org/wiki/Coefficient_of_determination
221
-
222
- def fit_error xys
223
- y_bar = sigma(xys) { |_, y| y } / xys.size.to_f
224
- ss_tot = sigma(xys) { |_, y| (y - y_bar) ** 2 }
225
- ss_err = sigma(xys) { |x, y| (yield(x) - y) ** 2 }
226
-
227
- 1 - (ss_err / ss_tot)
228
- end
229
-
230
- ##
231
- # To fit a functional form: y = ae^(bx).
232
- #
233
- # Takes x and y values and returns [a, b, r^2].
234
- #
235
- # See: http://mathworld.wolfram.com/LeastSquaresFittingExponential.html
236
-
237
- def fit_exponential xs, ys
238
- n = xs.size
239
- xys = xs.zip(ys)
240
- sxlny = sigma(xys) { |x, y| x * Math.log(y) }
241
- slny = sigma(xys) { |_, y| Math.log(y) }
242
- sx2 = sigma(xys) { |x, _| x * x }
243
- sx = sigma xs
244
-
245
- c = n * sx2 - sx ** 2
246
- a = (slny * sx2 - sx * sxlny) / c
247
- b = ( n * sxlny - sx * slny ) / c
248
-
249
- return Math.exp(a), b, fit_error(xys) { |x| Math.exp(a + b * x) }
250
- end
251
-
252
- ##
253
- # To fit a functional form: y = a + b*ln(x).
254
- #
255
- # Takes x and y values and returns [a, b, r^2].
256
- #
257
- # See: http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html
258
-
259
- def fit_logarithmic xs, ys
260
- n = xs.size
261
- xys = xs.zip(ys)
262
- slnx2 = sigma(xys) { |x, _| Math.log(x) ** 2 }
263
- slnx = sigma(xys) { |x, _| Math.log(x) }
264
- sylnx = sigma(xys) { |x, y| y * Math.log(x) }
265
- sy = sigma(xys) { |_, y| y }
266
-
267
- c = n * slnx2 - slnx ** 2
268
- b = ( n * sylnx - sy * slnx ) / c
269
- a = (sy - b * slnx) / n
270
-
271
- return a, b, fit_error(xys) { |x| a + b * Math.log(x) }
272
- end
273
-
274
- ##
275
- # Fits the functional form: a + bx.
276
- #
277
- # Takes x and y values and returns [a, b, r^2].
278
- #
279
- # See: http://mathworld.wolfram.com/LeastSquaresFitting.html
280
-
281
- def fit_linear xs, ys
282
- n = xs.size
283
- xys = xs.zip(ys)
284
- sx = sigma xs
285
- sy = sigma ys
286
- sx2 = sigma(xs) { |x| x ** 2 }
287
- sxy = sigma(xys) { |x, y| x * y }
288
-
289
- c = n * sx2 - sx**2
290
- a = (sy * sx2 - sx * sxy) / c
291
- b = ( n * sxy - sx * sy ) / c
292
-
293
- return a, b, fit_error(xys) { |x| a + b * x }
294
- end
295
-
296
- ##
297
- # To fit a functional form: y = ax^b.
298
- #
299
- # Takes x and y values and returns [a, b, r^2].
300
- #
301
- # See: http://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
302
-
303
- def fit_power xs, ys
304
- n = xs.size
305
- xys = xs.zip(ys)
306
- slnxlny = sigma(xys) { |x, y| Math.log(x) * Math.log(y) }
307
- slnx = sigma(xs) { |x | Math.log(x) }
308
- slny = sigma(ys) { | y| Math.log(y) }
309
- slnx2 = sigma(xs) { |x | Math.log(x) ** 2 }
310
-
311
- b = (n * slnxlny - slnx * slny) / (n * slnx2 - slnx ** 2)
312
- a = (slny - b * slnx) / n
313
-
314
- return Math.exp(a), b, fit_error(xys) { |x| (Math.exp(a) * (x ** b)) }
315
- end
316
-
317
- ##
318
- # Enumerates over +enum+ mapping +block+ if given, returning the
319
- # sum of the result. Eg:
320
- #
321
- # sigma([1, 2, 3]) # => 1 + 2 + 3 => 7
322
- # sigma([1, 2, 3]) { |n| n ** 2 } # => 1 + 4 + 9 => 14
323
-
324
- def sigma enum, &block
325
- enum = enum.map(&block) if block
326
- enum.inject { |sum, n| sum + n }
327
- end
328
-
329
- ##
330
- # Returns a proc that calls the specified fit method and asserts
331
- # that the error is within a tolerable threshold.
332
-
333
- def validation_for_fit msg, threshold
334
- proc do |range, times|
335
- a, b, rr = send "fit_#{msg}", range, times
336
- assert_operator rr, :>=, threshold
337
- [a, b, rr]
338
- end
339
- end
340
- end
341
- end
342
-
343
- module Minitest
344
- ##
345
- # The spec version of Minitest::Benchmark.
346
-
347
- class BenchSpec < Benchmark
348
- extend Minitest::Spec::DSL
349
-
350
- ##
351
- # This is used to define a new benchmark method. You usually don't
352
- # use this directly and is intended for those needing to write new
353
- # performance curve fits (eg: you need a specific polynomial fit).
354
- #
355
- # See ::bench_performance_linear for an example of how to use this.
356
-
357
- def self.bench name, &block
358
- define_method "bench_#{name.gsub(/\W+/, "_")}", &block
359
- end
360
-
361
- ##
362
- # Specifies the ranges used for benchmarking for that class.
363
- #
364
- # bench_range do
365
- # bench_exp(2, 16, 2)
366
- # end
367
- #
368
- # See Minitest::Benchmark#bench_range for more details.
369
-
370
- def self.bench_range &block
371
- return super unless block
372
-
373
- meta = (class << self; self; end)
374
- meta.send :define_method, "bench_range", &block
375
- end
376
-
377
- ##
378
- # Create a benchmark that verifies that the performance is linear.
379
- #
380
- # describe "my class Bench" do
381
- # bench_performance_linear "fast_algorithm", 0.9999 do |n|
382
- # @obj.fast_algorithm(n)
383
- # end
384
- # end
385
-
386
- def self.bench_performance_linear name, threshold = 0.99, &work
387
- bench name do
388
- assert_performance_linear threshold, &work
389
- end
390
- end
391
-
392
- ##
393
- # Create a benchmark that verifies that the performance is constant.
394
- #
395
- # describe "my class Bench" do
396
- # bench_performance_constant "zoom_algorithm!" do |n|
397
- # @obj.zoom_algorithm!(n)
398
- # end
399
- # end
400
-
401
- def self.bench_performance_constant name, threshold = 0.99, &work
402
- bench name do
403
- assert_performance_constant threshold, &work
404
- end
405
- end
406
-
407
- ##
408
- # Create a benchmark that verifies that the performance is exponential.
409
- #
410
- # describe "my class Bench" do
411
- # bench_performance_exponential "algorithm" do |n|
412
- # @obj.algorithm(n)
413
- # end
414
- # end
415
-
416
- def self.bench_performance_exponential name, threshold = 0.99, &work
417
- bench name do
418
- assert_performance_exponential threshold, &work
419
- end
420
- end
421
- end
422
-
423
- Minitest::Spec.register_spec_type(/Bench(mark)?$/, Minitest::BenchSpec)
424
- end
@@ -1,284 +0,0 @@
1
- ##
2
- # It's where you hide your "assertions".
3
- #
4
- # Please note, because of the way that expectations are implemented,
5
- # all expectations (eg must_equal) are dependent upon a thread local
6
- # variable +:current_spec+. If your specs rely on mixing threads into
7
- # the specs themselves, you're better off using assertions or the new
8
- # _(value) wrapper. For example:
9
- #
10
- # it "should still work in threads" do
11
- # my_threaded_thingy do
12
- # (1+1).must_equal 2 # bad
13
- # assert_equal 2, 1+1 # good
14
- # _(1 + 1).must_equal 2 # good
15
- # value(1 + 1).must_equal 2 # good, also #expect
16
- # end
17
- # end
18
-
19
- module Minitest::Expectations
20
-
21
- ##
22
- # See Minitest::Assertions#assert_empty.
23
- #
24
- # collection.must_be_empty
25
- #
26
- # :method: must_be_empty
27
-
28
- infect_an_assertion :assert_empty, :must_be_empty, :unary
29
-
30
- ##
31
- # See Minitest::Assertions#assert_equal
32
- #
33
- # a.must_equal b
34
- #
35
- # :method: must_equal
36
-
37
- infect_an_assertion :assert_equal, :must_equal
38
-
39
- ##
40
- # See Minitest::Assertions#assert_in_delta
41
- #
42
- # n.must_be_close_to m [, delta]
43
- #
44
- # :method: must_be_close_to
45
-
46
- infect_an_assertion :assert_in_delta, :must_be_close_to
47
-
48
- alias :must_be_within_delta :must_be_close_to # :nodoc:
49
-
50
- ##
51
- # See Minitest::Assertions#assert_in_epsilon
52
- #
53
- # n.must_be_within_epsilon m [, epsilon]
54
- #
55
- # :method: must_be_within_epsilon
56
-
57
- infect_an_assertion :assert_in_epsilon, :must_be_within_epsilon
58
-
59
- ##
60
- # See Minitest::Assertions#assert_includes
61
- #
62
- # collection.must_include obj
63
- #
64
- # :method: must_include
65
-
66
- infect_an_assertion :assert_includes, :must_include, :reverse
67
-
68
- ##
69
- # See Minitest::Assertions#assert_instance_of
70
- #
71
- # obj.must_be_instance_of klass
72
- #
73
- # :method: must_be_instance_of
74
-
75
- infect_an_assertion :assert_instance_of, :must_be_instance_of
76
-
77
- ##
78
- # See Minitest::Assertions#assert_kind_of
79
- #
80
- # obj.must_be_kind_of mod
81
- #
82
- # :method: must_be_kind_of
83
-
84
- infect_an_assertion :assert_kind_of, :must_be_kind_of
85
-
86
- ##
87
- # See Minitest::Assertions#assert_match
88
- #
89
- # a.must_match b
90
- #
91
- # :method: must_match
92
-
93
- infect_an_assertion :assert_match, :must_match
94
-
95
- ##
96
- # See Minitest::Assertions#assert_nil
97
- #
98
- # obj.must_be_nil
99
- #
100
- # :method: must_be_nil
101
-
102
- infect_an_assertion :assert_nil, :must_be_nil, :unary
103
-
104
- ##
105
- # See Minitest::Assertions#assert_operator
106
- #
107
- # n.must_be :<=, 42
108
- #
109
- # This can also do predicates:
110
- #
111
- # str.must_be :empty?
112
- #
113
- # :method: must_be
114
-
115
- infect_an_assertion :assert_operator, :must_be, :reverse
116
-
117
- ##
118
- # See Minitest::Assertions#assert_output
119
- #
120
- # proc { ... }.must_output out_or_nil [, err]
121
- #
122
- # :method: must_output
123
-
124
- infect_an_assertion :assert_output, :must_output, :block
125
-
126
- ##
127
- # See Minitest::Assertions#assert_raises
128
- #
129
- # proc { ... }.must_raise exception
130
- #
131
- # :method: must_raise
132
-
133
- infect_an_assertion :assert_raises, :must_raise, :block
134
-
135
- ##
136
- # See Minitest::Assertions#assert_respond_to
137
- #
138
- # obj.must_respond_to msg
139
- #
140
- # :method: must_respond_to
141
-
142
- infect_an_assertion :assert_respond_to, :must_respond_to, :reverse
143
-
144
- ##
145
- # See Minitest::Assertions#assert_same
146
- #
147
- # a.must_be_same_as b
148
- #
149
- # :method: must_be_same_as
150
-
151
- infect_an_assertion :assert_same, :must_be_same_as
152
-
153
- ##
154
- # See Minitest::Assertions#assert_silent
155
- #
156
- # proc { ... }.must_be_silent
157
- #
158
- # :method: must_be_silent
159
-
160
- infect_an_assertion :assert_silent, :must_be_silent, :block
161
-
162
- ##
163
- # See Minitest::Assertions#assert_throws
164
- #
165
- # proc { ... }.must_throw sym
166
- #
167
- # :method: must_throw
168
-
169
- infect_an_assertion :assert_throws, :must_throw, :block
170
-
171
- ##
172
- # See Minitest::Assertions#refute_empty
173
- #
174
- # collection.wont_be_empty
175
- #
176
- # :method: wont_be_empty
177
-
178
- infect_an_assertion :refute_empty, :wont_be_empty, :unary
179
-
180
- ##
181
- # See Minitest::Assertions#refute_equal
182
- #
183
- # a.wont_equal b
184
- #
185
- # :method: wont_equal
186
-
187
- infect_an_assertion :refute_equal, :wont_equal
188
-
189
- ##
190
- # See Minitest::Assertions#refute_in_delta
191
- #
192
- # n.wont_be_close_to m [, delta]
193
- #
194
- # :method: wont_be_close_to
195
-
196
- infect_an_assertion :refute_in_delta, :wont_be_close_to
197
-
198
- alias :wont_be_within_delta :wont_be_close_to # :nodoc:
199
-
200
- ##
201
- # See Minitest::Assertions#refute_in_epsilon
202
- #
203
- # n.wont_be_within_epsilon m [, epsilon]
204
- #
205
- # :method: wont_be_within_epsilon
206
-
207
- infect_an_assertion :refute_in_epsilon, :wont_be_within_epsilon
208
-
209
- ##
210
- # See Minitest::Assertions#refute_includes
211
- #
212
- # collection.wont_include obj
213
- #
214
- # :method: wont_include
215
-
216
- infect_an_assertion :refute_includes, :wont_include, :reverse
217
-
218
- ##
219
- # See Minitest::Assertions#refute_instance_of
220
- #
221
- # obj.wont_be_instance_of klass
222
- #
223
- # :method: wont_be_instance_of
224
-
225
- infect_an_assertion :refute_instance_of, :wont_be_instance_of
226
-
227
- ##
228
- # See Minitest::Assertions#refute_kind_of
229
- #
230
- # obj.wont_be_kind_of mod
231
- #
232
- # :method: wont_be_kind_of
233
-
234
- infect_an_assertion :refute_kind_of, :wont_be_kind_of
235
-
236
- ##
237
- # See Minitest::Assertions#refute_match
238
- #
239
- # a.wont_match b
240
- #
241
- # :method: wont_match
242
-
243
- infect_an_assertion :refute_match, :wont_match
244
-
245
- ##
246
- # See Minitest::Assertions#refute_nil
247
- #
248
- # obj.wont_be_nil
249
- #
250
- # :method: wont_be_nil
251
-
252
- infect_an_assertion :refute_nil, :wont_be_nil, :unary
253
-
254
- ##
255
- # See Minitest::Assertions#refute_operator
256
- #
257
- # n.wont_be :<=, 42
258
- #
259
- # This can also do predicates:
260
- #
261
- # str.wont_be :empty?
262
- #
263
- # :method: wont_be
264
-
265
- infect_an_assertion :refute_operator, :wont_be, :reverse
266
-
267
- ##
268
- # See Minitest::Assertions#refute_respond_to
269
- #
270
- # obj.wont_respond_to msg
271
- #
272
- # :method: wont_respond_to
273
-
274
- infect_an_assertion :refute_respond_to, :wont_respond_to, :reverse
275
-
276
- ##
277
- # See Minitest::Assertions#refute_same
278
- #
279
- # a.wont_be_same_as b
280
- #
281
- # :method: wont_be_same_as
282
-
283
- infect_an_assertion :refute_same, :wont_be_same_as
284
- end
@@ -1,17 +0,0 @@
1
- require "minitest/parallel"
2
-
3
- class Minitest::Test
4
- class << self
5
- alias :old_test_order :test_order # :nodoc:
6
-
7
- def test_order # :nodoc:
8
- :parallel
9
- end
10
- end
11
- end
12
-
13
- begin
14
- require "minitest/proveit"
15
- rescue LoadError
16
- # do nothing
17
- end