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,815 +0,0 @@
1
- require "optparse"
2
- require "thread"
3
- require "mutex_m"
4
- require "minitest/parallel"
5
-
6
- ##
7
- # :include: README.rdoc
8
-
9
- module Minitest
10
- VERSION = "5.9.0" # :nodoc:
11
- ENCS = "".respond_to? :encoding # :nodoc:
12
-
13
- @@installed_at_exit ||= false
14
- @@after_run = []
15
- @extensions = []
16
-
17
- mc = (class << self; self; end)
18
-
19
- ##
20
- # Parallel test executor
21
-
22
- mc.send :attr_accessor, :parallel_executor
23
- self.parallel_executor = Parallel::Executor.new((ENV["N"] || 2).to_i)
24
-
25
- ##
26
- # Filter object for backtraces.
27
-
28
- mc.send :attr_accessor, :backtrace_filter
29
-
30
- ##
31
- # Reporter object to be used for all runs.
32
- #
33
- # NOTE: This accessor is only available during setup, not during runs.
34
-
35
- mc.send :attr_accessor, :reporter
36
-
37
- ##
38
- # Names of known extension plugins.
39
-
40
- mc.send :attr_accessor, :extensions
41
-
42
- ##
43
- # The signal to use for dumping information to STDERR. Defaults to "INFO".
44
-
45
- mc.send :attr_accessor, :info_signal
46
- self.info_signal = "INFO"
47
-
48
- ##
49
- # Registers Minitest to run at process exit
50
-
51
- def self.autorun
52
- at_exit {
53
- next if $! and not ($!.kind_of? SystemExit and $!.success?)
54
-
55
- exit_code = nil
56
-
57
- at_exit {
58
- @@after_run.reverse_each(&:call)
59
- exit exit_code || false
60
- }
61
-
62
- exit_code = Minitest.run ARGV
63
- } unless @@installed_at_exit
64
- @@installed_at_exit = true
65
- end
66
-
67
- ##
68
- # A simple hook allowing you to run a block of code after everything
69
- # is done running. Eg:
70
- #
71
- # Minitest.after_run { p $debugging_info }
72
-
73
- def self.after_run &block
74
- @@after_run << block
75
- end
76
-
77
- def self.init_plugins options # :nodoc:
78
- self.extensions.each do |name|
79
- msg = "plugin_#{name}_init"
80
- send msg, options if self.respond_to? msg
81
- end
82
- end
83
-
84
- def self.load_plugins # :nodoc:
85
- return unless self.extensions.empty?
86
-
87
- seen = {}
88
-
89
- require "rubygems" unless defined? Gem
90
-
91
- Gem.find_files("minitest/*_plugin.rb").each do |plugin_path|
92
- name = File.basename plugin_path, "_plugin.rb"
93
-
94
- next if seen[name]
95
- seen[name] = true
96
-
97
- require plugin_path
98
- self.extensions << name
99
- end
100
- end
101
-
102
- ##
103
- # This is the top-level run method. Everything starts from here. It
104
- # tells each Runnable sub-class to run, and each of those are
105
- # responsible for doing whatever they do.
106
- #
107
- # The overall structure of a run looks like this:
108
- #
109
- # Minitest.autorun
110
- # Minitest.run(args)
111
- # Minitest.__run(reporter, options)
112
- # Runnable.runnables.each
113
- # runnable.run(reporter, options)
114
- # self.runnable_methods.each
115
- # self.run_one_method(self, runnable_method, reporter)
116
- # Minitest.run_one_method(klass, runnable_method)
117
- # klass.new(runnable_method).run
118
-
119
- def self.run args = []
120
- self.load_plugins
121
-
122
- options = process_args args
123
-
124
- reporter = CompositeReporter.new
125
- reporter << SummaryReporter.new(options[:io], options)
126
- reporter << ProgressReporter.new(options[:io], options)
127
-
128
- self.reporter = reporter # this makes it available to plugins
129
- self.init_plugins options
130
- self.reporter = nil # runnables shouldn't depend on the reporter, ever
131
-
132
- self.parallel_executor.start if parallel_executor.respond_to?(:start)
133
- reporter.start
134
- begin
135
- __run reporter, options
136
- rescue Interrupt
137
- warn "Interrupted. Exiting..."
138
- end
139
- self.parallel_executor.shutdown
140
- reporter.report
141
-
142
- reporter.passed?
143
- end
144
-
145
- ##
146
- # Internal run method. Responsible for telling all Runnable
147
- # sub-classes to run.
148
-
149
- def self.__run reporter, options
150
- suites = Runnable.runnables.shuffle
151
- parallel, serial = suites.partition { |s| s.test_order == :parallel }
152
-
153
- # If we run the parallel tests before the serial tests, the parallel tests
154
- # could run in parallel with the serial tests. This would be bad because
155
- # the serial tests won't lock around Reporter#record. Run the serial tests
156
- # first, so that after they complete, the parallel tests will lock when
157
- # recording results.
158
- serial.map { |suite| suite.run reporter, options } +
159
- parallel.map { |suite| suite.run reporter, options }
160
- end
161
-
162
- def self.process_args args = [] # :nodoc:
163
- options = {
164
- :io => $stdout,
165
- }
166
- orig_args = args.dup
167
-
168
- OptionParser.new do |opts|
169
- opts.banner = "minitest options:"
170
- opts.version = Minitest::VERSION
171
-
172
- opts.on "-h", "--help", "Display this help." do
173
- puts opts
174
- exit
175
- end
176
-
177
- desc = "Sets random seed. Also via env. Eg: SEED=n rake"
178
- opts.on "-s", "--seed SEED", Integer, desc do |m|
179
- options[:seed] = m.to_i
180
- end
181
-
182
- opts.on "-v", "--verbose", "Verbose. Show progress processing files." do
183
- options[:verbose] = true
184
- end
185
-
186
- opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
187
- options[:filter] = a
188
- end
189
-
190
- opts.on "-e", "--exclude PATTERN", "Exclude /regexp/ or string from run." do |a|
191
- options[:exclude] = a
192
- end
193
-
194
- unless extensions.empty?
195
- opts.separator ""
196
- opts.separator "Known extensions: #{extensions.join(", ")}"
197
-
198
- extensions.each do |meth|
199
- msg = "plugin_#{meth}_options"
200
- send msg, opts, options if self.respond_to?(msg)
201
- end
202
- end
203
-
204
- begin
205
- opts.parse! args
206
- rescue OptionParser::InvalidOption => e
207
- puts
208
- puts e
209
- puts
210
- puts opts
211
- exit 1
212
- end
213
-
214
- orig_args -= args
215
- end
216
-
217
- unless options[:seed] then
218
- srand
219
- options[:seed] = (ENV["SEED"] || srand).to_i % 0xFFFF
220
- orig_args << "--seed" << options[:seed].to_s
221
- end
222
-
223
- srand options[:seed]
224
-
225
- options[:args] = orig_args.map { |s|
226
- s =~ /[\s|&<>$()]/ ? s.inspect : s
227
- }.join " "
228
-
229
- options
230
- end
231
-
232
- def self.filter_backtrace bt # :nodoc:
233
- backtrace_filter.filter bt
234
- end
235
-
236
- ##
237
- # Represents anything "runnable", like Test, Spec, Benchmark, or
238
- # whatever you can dream up.
239
- #
240
- # Subclasses of this are automatically registered and available in
241
- # Runnable.runnables.
242
-
243
- class Runnable
244
- ##
245
- # Number of assertions executed in this run.
246
-
247
- attr_accessor :assertions
248
-
249
- ##
250
- # An assertion raised during the run, if any.
251
-
252
- attr_accessor :failures
253
-
254
- ##
255
- # Name of the run.
256
-
257
- def name
258
- @NAME
259
- end
260
-
261
- ##
262
- # Set the name of the run.
263
-
264
- def name= o
265
- @NAME = o
266
- end
267
-
268
- def self.inherited klass # :nodoc:
269
- self.runnables << klass
270
- super
271
- end
272
-
273
- ##
274
- # Returns all instance methods matching the pattern +re+.
275
-
276
- def self.methods_matching re
277
- public_instance_methods(true).grep(re).map(&:to_s)
278
- end
279
-
280
- def self.reset # :nodoc:
281
- @@runnables = []
282
- end
283
-
284
- reset
285
-
286
- ##
287
- # Responsible for running all runnable methods in a given class,
288
- # each in its own instance. Each instance is passed to the
289
- # reporter to record.
290
-
291
- def self.run reporter, options = {}
292
- filter = options[:filter] || "/./"
293
- filter = Regexp.new $1 if filter =~ %r%/(.*)/%
294
-
295
- filtered_methods = self.runnable_methods.find_all { |m|
296
- filter === m || filter === "#{self}##{m}"
297
- }
298
-
299
- exclude = options[:exclude]
300
- exclude = Regexp.new $1 if exclude =~ %r%/(.*)/%
301
-
302
- filtered_methods.delete_if { |m|
303
- exclude === m || exclude === "#{self}##{m}"
304
- }
305
-
306
- return if filtered_methods.empty?
307
-
308
- with_info_handler reporter do
309
- filtered_methods.each do |method_name|
310
- run_one_method self, method_name, reporter
311
- end
312
- end
313
- end
314
-
315
- ##
316
- # Runs a single method and has the reporter record the result.
317
- # This was considered internal API but is factored out of run so
318
- # that subclasses can specialize the running of an individual
319
- # test. See Minitest::ParallelTest::ClassMethods for an example.
320
-
321
- def self.run_one_method klass, method_name, reporter
322
- reporter.record Minitest.run_one_method(klass, method_name)
323
- end
324
-
325
- def self.with_info_handler reporter, &block # :nodoc:
326
- handler = lambda do
327
- unless reporter.passed? then
328
- warn "Current results:"
329
- warn ""
330
- warn reporter.reporters.first
331
- warn ""
332
- end
333
- end
334
-
335
- on_signal ::Minitest.info_signal, handler, &block
336
- end
337
-
338
- SIGNALS = Signal.list # :nodoc:
339
-
340
- def self.on_signal name, action # :nodoc:
341
- supported = SIGNALS[name]
342
-
343
- old_trap = trap name do
344
- old_trap.call if old_trap.respond_to? :call
345
- action.call
346
- end if supported
347
-
348
- yield
349
- ensure
350
- trap name, old_trap if supported
351
- end
352
-
353
- ##
354
- # Each subclass of Runnable is responsible for overriding this
355
- # method to return all runnable methods. See #methods_matching.
356
-
357
- def self.runnable_methods
358
- raise NotImplementedError, "subclass responsibility"
359
- end
360
-
361
- ##
362
- # Returns all subclasses of Runnable.
363
-
364
- def self.runnables
365
- @@runnables
366
- end
367
-
368
- def marshal_dump # :nodoc:
369
- [self.name, self.failures, self.assertions]
370
- end
371
-
372
- def marshal_load ary # :nodoc:
373
- self.name, self.failures, self.assertions = ary
374
- end
375
-
376
- def failure # :nodoc:
377
- self.failures.first
378
- end
379
-
380
- def initialize name # :nodoc:
381
- self.name = name
382
- self.failures = []
383
- self.assertions = 0
384
- end
385
-
386
- ##
387
- # Runs a single method. Needs to return self.
388
-
389
- def run
390
- raise NotImplementedError, "subclass responsibility"
391
- end
392
-
393
- ##
394
- # Did this run pass?
395
- #
396
- # Note: skipped runs are not considered passing, but they don't
397
- # cause the process to exit non-zero.
398
-
399
- def passed?
400
- raise NotImplementedError, "subclass responsibility"
401
- end
402
-
403
- ##
404
- # Returns a single character string to print based on the result
405
- # of the run. Eg ".", "F", or "E".
406
-
407
- def result_code
408
- raise NotImplementedError, "subclass responsibility"
409
- end
410
-
411
- ##
412
- # Was this run skipped? See #passed? for more information.
413
-
414
- def skipped?
415
- raise NotImplementedError, "subclass responsibility"
416
- end
417
- end
418
-
419
- ##
420
- # Defines the API for Reporters. Subclass this and override whatever
421
- # you want. Go nuts.
422
-
423
- class AbstractReporter
424
- include Mutex_m
425
-
426
- ##
427
- # Starts reporting on the run.
428
-
429
- def start
430
- end
431
-
432
- ##
433
- # Record a result and output the Runnable#result_code. Stores the
434
- # result of the run if the run did not pass.
435
-
436
- def record result
437
- end
438
-
439
- ##
440
- # Outputs the summary of the run.
441
-
442
- def report
443
- end
444
-
445
- ##
446
- # Did this run pass?
447
-
448
- def passed?
449
- true
450
- end
451
- end
452
-
453
- class Reporter < AbstractReporter # :nodoc:
454
- ##
455
- # The IO used to report.
456
-
457
- attr_accessor :io
458
-
459
- ##
460
- # Command-line options for this run.
461
-
462
- attr_accessor :options
463
-
464
- def initialize io = $stdout, options = {} # :nodoc:
465
- super()
466
- self.io = io
467
- self.options = options
468
- end
469
- end
470
-
471
- ##
472
- # A very simple reporter that prints the "dots" during the run.
473
- #
474
- # This is added to the top-level CompositeReporter at the start of
475
- # the run. If you want to change the output of minitest via a
476
- # plugin, pull this out of the composite and replace it with your
477
- # own.
478
-
479
- class ProgressReporter < Reporter
480
- def record result # :nodoc:
481
- io.print "%s#%s = %.2f s = " % [result.class, result.name, result.time] if
482
- options[:verbose]
483
- io.print result.result_code
484
- io.puts if options[:verbose]
485
- end
486
- end
487
-
488
- ##
489
- # A reporter that gathers statistics about a test run. Does not do
490
- # any IO because meant to be used as a parent class for a reporter
491
- # that does.
492
- #
493
- # If you want to create an entirely different type of output (eg,
494
- # CI, HTML, etc), this is the place to start.
495
-
496
- class StatisticsReporter < Reporter
497
- # :stopdoc:
498
- attr_accessor :assertions
499
- attr_accessor :count
500
- attr_accessor :results
501
- attr_accessor :start_time
502
- attr_accessor :total_time
503
- attr_accessor :failures
504
- attr_accessor :errors
505
- attr_accessor :skips
506
- # :startdoc:
507
-
508
- def initialize io = $stdout, options = {} # :nodoc:
509
- super
510
-
511
- self.assertions = 0
512
- self.count = 0
513
- self.results = []
514
- self.start_time = nil
515
- self.total_time = nil
516
- self.failures = nil
517
- self.errors = nil
518
- self.skips = nil
519
- end
520
-
521
- def passed? # :nodoc:
522
- results.all?(&:skipped?)
523
- end
524
-
525
- def start # :nodoc:
526
- self.start_time = Minitest.clock_time
527
- end
528
-
529
- def record result # :nodoc:
530
- self.count += 1
531
- self.assertions += result.assertions
532
-
533
- results << result if not result.passed? or result.skipped?
534
- end
535
-
536
- def report # :nodoc:
537
- aggregate = results.group_by { |r| r.failure.class }
538
- aggregate.default = [] # dumb. group_by should provide this
539
-
540
- self.total_time = Minitest.clock_time - start_time
541
- self.failures = aggregate[Assertion].size
542
- self.errors = aggregate[UnexpectedError].size
543
- self.skips = aggregate[Skip].size
544
- end
545
- end
546
-
547
- ##
548
- # A reporter that prints the header, summary, and failure details at
549
- # the end of the run.
550
- #
551
- # This is added to the top-level CompositeReporter at the start of
552
- # the run. If you want to change the output of minitest via a
553
- # plugin, pull this out of the composite and replace it with your
554
- # own.
555
-
556
- class SummaryReporter < StatisticsReporter
557
- # :stopdoc:
558
- attr_accessor :sync
559
- attr_accessor :old_sync
560
- # :startdoc:
561
-
562
- def start # :nodoc:
563
- super
564
-
565
- io.puts "Run options: #{options[:args]}"
566
- io.puts
567
- io.puts "# Running:"
568
- io.puts
569
-
570
- self.sync = io.respond_to? :"sync=" # stupid emacs
571
- self.old_sync, io.sync = io.sync, true if self.sync
572
- end
573
-
574
- def report # :nodoc:
575
- super
576
-
577
- io.sync = self.old_sync
578
-
579
- io.puts unless options[:verbose] # finish the dots
580
- io.puts
581
- io.puts statistics
582
- io.puts aggregated_results
583
- io.puts summary
584
- end
585
-
586
- def statistics # :nodoc:
587
- "Finished in %.6fs, %.4f runs/s, %.4f assertions/s." %
588
- [total_time, count / total_time, assertions / total_time]
589
- end
590
-
591
- def aggregated_results # :nodoc:
592
- filtered_results = results.dup
593
- filtered_results.reject!(&:skipped?) unless options[:verbose]
594
-
595
- s = filtered_results.each_with_index.map { |result, i|
596
- "\n%3d) %s" % [i+1, result]
597
- }.join("\n") + "\n"
598
-
599
- s.force_encoding(io.external_encoding) if
600
- ENCS and io.external_encoding and s.encoding != io.external_encoding
601
-
602
- s
603
- end
604
-
605
- alias to_s aggregated_results
606
-
607
- def summary # :nodoc:
608
- extra = ""
609
-
610
- extra = "\n\nYou have skipped tests. Run with --verbose for details." if
611
- results.any?(&:skipped?) unless options[:verbose] or ENV["MT_NO_SKIP_MSG"]
612
-
613
- "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
614
- [count, assertions, failures, errors, skips, extra]
615
- end
616
- end
617
-
618
- ##
619
- # Dispatch to multiple reporters as one.
620
-
621
- class CompositeReporter < AbstractReporter
622
- ##
623
- # The list of reporters to dispatch to.
624
-
625
- attr_accessor :reporters
626
-
627
- def initialize *reporters # :nodoc:
628
- super()
629
- self.reporters = reporters
630
- end
631
-
632
- def io # :nodoc:
633
- reporters.first.io
634
- end
635
-
636
- ##
637
- # Add another reporter to the mix.
638
-
639
- def << reporter
640
- self.reporters << reporter
641
- end
642
-
643
- def passed? # :nodoc:
644
- self.reporters.all?(&:passed?)
645
- end
646
-
647
- def start # :nodoc:
648
- self.reporters.each(&:start)
649
- end
650
-
651
- def record result # :nodoc:
652
- self.reporters.each do |reporter|
653
- reporter.record result
654
- end
655
- end
656
-
657
- def report # :nodoc:
658
- self.reporters.each(&:report)
659
- end
660
- end
661
-
662
- ##
663
- # Represents run failures.
664
-
665
- class Assertion < Exception
666
- def error # :nodoc:
667
- self
668
- end
669
-
670
- ##
671
- # Where was this run before an assertion was raised?
672
-
673
- def location
674
- last_before_assertion = ""
675
- self.backtrace.reverse_each do |s|
676
- break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
677
- last_before_assertion = s
678
- end
679
- last_before_assertion.sub(/:in .*$/, "")
680
- end
681
-
682
- def result_code # :nodoc:
683
- result_label[0, 1]
684
- end
685
-
686
- def result_label # :nodoc:
687
- "Failure"
688
- end
689
- end
690
-
691
- ##
692
- # Assertion raised when skipping a run.
693
-
694
- class Skip < Assertion
695
- def result_label # :nodoc:
696
- "Skipped"
697
- end
698
- end
699
-
700
- ##
701
- # Assertion wrapping an unexpected error that was raised during a run.
702
-
703
- class UnexpectedError < Assertion
704
- attr_accessor :exception # :nodoc:
705
-
706
- def initialize exception # :nodoc:
707
- super "Unexpected exception"
708
- self.exception = exception
709
- end
710
-
711
- def backtrace # :nodoc:
712
- self.exception.backtrace
713
- end
714
-
715
- def error # :nodoc:
716
- self.exception
717
- end
718
-
719
- def message # :nodoc:
720
- bt = Minitest.filter_backtrace(self.backtrace).join "\n "
721
- "#{self.exception.class}: #{self.exception.message}\n #{bt}"
722
- end
723
-
724
- def result_label # :nodoc:
725
- "Error"
726
- end
727
- end
728
-
729
- ##
730
- # Provides a simple set of guards that you can use in your tests
731
- # to skip execution if it is not applicable. These methods are
732
- # mixed into Test as both instance and class methods so you
733
- # can use them inside or outside of the test methods.
734
- #
735
- # def test_something_for_mri
736
- # skip "bug 1234" if jruby?
737
- # # ...
738
- # end
739
- #
740
- # if windows? then
741
- # # ... lots of test methods ...
742
- # end
743
-
744
- module Guard
745
-
746
- ##
747
- # Is this running on jruby?
748
-
749
- def jruby? platform = RUBY_PLATFORM
750
- "java" == platform
751
- end
752
-
753
- ##
754
- # Is this running on maglev?
755
-
756
- def maglev? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
757
- "maglev" == platform
758
- end
759
-
760
- ##
761
- # Is this running on mri?
762
-
763
- def mri? platform = RUBY_DESCRIPTION
764
- /^ruby/ =~ platform
765
- end
766
-
767
- ##
768
- # Is this running on rubinius?
769
-
770
- def rubinius? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
771
- "rbx" == platform
772
- end
773
-
774
- ##
775
- # Is this running on windows?
776
-
777
- def windows? platform = RUBY_PLATFORM
778
- /mswin|mingw/ =~ platform
779
- end
780
- end
781
-
782
- class BacktraceFilter # :nodoc:
783
- def filter bt
784
- return ["No backtrace"] unless bt
785
-
786
- return bt.dup if $DEBUG
787
-
788
- new_bt = bt.take_while { |line| line !~ /lib\/minitest/ }
789
- new_bt = bt.select { |line| line !~ /lib\/minitest/ } if new_bt.empty?
790
- new_bt = bt.dup if new_bt.empty?
791
-
792
- new_bt
793
- end
794
- end
795
-
796
- self.backtrace_filter = BacktraceFilter.new
797
-
798
- def self.run_one_method klass, method_name # :nodoc:
799
- result = klass.new(method_name).run
800
- raise "#{klass}#run _must_ return self" unless klass === result
801
- result
802
- end
803
-
804
- if defined? Process::CLOCK_MONOTONIC
805
- def self.clock_time
806
- Process.clock_gettime Process::CLOCK_MONOTONIC
807
- end
808
- else
809
- def self.clock_time
810
- Time.now
811
- end
812
- end
813
- end
814
-
815
- require "minitest/test"