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,331 +0,0 @@
1
- require "minitest/test"
2
-
3
- class Module # :nodoc:
4
- def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
5
- block = dont_flip == :block
6
- dont_flip = false if block
7
-
8
- # warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
9
- self.class_eval <<-EOM, __FILE__, __LINE__ + 1
10
- def #{new_name} *args
11
- Minitest::Expectation.new(self, Minitest::Spec.current).#{new_name}(*args)
12
- end
13
- EOM
14
-
15
- Minitest::Expectation.class_eval <<-EOM, __FILE__, __LINE__ + 1
16
- def #{new_name} *args
17
- case
18
- when #{!!dont_flip} then
19
- ctx.#{meth}(target, *args)
20
- when #{block} && Proc === target then
21
- ctx.#{meth}(*args, &target)
22
- else
23
- ctx.#{meth}(args.first, target, *args[1..-1])
24
- end
25
- end
26
- EOM
27
- end
28
- end
29
-
30
- Minitest::Expectation = Struct.new :target, :ctx # :nodoc:
31
-
32
- ##
33
- # Kernel extensions for minitest
34
-
35
- module Kernel
36
- ##
37
- # Describe a series of expectations for a given target +desc+.
38
- #
39
- # Defines a test class subclassing from either Minitest::Spec or
40
- # from the surrounding describe's class. The surrounding class may
41
- # subclass Minitest::Spec manually in order to easily share code:
42
- #
43
- # class MySpec < Minitest::Spec
44
- # # ... shared code ...
45
- # end
46
- #
47
- # class TestStuff < MySpec
48
- # it "does stuff" do
49
- # # shared code available here
50
- # end
51
- # describe "inner stuff" do
52
- # it "still does stuff" do
53
- # # ...and here
54
- # end
55
- # end
56
- # end
57
- #
58
- # For more information on getting started with writing specs, see:
59
- #
60
- # http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html
61
- #
62
- # For some suggestions on how to improve your specs, try:
63
- #
64
- # http://betterspecs.org
65
- #
66
- # but do note that several items there are debatable or specific to
67
- # rspec.
68
- #
69
- # For more information about expectations, see Minitest::Expectations.
70
-
71
- def describe desc, *additional_desc, &block # :doc:
72
- stack = Minitest::Spec.describe_stack
73
- name = [stack.last, desc, *additional_desc].compact.join("::")
74
- sclas = stack.last || if Class === self && kind_of?(Minitest::Spec::DSL) then
75
- self
76
- else
77
- Minitest::Spec.spec_type desc, *additional_desc
78
- end
79
-
80
- cls = sclas.create name, desc
81
-
82
- stack.push cls
83
- cls.class_eval(&block)
84
- stack.pop
85
- cls
86
- end
87
- private :describe
88
- end
89
-
90
- ##
91
- # Minitest::Spec -- The faster, better, less-magical spec framework!
92
- #
93
- # For a list of expectations, see Minitest::Expectations.
94
-
95
- class Minitest::Spec < Minitest::Test
96
-
97
- def self.current # :nodoc:
98
- Thread.current[:current_spec]
99
- end
100
-
101
- def initialize name # :nodoc:
102
- super
103
- Thread.current[:current_spec] = self
104
- end
105
-
106
- ##
107
- # Oh look! A Minitest::Spec::DSL module! Eat your heart out DHH.
108
-
109
- module DSL
110
- ##
111
- # Contains pairs of matchers and Spec classes to be used to
112
- # calculate the superclass of a top-level describe. This allows for
113
- # automatically customizable spec types.
114
- #
115
- # See: register_spec_type and spec_type
116
-
117
- TYPES = [[//, Minitest::Spec]]
118
-
119
- ##
120
- # Register a new type of spec that matches the spec's description.
121
- # This method can take either a Regexp and a spec class or a spec
122
- # class and a block that takes the description and returns true if
123
- # it matches.
124
- #
125
- # Eg:
126
- #
127
- # register_spec_type(/Controller$/, Minitest::Spec::Rails)
128
- #
129
- # or:
130
- #
131
- # register_spec_type(Minitest::Spec::RailsModel) do |desc|
132
- # desc.superclass == ActiveRecord::Base
133
- # end
134
-
135
- def register_spec_type(*args, &block)
136
- if block then
137
- matcher, klass = block, args.first
138
- else
139
- matcher, klass = *args
140
- end
141
- TYPES.unshift [matcher, klass]
142
- end
143
-
144
- ##
145
- # Figure out the spec class to use based on a spec's description. Eg:
146
- #
147
- # spec_type("BlahController") # => Minitest::Spec::Rails
148
-
149
- def spec_type desc, *additional
150
- TYPES.find { |matcher, _klass|
151
- if matcher.respond_to? :call then
152
- matcher.call desc, *additional
153
- else
154
- matcher === desc.to_s
155
- end
156
- }.last
157
- end
158
-
159
- def describe_stack # :nodoc:
160
- Thread.current[:describe_stack] ||= []
161
- end
162
-
163
- def children # :nodoc:
164
- @children ||= []
165
- end
166
-
167
- def nuke_test_methods! # :nodoc:
168
- self.public_instance_methods.grep(/^test_/).each do |name|
169
- self.send :undef_method, name
170
- end
171
- end
172
-
173
- ##
174
- # Define a 'before' action. Inherits the way normal methods should.
175
- #
176
- # NOTE: +type+ is ignored and is only there to make porting easier.
177
- #
178
- # Equivalent to Minitest::Test#setup.
179
-
180
- def before _type = nil, &block
181
- define_method :setup do
182
- super()
183
- self.instance_eval(&block)
184
- end
185
- end
186
-
187
- ##
188
- # Define an 'after' action. Inherits the way normal methods should.
189
- #
190
- # NOTE: +type+ is ignored and is only there to make porting easier.
191
- #
192
- # Equivalent to Minitest::Test#teardown.
193
-
194
- def after _type = nil, &block
195
- define_method :teardown do
196
- self.instance_eval(&block)
197
- super()
198
- end
199
- end
200
-
201
- ##
202
- # Define an expectation with name +desc+. Name gets morphed to a
203
- # proper test method name. For some freakish reason, people who
204
- # write specs don't like class inheritance, so this goes way out of
205
- # its way to make sure that expectations aren't inherited.
206
- #
207
- # This is also aliased to #specify and doesn't require a +desc+ arg.
208
- #
209
- # Hint: If you _do_ want inheritance, use minitest/test. You can mix
210
- # and match between assertions and expectations as much as you want.
211
-
212
- def it desc = "anonymous", &block
213
- block ||= proc { skip "(no tests defined)" }
214
-
215
- @specs ||= 0
216
- @specs += 1
217
-
218
- name = "test_%04d_%s" % [ @specs, desc ]
219
-
220
- undef_klasses = self.children.reject { |c| c.public_method_defined? name }
221
-
222
- define_method name, &block
223
-
224
- undef_klasses.each do |undef_klass|
225
- undef_klass.send :undef_method, name
226
- end
227
-
228
- name
229
- end
230
-
231
- ##
232
- # Essentially, define an accessor for +name+ with +block+.
233
- #
234
- # Why use let instead of def? I honestly don't know.
235
-
236
- def let name, &block
237
- name = name.to_s
238
- pre, post = "let '#{name}' cannot ", ". Please use another name."
239
- methods = Minitest::Spec.instance_methods.map(&:to_s) - %w[subject]
240
- raise ArgumentError, "#{pre}begin with 'test'#{post}" if
241
- name =~ /\Atest/
242
- raise ArgumentError, "#{pre}override a method in Minitest::Spec#{post}" if
243
- methods.include? name
244
-
245
- define_method name do
246
- @_memoized ||= {}
247
- @_memoized.fetch(name) { |k| @_memoized[k] = instance_eval(&block) }
248
- end
249
- end
250
-
251
- ##
252
- # Another lazy man's accessor generator. Made even more lazy by
253
- # setting the name for you to +subject+.
254
-
255
- def subject &block
256
- let :subject, &block
257
- end
258
-
259
- def create name, desc # :nodoc:
260
- cls = Class.new(self) do
261
- @name = name
262
- @desc = desc
263
-
264
- nuke_test_methods!
265
- end
266
-
267
- children << cls
268
-
269
- cls
270
- end
271
-
272
- def name # :nodoc:
273
- defined?(@name) ? @name : super
274
- end
275
-
276
- def to_s # :nodoc:
277
- name # Can't alias due to 1.8.7, not sure why
278
- end
279
-
280
- attr_reader :desc # :nodoc:
281
- alias :specify :it
282
-
283
- ##
284
- # Rdoc... why are you so dumb?
285
-
286
- module InstanceMethods
287
- ##
288
- # Returns a value monad that has all of Expectations methods
289
- # available to it.
290
- #
291
- # Also aliased to #value and #expect for your aesthetic pleasure:
292
- #
293
- # _(1 + 1).must_equal 2
294
- # value(1 + 1).must_equal 2
295
- # expect(1 + 1).must_equal 2
296
- #
297
- # This method of expectation-based testing is preferable to
298
- # straight-expectation methods (on Object) because it stores its
299
- # test context, bypassing our hacky use of thread-local variables.
300
- #
301
- # At some point, the methods on Object will be deprecated and then
302
- # removed.
303
-
304
- def _ value = nil, &block
305
- Minitest::Expectation.new block || value, self
306
- end
307
-
308
- alias value _
309
- alias expect _
310
-
311
- def before_setup # :nodoc:
312
- super
313
- Thread.current[:current_spec] = self
314
- end
315
- end
316
-
317
- def self.extended obj # :nodoc:
318
- obj.send :include, InstanceMethods
319
- end
320
- end
321
-
322
- extend DSL
323
-
324
- TYPES = DSL::TYPES # :nodoc:
325
- end
326
-
327
- require "minitest/expectations"
328
-
329
- class Object # :nodoc:
330
- include Minitest::Expectations unless ENV["MT_NO_EXPECTATIONS"]
331
- end
@@ -1,284 +0,0 @@
1
- require "minitest" unless defined? Minitest::Runnable
2
-
3
- module Minitest
4
- ##
5
- # Subclass Test to create your own tests. Typically you'll want a
6
- # Test subclass per implementation class.
7
- #
8
- # See Minitest::Assertions
9
-
10
- class Test < Runnable
11
- require "minitest/assertions"
12
- include Minitest::Assertions
13
-
14
- PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, SystemExit] # :nodoc:
15
-
16
- class << self; attr_accessor :io_lock; end # :nodoc:
17
- self.io_lock = Mutex.new
18
-
19
- ##
20
- # Call this at the top of your tests when you absolutely
21
- # positively need to have ordered tests. In doing so, you're
22
- # admitting that you suck and your tests are weak.
23
-
24
- def self.i_suck_and_my_tests_are_order_dependent!
25
- class << self
26
- undef_method :test_order if method_defined? :test_order
27
- define_method :test_order do :alpha end
28
- end
29
- end
30
-
31
- ##
32
- # Make diffs for this Test use #pretty_inspect so that diff
33
- # in assert_equal can have more details. NOTE: this is much slower
34
- # than the regular inspect but much more usable for complex
35
- # objects.
36
-
37
- def self.make_my_diffs_pretty!
38
- require "pp"
39
-
40
- define_method :mu_pp do |o|
41
- o.pretty_inspect
42
- end
43
- end
44
-
45
- ##
46
- # Call this at the top of your tests when you want to run your
47
- # tests in parallel. In doing so, you're admitting that you rule
48
- # and your tests are awesome.
49
-
50
- def self.parallelize_me!
51
- include Minitest::Parallel::Test
52
- extend Minitest::Parallel::Test::ClassMethods
53
- end
54
-
55
- ##
56
- # Returns all instance methods starting with "test_". Based on
57
- # #test_order, the methods are either sorted, randomized
58
- # (default), or run in parallel.
59
-
60
- def self.runnable_methods
61
- methods = methods_matching(/^test_/)
62
-
63
- case self.test_order
64
- when :random, :parallel then
65
- max = methods.size
66
- methods.sort.sort_by { rand max }
67
- when :alpha, :sorted then
68
- methods.sort
69
- else
70
- raise "Unknown test_order: #{self.test_order.inspect}"
71
- end
72
- end
73
-
74
- ##
75
- # Defines the order to run tests (:random by default). Override
76
- # this or use a convenience method to change it for your tests.
77
-
78
- def self.test_order
79
- :random
80
- end
81
-
82
- ##
83
- # The time it took to run this test.
84
-
85
- attr_accessor :time
86
-
87
- def marshal_dump # :nodoc:
88
- super << self.time
89
- end
90
-
91
- def marshal_load ary # :nodoc:
92
- self.time = ary.pop
93
- super
94
- end
95
-
96
- TEARDOWN_METHODS = %w[ before_teardown teardown after_teardown ] # :nodoc:
97
-
98
- ##
99
- # Runs a single test with setup/teardown hooks.
100
-
101
- def run
102
- with_info_handler do
103
- time_it do
104
- capture_exceptions do
105
- before_setup; setup; after_setup
106
-
107
- self.send self.name
108
- end
109
-
110
- TEARDOWN_METHODS.each do |hook|
111
- capture_exceptions do
112
- self.send hook
113
- end
114
- end
115
- end
116
- end
117
-
118
- self # per contract
119
- end
120
-
121
- ##
122
- # Provides before/after hooks for setup and teardown. These are
123
- # meant for library writers, NOT for regular test authors. See
124
- # #before_setup for an example.
125
-
126
- module LifecycleHooks
127
-
128
- ##
129
- # Runs before every test, before setup. This hook is meant for
130
- # libraries to extend minitest. It is not meant to be used by
131
- # test developers.
132
- #
133
- # As a simplistic example:
134
- #
135
- # module MyMinitestPlugin
136
- # def before_setup
137
- # super
138
- # # ... stuff to do before setup is run
139
- # end
140
- #
141
- # def after_setup
142
- # # ... stuff to do after setup is run
143
- # super
144
- # end
145
- #
146
- # def before_teardown
147
- # super
148
- # # ... stuff to do before teardown is run
149
- # end
150
- #
151
- # def after_teardown
152
- # # ... stuff to do after teardown is run
153
- # super
154
- # end
155
- # end
156
- #
157
- # class MiniTest::Test
158
- # include MyMinitestPlugin
159
- # end
160
-
161
- def before_setup; end
162
-
163
- ##
164
- # Runs before every test. Use this to set up before each test
165
- # run.
166
-
167
- def setup; end
168
-
169
- ##
170
- # Runs before every test, after setup. This hook is meant for
171
- # libraries to extend minitest. It is not meant to be used by
172
- # test developers.
173
- #
174
- # See #before_setup for an example.
175
-
176
- def after_setup; end
177
-
178
- ##
179
- # Runs after every test, before teardown. This hook is meant for
180
- # libraries to extend minitest. It is not meant to be used by
181
- # test developers.
182
- #
183
- # See #before_setup for an example.
184
-
185
- def before_teardown; end
186
-
187
- ##
188
- # Runs after every test. Use this to clean up after each test
189
- # run.
190
-
191
- def teardown; end
192
-
193
- ##
194
- # Runs after every test, after teardown. This hook is meant for
195
- # libraries to extend minitest. It is not meant to be used by
196
- # test developers.
197
- #
198
- # See #before_setup for an example.
199
-
200
- def after_teardown; end
201
- end # LifecycleHooks
202
-
203
- def capture_exceptions # :nodoc:
204
- yield
205
- rescue *PASSTHROUGH_EXCEPTIONS
206
- raise
207
- rescue Assertion => e
208
- self.failures << e
209
- rescue Exception => e
210
- self.failures << UnexpectedError.new(e)
211
- end
212
-
213
- ##
214
- # Did this run error?
215
-
216
- def error?
217
- self.failures.any? { |f| UnexpectedError === f }
218
- end
219
-
220
- ##
221
- # The location identifier of this test.
222
-
223
- def location
224
- loc = " [#{self.failure.location}]" unless passed? or error?
225
- "#{self.class}##{self.name}#{loc}"
226
- end
227
-
228
- ##
229
- # Did this run pass?
230
- #
231
- # Note: skipped runs are not considered passing, but they don't
232
- # cause the process to exit non-zero.
233
-
234
- def passed?
235
- not self.failure
236
- end
237
-
238
- ##
239
- # Returns ".", "F", or "E" based on the result of the run.
240
-
241
- def result_code
242
- self.failure and self.failure.result_code or "."
243
- end
244
-
245
- ##
246
- # Was this run skipped?
247
-
248
- def skipped?
249
- self.failure and Skip === self.failure
250
- end
251
-
252
- def time_it # :nodoc:
253
- t0 = Minitest.clock_time
254
-
255
- yield
256
- ensure
257
- self.time = Minitest.clock_time - t0
258
- end
259
-
260
- def to_s # :nodoc:
261
- return location if passed? and not skipped?
262
-
263
- failures.map { |failure|
264
- "#{failure.result_label}:\n#{self.location}:\n#{failure.message}\n"
265
- }.join "\n"
266
- end
267
-
268
- def with_info_handler &block # :nodoc:
269
- t0 = Minitest.clock_time
270
-
271
- handler = lambda do
272
- warn "\nCurrent: %s#%s %.2fs" % [self.class, self.name, Minitest.clock_time - t0]
273
- end
274
-
275
- self.class.on_signal ::Minitest.info_signal, handler, &block
276
- end
277
-
278
- include LifecycleHooks
279
- include Guard
280
- extend Guard
281
- end # Test
282
- end
283
-
284
- require "minitest/unit" unless defined?(MiniTest) # compatibility layer only
@@ -1,45 +0,0 @@
1
- # :stopdoc:
2
-
3
- unless defined?(Minitest) then
4
- # all of this crap is just to avoid circular requires and is only
5
- # needed if a user requires "minitest/unit" directly instead of
6
- # "minitest/autorun", so we also warn
7
-
8
- from = caller.reject { |s| s =~ /rubygems/ }.join("\n ")
9
- warn "Warning: you should require 'minitest/autorun' instead."
10
- warn %(Warning: or add 'gem "minitest"' before 'require "minitest/autorun"')
11
- warn "From:\n #{from}"
12
-
13
- module Minitest; end
14
- MiniTest = Minitest # prevents minitest.rb from requiring back to us
15
- require "minitest"
16
- end
17
-
18
- MiniTest = Minitest unless defined?(MiniTest)
19
-
20
- module Minitest
21
- class Unit
22
- VERSION = Minitest::VERSION
23
- class TestCase < Minitest::Test
24
- def self.inherited klass # :nodoc:
25
- from = caller.first
26
- warn "MiniTest::Unit::TestCase is now Minitest::Test. From #{from}"
27
- super
28
- end
29
- end
30
-
31
- def self.autorun # :nodoc:
32
- from = caller.first
33
- warn "MiniTest::Unit.autorun is now Minitest.autorun. From #{from}"
34
- Minitest.autorun
35
- end
36
-
37
- def self.after_tests(&b) # :nodoc:
38
- from = caller.first
39
- warn "MiniTest::Unit.after_tests is now Minitest.after_run. From #{from}"
40
- Minitest.after_run(&b)
41
- end
42
- end
43
- end
44
-
45
- # :startdoc: