orthoses-rails 0.4.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -39
  3. data/examples/rails/Gemfile +16 -0
  4. data/examples/rails/Gemfile.lock +178 -0
  5. data/examples/rails/Rakefile +149 -193
  6. data/examples/rails/config/database.yml +8 -0
  7. data/examples/rails/config/storage.yml +3 -0
  8. data/examples/rails/known_sig/actionpack/7.0/action_controller/metal.rbs +4 -0
  9. data/{lib/orthoses/active_model/known_sig/7.0 → examples/rails/known_sig/activemodel/7.0/active_model}/serialization.rbs +0 -0
  10. data/{lib/orthoses/active_model/known_sig/7.0 → examples/rails/known_sig/activemodel/7.0/active_model}/validations.rbs +0 -0
  11. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation.rbs +49 -0
  12. data/examples/rails/known_sig/activerecord/6.0/_active_record_relation_class_methods.rbs +45 -0
  13. data/{lib/orthoses/active_record/known_sig/6.0 → examples/rails/known_sig/activerecord/6.0/active_record}/result.rbs +0 -0
  14. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation.rbs +49 -0
  15. data/examples/rails/known_sig/activerecord/6.1/_active_record_relation_class_methods.rbs +45 -0
  16. data/{lib/orthoses/active_record/known_sig/6.1 → examples/rails/known_sig/activerecord/6.1/active_record}/result.rbs +0 -0
  17. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation.rbs +49 -0
  18. data/examples/rails/known_sig/activerecord/7.0/_active_record_relation_class_methods.rbs +45 -0
  19. data/{lib/orthoses/active_record/known_sig/7.0 → examples/rails/known_sig/activerecord/7.0/active_record}/encryption/context.rbs +0 -0
  20. data/{lib/orthoses/active_record/known_sig/7.0 → examples/rails/known_sig/activerecord/7.0/active_record}/result.rbs +0 -0
  21. data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/active_support/callbacks/callback_chain.rbs +0 -0
  22. data/examples/rails/known_sig/activesupport/7.0/active_support/duration.rbs +4 -0
  23. data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/active_support/hash_with_indifferent_access.rbs +0 -0
  24. data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/active_support/multibyte/chars.rbs +0 -0
  25. data/examples/rails/known_sig/activesupport/7.0/active_support/time_with_zone.rbs +5 -0
  26. data/examples/rails/known_sig/activesupport/7.0/active_support/time_zone.rbs +3 -0
  27. data/examples/rails/known_sig/activesupport/7.0/date.rbs +6 -0
  28. data/examples/rails/known_sig/activesupport/7.0/date_and_time/zones.rbs +4 -0
  29. data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/hash_with_indifferent_access.rbs +0 -0
  30. data/examples/rails/known_sig/activesupport/7.0/integer.rbs +9 -0
  31. data/examples/rails/known_sig/activesupport/7.0/numeric.rbs +15 -0
  32. data/examples/rails/known_sig/activesupport/7.0/string.rbs +4 -0
  33. data/{lib/orthoses/active_support/known_sig → examples/rails/known_sig/activesupport}/7.0/time.rbs +8 -0
  34. data/examples/rails/tasks/action_pack.rake +141 -0
  35. data/examples/rails/tasks/action_view.rake +77 -0
  36. data/examples/rails/tasks/active_job.rake +99 -0
  37. data/examples/rails/tasks/active_model.rake +46 -0
  38. data/examples/rails/tasks/active_record.rake +88 -0
  39. data/examples/rails/tasks/active_storage.rake +94 -0
  40. data/examples/rails/tasks/active_support.rake +99 -0
  41. data/examples/rails/tasks/railties.rake +37 -0
  42. data/lib/orthoses/active_model/has_secure_password.rb +2 -10
  43. data/lib/orthoses/active_model.rb +0 -1
  44. data/lib/orthoses/active_record/delegated_type.rb +44 -0
  45. data/lib/orthoses/active_record/enum.rb +77 -0
  46. data/lib/orthoses/active_record/generated_attribute_methods.rb +1 -0
  47. data/lib/orthoses/active_record/scope.rb +63 -0
  48. data/lib/orthoses/active_record.rb +3 -1
  49. data/lib/orthoses/active_support/class_attribute.rb +3 -10
  50. data/lib/orthoses/active_support/configurable.rb +3 -2
  51. data/lib/orthoses/active_support/delegation.rb +11 -19
  52. data/lib/orthoses/active_support/mattr_accessor.rb +4 -12
  53. data/lib/orthoses/active_support/time_with_zone.rb +21 -3
  54. data/lib/orthoses/active_support.rb +0 -17
  55. data/lib/orthoses/rails/version.rb +1 -1
  56. data/lib/orthoses/rails.rb +1 -1
  57. data/lib/orthoses/railties/mixin.rb +107 -0
  58. data/lib/orthoses/railties.rb +3 -0
  59. data/orthoses-rails.gemspec +1 -1
  60. metadata +48 -89
  61. data/examples/rails/known_sig/action_cable/connection/test_cookie_jar.rbs +0 -2
  62. data/examples/rails/known_sig/action_controller/metal.rbs +0 -4
  63. data/examples/rails/known_sig/action_dispatch/cookies/cookie_jar.rbs +0 -3
  64. data/examples/rails/known_sig/action_dispatch/response.rbs +0 -4
  65. data/examples/rails/patch/drb/drb_undumped.rbs +0 -2
  66. data/examples/rails/patch/drb.rbs +0 -2
  67. data/examples/rails/patch/erubi/engine.rbs +0 -4
  68. data/examples/rails/patch/erubi.rbs +0 -2
  69. data/examples/rails/patch/minitest/kernel.rbs +0 -44
  70. data/examples/rails/patch/minitest/minitest/abstract_reporter.rbs +0 -49
  71. data/examples/rails/patch/minitest/minitest/assertion.rbs +0 -16
  72. data/examples/rails/patch/minitest/minitest/assertions.rbs +0 -545
  73. data/examples/rails/patch/minitest/minitest/backtrace_filter.rbs +0 -16
  74. data/examples/rails/patch/minitest/minitest/bench_spec.rbs +0 -101
  75. data/examples/rails/patch/minitest/minitest/benchmark.rbs +0 -258
  76. data/examples/rails/patch/minitest/minitest/composite_reporter.rbs +0 -25
  77. data/examples/rails/patch/minitest/minitest/expectations.rbs +0 -21
  78. data/examples/rails/patch/minitest/minitest/guard.rbs +0 -64
  79. data/examples/rails/patch/minitest/minitest/mock.rbs +0 -60
  80. data/examples/rails/patch/minitest/minitest/parallel/executor.rbs +0 -42
  81. data/examples/rails/patch/minitest/minitest/parallel/test/class_methods.rbs +0 -6
  82. data/examples/rails/patch/minitest/minitest/parallel/test.rbs +0 -3
  83. data/examples/rails/patch/minitest/minitest/parallel.rbs +0 -2
  84. data/examples/rails/patch/minitest/minitest/pride_io.rbs +0 -54
  85. data/examples/rails/patch/minitest/minitest/pride_lol.rbs +0 -17
  86. data/examples/rails/patch/minitest/minitest/progress_reporter.rbs +0 -11
  87. data/examples/rails/patch/minitest/minitest/reportable.rbs +0 -51
  88. data/examples/rails/patch/minitest/minitest/reporter.rbs +0 -5
  89. data/examples/rails/patch/minitest/minitest/result.rbs +0 -28
  90. data/examples/rails/patch/minitest/minitest/runnable.rbs +0 -131
  91. data/examples/rails/patch/minitest/minitest/skip.rbs +0 -6
  92. data/examples/rails/patch/minitest/minitest/spec/dsl/instance_methods.rbs +0 -48
  93. data/examples/rails/patch/minitest/minitest/spec/dsl.rbs +0 -125
  94. data/examples/rails/patch/minitest/minitest/spec.rbs +0 -10
  95. data/examples/rails/patch/minitest/minitest/statistics_reporter.rbs +0 -76
  96. data/examples/rails/patch/minitest/minitest/summary_reporter.rbs +0 -26
  97. data/examples/rails/patch/minitest/minitest/test/lifecycle_hooks.rbs +0 -92
  98. data/examples/rails/patch/minitest/minitest/test.rbs +0 -76
  99. data/examples/rails/patch/minitest/minitest/unexpected_error.rbs +0 -10
  100. data/examples/rails/patch/minitest/minitest/unit/test_case.rbs +0 -3
  101. data/examples/rails/patch/minitest/minitest/unit.rbs +0 -5
  102. data/examples/rails/patch/minitest/minitest.rbs +0 -966
  103. data/examples/rails/patch/pg/simple_decoder.rbs +0 -4
  104. data/examples/rails/patch/pg.rbs +0 -2
  105. data/examples/rails/patch/qc/queue.rbs +0 -2
  106. data/examples/rails/patch/qc.rbs +0 -2
  107. data/examples/rails/patch/que/job.rbs +0 -2
  108. data/examples/rails/patch/que.rbs +0 -2
  109. data/examples/rails/patch/rack/cache/entity_store.rbs +0 -2
  110. data/examples/rails/patch/rack/cache/meta_store.rbs +0 -2
  111. data/examples/rails/patch/rack/cache.rbs +0 -2
  112. data/examples/rails/patch/rack/session/dalli.rbs +0 -2
  113. data/examples/rails/patch/rack/session.rbs +0 -2
  114. data/examples/rails/patch/rboc.rbs +0 -2
  115. data/examples/rails/patch/rdoc/generator/sdoc.rbs +0 -3
  116. data/examples/rails/patch/rdoc/generator.rbs +0 -2
  117. data/examples/rails/patch/rdoc/task.rbs +0 -2
  118. data/examples/rails/patch/ripper.rbs +0 -2
  119. data/examples/rails/patch/sidekiq/worker.rbs +0 -2
  120. data/examples/rails/patch/sidekiq.rbs +0 -2
  121. data/examples/rails/patch/sneakers/worker.rbs +0 -2
  122. data/examples/rails/patch/sneakers.rbs +0 -2
  123. data/examples/rails/patch/sucker_punch/job.rbs +0 -2
  124. data/examples/rails/patch/sucker_punch.rbs +0 -2
  125. data/examples/rails/patch/thor/actions/create_file.rbs +0 -2
  126. data/examples/rails/patch/thor/actions.rbs +0 -2
  127. data/examples/rails/patch/thor/error.rbs +0 -2
  128. data/examples/rails/patch/thor/group.rbs +0 -2
  129. data/examples/rails/patch/thor.rbs +0 -2
  130. data/lib/orthoses/active_model/known_sig.rb +0 -21
  131. data/lib/orthoses/active_record/known_sig.rb +0 -21
  132. data/lib/orthoses/active_support/known_sig.rb +0 -21
  133. data/lib/orthoses/rails/known_sig_helper.rb +0 -22
@@ -1,966 +0,0 @@
1
- # <!-- rdoc-file=lib/minitest.rb -->
2
- # # minitest/{test,spec,mock,benchmark}
3
- #
4
- # home
5
- # : https://github.com/seattlerb/minitest
6
- # bugs
7
- # : https://github.com/seattlerb/minitest/issues
8
- # rdoc
9
- # : http://docs.seattlerb.org/minitest
10
- # vim
11
- # : https://github.com/sunaku/vim-ruby-minitest
12
- # emacs
13
- # : https://github.com/arthurnn/minitest-emacs
14
- #
15
- #
16
- # ## DESCRIPTION:
17
- #
18
- # minitest provides a complete suite of testing facilities supporting TDD, BDD,
19
- # mocking, and benchmarking.
20
- #
21
- # "I had a class with Jim Weirich on testing last week and we were
22
- # allowed to choose our testing frameworks. Kirk Haines and I were
23
- # paired up and we cracked open the code for a few test
24
- # frameworks...
25
- #
26
- # I MUST say that minitest is *very* readable / understandable
27
- # compared to the 'other two' options we looked at. Nicely done and
28
- # thank you for helping us keep our mental sanity."
29
- #
30
- # -- Wayne E. Seguin
31
- #
32
- # minitest/test is a small and incredibly fast unit testing framework. It
33
- # provides a rich set of assertions to make your tests clean and readable.
34
- #
35
- # minitest/spec is a functionally complete spec engine. It hooks onto
36
- # minitest/test and seamlessly bridges test assertions over to spec
37
- # expectations.
38
- #
39
- # minitest/benchmark is an awesome way to assert the performance of your
40
- # algorithms in a repeatable manner. Now you can assert that your newb co-worker
41
- # doesn't replace your linear algorithm with an exponential one!
42
- #
43
- # minitest/mock by Steven Baker, is a beautifully tiny mock (and stub) object
44
- # framework.
45
- #
46
- # minitest/pride shows pride in testing and adds coloring to your test output. I
47
- # guess it is an example of how to write IO pipes too. :P
48
- #
49
- # minitest/test is meant to have a clean implementation for language
50
- # implementors that need a minimal set of methods to bootstrap a working test
51
- # suite. For example, there is no magic involved for test-case discovery.
52
- #
53
- # "Again, I can't praise enough the idea of a testing/specing
54
- # framework that I can actually read in full in one sitting!"
55
- #
56
- # -- Piotr Szotkowski
57
- #
58
- # Comparing to rspec:
59
- #
60
- # rspec is a testing DSL. minitest is ruby.
61
- #
62
- # -- Adam Hawkins, "Bow Before MiniTest"
63
- #
64
- # minitest doesn't reinvent anything that ruby already provides, like: classes,
65
- # modules, inheritance, methods. This means you only have to learn ruby to use
66
- # minitest and all of your regular OO practices like extract-method refactorings
67
- # still apply.
68
- #
69
- # ## FEATURES/PROBLEMS:
70
- #
71
- # * minitest/autorun - the easy and explicit way to run all your tests.
72
- # * minitest/test - a very fast, simple, and clean test system.
73
- # * minitest/spec - a very fast, simple, and clean spec system.
74
- # * minitest/mock - a simple and clean mock/stub system.
75
- # * minitest/benchmark - an awesome way to assert your algorithm's
76
- # performance.
77
- # * minitest/pride - show your pride in testing!
78
- # * Incredibly small and fast runner, but no bells and whistles.
79
- # * Written by squishy human beings. Software can never be perfect. We will
80
- # all eventually die.
81
- #
82
- #
83
- # ## RATIONALE:
84
- #
85
- # See design_rationale.rb to see how specs and tests work in minitest.
86
- #
87
- # ## SYNOPSIS:
88
- #
89
- # Given that you'd like to test the following class:
90
- #
91
- # class Meme
92
- # def i_can_has_cheezburger?
93
- # "OHAI!"
94
- # end
95
- #
96
- # def will_it_blend?
97
- # "YES!"
98
- # end
99
- # end
100
- #
101
- # ### Unit tests
102
- #
103
- # Define your tests as methods beginning with `test_`.
104
- #
105
- # require "minitest/autorun"
106
- #
107
- # class TestMeme < Minitest::Test
108
- # def setup
109
- # @meme = Meme.new
110
- # end
111
- #
112
- # def test_that_kitty_can_eat
113
- # assert_equal "OHAI!", @meme.i_can_has_cheezburger?
114
- # end
115
- #
116
- # def test_that_it_will_not_blend
117
- # refute_match /^no/i, @meme.will_it_blend?
118
- # end
119
- #
120
- # def test_that_will_be_skipped
121
- # skip "test this later"
122
- # end
123
- # end
124
- #
125
- # ### Specs
126
- #
127
- # require "minitest/autorun"
128
- #
129
- # describe Meme do
130
- # before do
131
- # @meme = Meme.new
132
- # end
133
- #
134
- # describe "when asked about cheeseburgers" do
135
- # it "must respond positively" do
136
- # _(@meme.i_can_has_cheezburger?).must_equal "OHAI!"
137
- # end
138
- # end
139
- #
140
- # describe "when asked about blending possibilities" do
141
- # it "won't say no" do
142
- # _(@meme.will_it_blend?).wont_match /^no/i
143
- # end
144
- # end
145
- # end
146
- #
147
- # For matchers support check out:
148
- #
149
- # * https://github.com/wojtekmach/minitest-matchers
150
- # * https://github.com/rmm5t/minitest-matchers_vaccine
151
- #
152
- #
153
- # ### Benchmarks
154
- #
155
- # Add benchmarks to your tests.
156
- #
157
- # # optionally run benchmarks, good for CI-only work!
158
- # require "minitest/benchmark" if ENV["BENCH"]
159
- #
160
- # class TestMeme < Minitest::Benchmark
161
- # # Override self.bench_range or default range is [1, 10, 100, 1_000, 10_000]
162
- # def bench_my_algorithm
163
- # assert_performance_linear 0.9999 do |n| # n is a range value
164
- # @obj.my_algorithm(n)
165
- # end
166
- # end
167
- # end
168
- #
169
- # Or add them to your specs. If you make benchmarks optional, you'll need to
170
- # wrap your benchmarks in a conditional since the methods won't be defined. In
171
- # minitest 5, the describe name needs to match `/Bench(mark)?$/`.
172
- #
173
- # describe "Meme Benchmark" do
174
- # if ENV["BENCH"] then
175
- # bench_performance_linear "my_algorithm", 0.9999 do |n|
176
- # 100.times do
177
- # @obj.my_algorithm(n)
178
- # end
179
- # end
180
- # end
181
- # end
182
- #
183
- # outputs something like:
184
- #
185
- # # Running benchmarks:
186
- #
187
- # TestBlah 100 1000 10000
188
- # bench_my_algorithm 0.006167 0.079279 0.786993
189
- # bench_other_algorithm 0.061679 0.792797 7.869932
190
- #
191
- # Output is tab-delimited to make it easy to paste into a spreadsheet.
192
- #
193
- # ### Mocks
194
- #
195
- # Mocks and stubs defined using terminology by Fowler & Meszaros at
196
- # http://www.martinfowler.com/bliki/TestDouble.html:
197
- #
198
- # "Mocks are pre-programmed with expectations which form a specification of the
199
- # calls they are expected to receive. They can throw an exception if they
200
- # receive a call they don't expect and are checked during verification to ensure
201
- # they got all the calls they were expecting."
202
- #
203
- # class MemeAsker
204
- # def initialize(meme)
205
- # @meme = meme
206
- # end
207
- #
208
- # def ask(question)
209
- # method = question.tr(" ", "_") + "?"
210
- # @meme.__send__(method)
211
- # end
212
- # end
213
- #
214
- # require "minitest/autorun"
215
- #
216
- # describe MemeAsker, :ask do
217
- # describe "when passed an unpunctuated question" do
218
- # it "should invoke the appropriate predicate method on the meme" do
219
- # @meme = Minitest::Mock.new
220
- # @meme_asker = MemeAsker.new @meme
221
- # @meme.expect :will_it_blend?, :return_value
222
- #
223
- # @meme_asker.ask "will it blend"
224
- #
225
- # @meme.verify
226
- # end
227
- # end
228
- # end
229
- #
230
- # #### Multi-threading and Mocks
231
- #
232
- # Minitest mocks do not support multi-threading. If it works, fine, if it
233
- # doesn't you can use regular ruby patterns and facilities like local variables.
234
- # Here's an example of asserting that code inside a thread is run:
235
- #
236
- # def test_called_inside_thread
237
- # called = false
238
- # pr = Proc.new { called = true }
239
- # thread = Thread.new(&pr)
240
- # thread.join
241
- # assert called, "proc not called"
242
- # end
243
- #
244
- # ### Stubs
245
- #
246
- # Mocks and stubs are defined using terminology by Fowler & Meszaros at
247
- # http://www.martinfowler.com/bliki/TestDouble.html:
248
- #
249
- # "Stubs provide canned answers to calls made during the test".
250
- #
251
- # Minitest's stub method overrides a single method for the duration of the
252
- # block.
253
- #
254
- # def test_stale_eh
255
- # obj_under_test = Something.new
256
- #
257
- # refute obj_under_test.stale?
258
- #
259
- # Time.stub :now, Time.at(0) do # stub goes away once the block is done
260
- # assert obj_under_test.stale?
261
- # end
262
- # end
263
- #
264
- # A note on stubbing: In order to stub a method, the method must actually exist
265
- # prior to stubbing. Use a singleton method to create a new non-existing method:
266
- #
267
- # def obj_under_test.fake_method
268
- # ...
269
- # end
270
- #
271
- # ### Running Your Tests
272
- #
273
- # Ideally, you'll use a rake task to run your tests, either piecemeal or all at
274
- # once. Both rake and rails ship with rake tasks for running your tests. BUT!
275
- # You don't have to:
276
- #
277
- # % ruby -Ilib:test test/minitest/test_minitest_test.rb
278
- # Run options: --seed 37685
279
- #
280
- # # Running:
281
- #
282
- # ...................................................................... (etc)
283
- #
284
- # Finished in 0.107130s, 1446.8403 runs/s, 2959.0217 assertions/s.
285
- #
286
- # 155 runs, 317 assertions, 0 failures, 0 errors, 0 skips
287
- #
288
- # There are runtime options available, both from minitest itself, and also
289
- # provided via plugins. To see them, simply run with `--help`:
290
- #
291
- # % ruby -Ilib:test test/minitest/test_minitest_test.rb --help
292
- # minitest options:
293
- # -h, --help Display this help.
294
- # -s, --seed SEED Sets random seed. Also via env. Eg: SEED=n rake
295
- # -v, --verbose Verbose. Show progress processing files.
296
- # -n, --name PATTERN Filter run on /regexp/ or string.
297
- # -e, --exclude PATTERN Exclude /regexp/ or string from run.
298
- #
299
- # Known extensions: pride, autotest
300
- # -p, --pride Pride. Show your testing pride!
301
- # -a, --autotest Connect to autotest server.
302
- #
303
- # You can set up a rake task to run all your tests by adding this to your
304
- # Rakefile:
305
- #
306
- # require "rake/testtask"
307
- #
308
- # Rake::TestTask.new(:test) do |t|
309
- # t.libs << "test"
310
- # t.libs << "lib"
311
- # t.test_files = FileList["test/**/test_*.rb"]
312
- # end
313
- #
314
- # task :default => :test
315
- #
316
- # ## Writing Extensions
317
- #
318
- # To define a plugin, add a file named minitest/XXX_plugin.rb to your
319
- # project/gem. That file must be discoverable via ruby's LOAD_PATH (via rubygems
320
- # or otherwise). Minitest will find and require that file using Gem.find_files.
321
- # It will then try to call `plugin_XXX_init` during startup. The option
322
- # processor will also try to call `plugin_XXX_options` passing the OptionParser
323
- # instance and the current options hash. This lets you register your own
324
- # command-line options. Here's a totally bogus example:
325
- #
326
- # # minitest/bogus_plugin.rb:
327
- #
328
- # module Minitest
329
- # def self.plugin_bogus_options(opts, options)
330
- # opts.on "--myci", "Report results to my CI" do
331
- # options[:myci] = true
332
- # options[:myci_addr] = get_myci_addr
333
- # options[:myci_port] = get_myci_port
334
- # end
335
- # end
336
- #
337
- # def self.plugin_bogus_init(options)
338
- # self.reporter << MyCI.new(options) if options[:myci]
339
- # end
340
- # end
341
- #
342
- # ### Adding custom reporters
343
- #
344
- # Minitest uses composite reporter to output test results using multiple
345
- # reporter instances. You can add new reporters to the composite during the
346
- # init_plugins phase. As we saw in `plugin_bogus_init` above, you simply add
347
- # your reporter instance to the composite via `<<`.
348
- #
349
- # `AbstractReporter` defines the API for reporters. You may subclass it and
350
- # override any method you want to achieve your desired behavior.
351
- #
352
- # start
353
- # : Called when the run has started.
354
- # record
355
- # : Called for each result, passed or otherwise.
356
- # report
357
- # : Called at the end of the run.
358
- # passed?
359
- # : Called to see if you detected any problems.
360
- #
361
- #
362
- # Using our example above, here is how we might implement MyCI:
363
- #
364
- # # minitest/bogus_plugin.rb
365
- #
366
- # module Minitest
367
- # class MyCI < AbstractReporter
368
- # attr_accessor :results, :addr, :port
369
- #
370
- # def initialize options
371
- # self.results = []
372
- # self.addr = options[:myci_addr]
373
- # self.port = options[:myci_port]
374
- # end
375
- #
376
- # def record result
377
- # self.results << result
378
- # end
379
- #
380
- # def report
381
- # CI.connect(addr, port).send_results self.results
382
- # end
383
- # end
384
- #
385
- # # code from above...
386
- # end
387
- #
388
- # ## FAQ
389
- #
390
- # ### What versions are compatible with what? Or what versions are supported?
391
- #
392
- # Minitest is a dependency of rails, which until fairly recently had an
393
- # overzealous backwards compatibility policy. As such, I'm stuck supporting
394
- # versions of ruby that are long past EOL. Once rails 5.2 is dropped (hopefully
395
- # April 2021), I get to drop a bunch of versions of ruby that I have to
396
- # currently test against.
397
- #
398
- # (As of 2021-01-31)
399
- #
400
- # Current versions of rails: (https://endoflife.date/rails)
401
- #
402
- # | rails | min ruby | rec ruby | minitest | status |
403
- # |-------+----------+----------+----------+----------|
404
- # | 7.0 | >= 2.7 | 3.0 | >= 5.1 | Future |
405
- # | 6.1 | >= 2.5 | 3.0 | >= 5.1 | Current |
406
- # | 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security |
407
- # | 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | Security | EOL @railsconf 2021?
408
- #
409
- # Current versions of ruby: (https://endoflife.date/ruby)
410
- #
411
- # | ruby | Status | EOL Date |
412
- # |------+---------+------------|
413
- # | 3.0 | Current | 2024-03-31 |
414
- # | 2.7 | Maint | 2023-03-31 |
415
- # | 2.6 | Maint* | 2022-03-31 |
416
- # | 2.5 | EOL | 2021-03-31 |
417
- # | 2.4 | EOL | 2020-03-31 |
418
- # | 2.3 | EOL | 2019-03-31 |
419
- # | 2.2 | EOL | 2018-03-31 |
420
- #
421
- # See also:
422
- #
423
- # * https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
424
- # * https://jamesjeffersconsulting.com/ruby-rails-version-matrix/
425
- #
426
- #
427
- # ### How to test SimpleDelegates?
428
- #
429
- # The following implementation and test:
430
- #
431
- # class Worker < SimpleDelegator
432
- # def work
433
- # end
434
- # end
435
- #
436
- # describe Worker do
437
- # before do
438
- # @worker = Worker.new(Object.new)
439
- # end
440
- #
441
- # it "must respond to work" do
442
- # _(@worker).must_respond_to :work
443
- # end
444
- # end
445
- #
446
- # outputs a failure:
447
- #
448
- # 1) Failure:
449
- # Worker#test_0001_must respond to work [bug11.rb:16]:
450
- # Expected #<Object:0x007f9e7184f0a0> (Object) to respond to #work.
451
- #
452
- # Worker is a SimpleDelegate which in 1.9+ is a subclass of BasicObject.
453
- # Expectations are put on Object (one level down) so the Worker (SimpleDelegate)
454
- # hits `method_missing` and delegates down to the `Object.new` instance. That
455
- # object doesn't respond to work so the test fails.
456
- #
457
- # You can bypass `SimpleDelegate#method_missing` by extending the worker with
458
- # `Minitest::Expectations`. You can either do that in your setup at the instance
459
- # level, like:
460
- #
461
- # before do
462
- # @worker = Worker.new(Object.new)
463
- # @worker.extend Minitest::Expectations
464
- # end
465
- #
466
- # or you can extend the Worker class (within the test file!), like:
467
- #
468
- # class Worker
469
- # include ::Minitest::Expectations
470
- # end
471
- #
472
- # ### How to share code across test classes?
473
- #
474
- # Use a module. That's exactly what they're for:
475
- #
476
- # module UsefulStuff
477
- # def useful_method
478
- # # ...
479
- # end
480
- # end
481
- #
482
- # describe Blah do
483
- # include UsefulStuff
484
- #
485
- # def test_whatever
486
- # # useful_method available here
487
- # end
488
- # end
489
- #
490
- # Remember, `describe` simply creates test classes. It's just ruby at the end of
491
- # the day and all your normal Good Ruby Rules (tm) apply. If you want to extend
492
- # your test using setup/teardown via a module, just make sure you ALWAYS call
493
- # super. before/after automatically call super for you, so make sure you don't
494
- # do it twice.
495
- #
496
- # ### How to run code before a group of tests?
497
- #
498
- # Use a constant with begin...end like this:
499
- #
500
- # describe Blah do
501
- # SETUP = begin
502
- # # ... this runs once when describe Blah starts
503
- # end
504
- # # ...
505
- # end
506
- #
507
- # This can be useful for expensive initializations or sharing state. Remember,
508
- # this is just ruby code, so you need to make sure this technique and sharing
509
- # state doesn't interfere with your tests.
510
- #
511
- # ### Why am I seeing `uninitialized constant MiniTest::Test (NameError)`?
512
- #
513
- # Are you running the test with Bundler (e.g. via `bundle exec` )? If so, in
514
- # order to require minitest, you must first add the `gem 'minitest'` to your
515
- # Gemfile and run `bundle`. Once it's installed, you should be able to require
516
- # minitest and run your tests.
517
- #
518
- # ## Prominent Projects using Minitest:
519
- #
520
- # * arel
521
- # * journey
522
- # * mime-types
523
- # * nokogiri
524
- # * rails (active_support et al)
525
- # * rake
526
- # * rdoc
527
- # * ...and of course, everything from seattle.rb...
528
- #
529
- #
530
- # ## Developing Minitest:
531
- #
532
- # Minitest requires [Hoe](https://rubygems.org/gems/hoe).
533
- #
534
- # ### Minitest's own tests require UTF-8 external encoding.
535
- #
536
- # This is a common problem in Windows, where the default external Encoding is
537
- # often CP850, but can affect any platform. Minitest can run test suites using
538
- # any Encoding, but to run Minitest's own tests you must have a default external
539
- # Encoding of UTF-8.
540
- #
541
- # If your encoding is wrong, you'll see errors like:
542
- #
543
- # --- expected
544
- # +++ actual
545
- # @@ -1,2 +1,3 @@
546
- # # encoding: UTF-8
547
- # -"Expected /\\w+/ to not match \"blah blah blah\"."
548
- # +"Expected /\\w+/ to not match # encoding: UTF-8
549
- # +\"blah blah blah\"."
550
- #
551
- # To check your current encoding, run:
552
- #
553
- # ruby -e 'puts Encoding.default_external'
554
- #
555
- # If your output is something other than UTF-8, you can set the RUBYOPTS env
556
- # variable to a value of '-Eutf-8'. Something like:
557
- #
558
- # RUBYOPT='-Eutf-8' ruby -e 'puts Encoding.default_external'
559
- #
560
- # Check your OS/shell documentation for the precise syntax (the above will not
561
- # work on a basic Windows CMD prompt, look for the SET command). Once you've got
562
- # it successfully outputing UTF-8, use the same setting when running rake in
563
- # Minitest.
564
- #
565
- # ### Minitest's own tests require GNU (or similar) diff.
566
- #
567
- # This is also a problem primarily affecting Windows developers. PowerShell has
568
- # a command called diff, but it is not suitable for use with Minitest.
569
- #
570
- # If you see failures like either of these, you are probably missing diff tool:
571
- #
572
- # 4) Failure:
573
- # TestMinitestUnitTestCase#test_assert_equal_different_long [D:/ruby/seattlerb/minitest/test/minitest/test_minitest_test.rb:936]:
574
- # Expected: "--- expected\n+++ actual\n@@ -1 +1 @@\n-\"hahahahahahahahahahahahahahahahahahahaha\"\n+\"blahblahblahblahblahblahblahblahblahblah\"\n"
575
- # Actual: "Expected: \"hahahahahahahahahahahahahahahahahahahaha\"\n Actual: \"blahblahblahblahblahblahblahblahblahblah\""
576
- #
577
- # 5) Failure:
578
- # TestMinitestUnitTestCase#test_assert_equal_different_collection_hash_hex_invisible [D:/ruby/seattlerb/minitest/test/minitest/test_minitest_test.rb:845]:
579
- # Expected: "No visible difference in the Hash#inspect output.\nYou should look at the implementation of #== on Hash or its members.\n
580
- # {1=>#<Object:0xXXXXXX>}"
581
- # Actual: "Expected: {1=>#<Object:0x00000003ba0470>}\n Actual: {1=>#<Object:0x00000003ba0448>}"
582
- #
583
- # If you use Cygwin or MSYS2 or similar there are packages that include a GNU
584
- # diff for Windows. If you don't, you can download GNU diffutils from
585
- # http://gnuwin32.sourceforge.net/packages/diffutils.htm (make sure to add it to
586
- # your PATH).
587
- #
588
- # You can make sure it's installed and path is configured properly with:
589
- #
590
- # diff.exe -v
591
- #
592
- # There are multiple lines of output, the first should be something like:
593
- #
594
- # diff (GNU diffutils) 2.8.1
595
- #
596
- # If you are using PowerShell make sure you run diff.exe, not just diff, which
597
- # will invoke the PowerShell built in function.
598
- #
599
- # ## Known Extensions:
600
- #
601
- # capybara_minitest_spec
602
- # : Bridge between Capybara RSpec matchers and Minitest::Spec expectations
603
- # (e.g. `page.must_have_content("Title")`).
604
- # color_pound_spec_reporter
605
- # : Test names print Ruby Object types in color with your Minitest Spec style
606
- # tests.
607
- # minispec-metadata
608
- # : Metadata for describe/it blocks & CLI tag filter. E.g. `it "requires JS
609
- # driver", js: true do` & `ruby test.rb --tag js` runs tests tagged :js.
610
- # minispec-rails
611
- # : Minimal support to use Spec style in Rails 5+.
612
- # mini-apivore
613
- # : for swagger based automated API testing.
614
- # minitest-around
615
- # : Around block for minitest. An alternative to setup/teardown dance.
616
- # minitest-assert_errors
617
- # : Adds Minitest assertions to test for errors raised or not raised by
618
- # Minitest itself.
619
- # minitest-autotest
620
- # : autotest is a continuous testing facility meant to be used during
621
- # development.
622
- # minitest-bacon
623
- # : minitest-bacon extends minitest with bacon-like functionality.
624
- # minitest-bang
625
- # : Adds support for RSpec-style let! to immediately invoke let statements
626
- # before each test.
627
- # minitest-bisect
628
- # : Helps you isolate and debug random test failures.
629
- # minitest-blink1_reporter
630
- # : Display test results with a Blink1.
631
- # minitest-capistrano
632
- # : Assertions and expectations for testing Capistrano recipes.
633
- # minitest-capybara
634
- # : Capybara matchers support for minitest unit and spec.
635
- # minitest-chef-handler
636
- # : Run Minitest suites as Chef report handlers
637
- # minitest-ci
638
- # : CI reporter plugin for Minitest.
639
- # minitest-context
640
- # : Defines contexts for code reuse in Minitest specs that share common
641
- # expectations.
642
- # minitest-debugger
643
- # : Wraps assert so failed assertions drop into the ruby debugger.
644
- # minitest-display
645
- # : Patches Minitest to allow for an easily configurable output.
646
- # minitest-documentation
647
- # : Minimal documentation format inspired by rspec's.
648
- # minitest-doc_reporter
649
- # : Detailed output inspired by rspec's documentation format.
650
- # minitest-emoji
651
- # : Print out emoji for your test passes, fails, and skips.
652
- # minitest-english
653
- # : Semantically symmetric aliases for assertions and expectations.
654
- # minitest-excludes
655
- # : Clean API for excluding certain tests you don't want to run under certain
656
- # conditions.
657
- # minitest-fail-fast
658
- # : Reimplements RSpec's "fail fast" feature
659
- # minitest-filecontent
660
- # : Support unit tests with expectation results in files. Differing results
661
- # will be stored again in files.
662
- # minitest-filesystem
663
- # : Adds assertion and expectation to help testing filesystem contents.
664
- # minitest-firemock
665
- # : Makes your Minitest mocks more resilient.
666
- # minitest-focus
667
- # : Focus on one test at a time.
668
- # minitest-gcstats
669
- # : A minitest plugin that adds a report of the top tests by number of objects
670
- # allocated.
671
- # minitest-global_expectations
672
- # : Support minitest expectation methods for all objects
673
- # minitest-great_expectations
674
- # : Generally useful additions to minitest's assertions and expectations.
675
- # minitest-growl
676
- # : Test notifier for minitest via growl.
677
- # minitest-happy
678
- # : GLOBALLY ACTIVATE MINITEST PRIDE! RAWR!
679
- # minitest-have_tag
680
- # : Adds Minitest assertions to test for the existence of HTML tags, including
681
- # contents, within a provided string.
682
- # minitest-heat
683
- # : Reporting that builds a heat map of failure locations
684
- # minitest-hooks
685
- # : Around and before_all/after_all/around_all hooks
686
- # minitest-hyper
687
- # : Pretty, single-page HTML reports for your Minitest runs
688
- # minitest-implicit-subject
689
- # : Implicit declaration of the test subject.
690
- # minitest-instrument
691
- # : Instrument ActiveSupport::Notifications when test method is executed.
692
- # minitest-instrument-db
693
- # : Store information about speed of test execution provided by
694
- # minitest-instrument in database.
695
- # minitest-junit
696
- # : JUnit-style XML reporter for minitest.
697
- # minitest-keyword
698
- # : Use Minitest assertions with keyword arguments.
699
- # minitest-libnotify
700
- # : Test notifier for minitest via libnotify.
701
- # minitest-line
702
- # : Run test at line number.
703
- # minitest-logger
704
- # : Define assert_log and enable minitest to test log messages. Supports
705
- # Logger and Log4r::Logger.
706
- # minitest-macruby
707
- # : Provides extensions to minitest for macruby UI testing.
708
- # minitest-matchers
709
- # : Adds support for RSpec-style matchers to minitest.
710
- # minitest-matchers_vaccine
711
- # : Adds assertions that adhere to the matcher spec, but without any
712
- # expectation infections.
713
- # minitest-metadata
714
- # : Annotate tests with metadata (key-value).
715
- # minitest-mock_expectations
716
- # : Provides method call assertions for minitest.
717
- # minitest-mongoid
718
- # : Mongoid assertion matchers for Minitest.
719
- # minitest-must_not
720
- # : Provides must_not as an alias for wont in Minitest.
721
- # minitest-optional_retry
722
- # : Automatically retry failed test to help with flakiness.
723
- # minitest-osx
724
- # : Reporter for the Mac OS X notification center.
725
- # minitest-parallel_fork
726
- # : Fork-based parallelization
727
- # minitest-parallel-db
728
- # : Run tests in parallel with a single database.
729
- # minitest-power_assert
730
- # : PowerAssert for Minitest.
731
- # minitest-predicates
732
- # : Adds support for .predicate? methods.
733
- # minitest-profile
734
- # : List the 10 slowest tests in your suite.
735
- # minitest-rails
736
- # : Minitest integration for Rails 3.x.
737
- # minitest-rails-capybara
738
- # : Capybara integration for Minitest::Rails.
739
- # minitest-reporters
740
- # : Create customizable Minitest output formats.
741
- # minitest-rg
742
- # : Colored red/green output for Minitest.
743
- # minitest-rspec_mocks
744
- # : Use RSpec Mocks with Minitest.
745
- # minitest-server
746
- # : minitest-server provides a client/server setup with your minitest process,
747
- # allowing your test run to send its results directly to a handler.
748
- # minitest-sequel
749
- # : Minitest assertions to speed-up development and testing of Ruby Sequel
750
- # database setups.
751
- # minitest-shared_description
752
- # : Support for shared specs and shared spec subclasses
753
- # minitest-should_syntax
754
- # : RSpec-style `x.should == y` assertions for Minitest.
755
- # minitest-shouldify
756
- # : Adding all manner of shoulds to Minitest (bad idea)
757
- # minitest-snail
758
- # : Print a list of tests that take too long
759
- # minitest-spec-context
760
- # : Provides rspec-ish context method to Minitest::Spec.
761
- # minitest-spec-expect
762
- # : Expect syntax for Minitest::Spec (e.g. expect(sequences).to_include
763
- # :celery_man).
764
- # minitest-spec-magic
765
- # : Minitest::Spec extensions for Rails and beyond.
766
- # minitest-spec-rails
767
- # : Drop in Minitest::Spec superclass for ActiveSupport::TestCase.
768
- # minitest-sprint
769
- # : Runs (Get it? It's fast!) your tests and makes it easier to rerun
770
- # individual failures.
771
- # minitest-stately
772
- # : Find leaking state between tests
773
- # minitest-stub_any_instance
774
- # : Stub any instance of a method on the given class for the duration of a
775
- # block.
776
- # minitest-stub-const
777
- # : Stub constants for the duration of a block.
778
- # minitest-tags
779
- # : Add tags for minitest.
780
- # minitest-unordered
781
- # : Adds a new assertion to minitest for checking the contents of a
782
- # collection, ignoring element order.
783
- # minitest-vcr
784
- # : Automatic cassette managment with Minitest::Spec and VCR.
785
- # minitest_log
786
- # : Adds structured logging, data explication, and verdicts.
787
- # minitest_owrapper
788
- # : Get tests results as a TestResult object.
789
- # minitest_should
790
- # : Shoulda style syntax for minitest test::unit.
791
- # minitest_tu_shim
792
- # : Bridges between test/unit and minitest.
793
- # mongoid-minitest
794
- # : Minitest matchers for Mongoid.
795
- # mutant-minitest
796
- # : Minitest integration for mutant.
797
- # pry-rescue
798
- # : A pry plugin w/ minitest support. See pry-rescue/minitest.rb.
799
- # rematch
800
- # : Declutter your test files from large hardcoded data and update them
801
- # automatically when your code changes.
802
- # rspec2minitest
803
- # : Easily translate any RSpec matchers to Minitest assertions and
804
- # expectations.
805
- #
806
- #
807
- # ## Unknown Extensions:
808
- #
809
- # Authors... Please send me a pull request with a description of your minitest
810
- # extension.
811
- #
812
- # * assay-minitest
813
- # * detroit-minitest
814
- # * em-minitest-spec
815
- # * flexmock-minitest
816
- # * guard-minitest
817
- # * guard-minitest-decisiv
818
- # * minitest-activemodel
819
- # * minitest-ar-assertions
820
- # * minitest-capybara-unit
821
- # * minitest-colorer
822
- # * minitest-deluxe
823
- # * minitest-extra-assertions
824
- # * minitest-rails-shoulda
825
- # * minitest-spec
826
- # * minitest-spec-should
827
- # * minitest-sugar
828
- # * spork-minitest
829
- #
830
- #
831
- # ## Minitest related goods
832
- #
833
- # * minitest/pride fabric:
834
- # http://www.spoonflower.com/fabric/3928730-again-by-katie_allen
835
- #
836
- #
837
- # ## REQUIREMENTS:
838
- #
839
- # * Ruby 2.3+. No magic is involved. I hope.
840
- #
841
- #
842
- # ## INSTALL:
843
- #
844
- # sudo gem install minitest
845
- #
846
- # On 1.9, you already have it. To get newer candy you can still install the gem,
847
- # and then requiring "minitest/autorun" should automatically pull it in. If not,
848
- # you'll need to do it yourself:
849
- #
850
- # gem "minitest" # ensures you"re using the gem, and not the built-in MT
851
- # require "minitest/autorun"
852
- #
853
- # # ... usual testing stuffs ...
854
- #
855
- # DO NOTE: There is a serious problem with the way that ruby 1.9/2.0 packages
856
- # their own gems. They install a gem specification file, but don't install the
857
- # gem contents in the gem path. This messes up Gem.find_files and many other
858
- # things (gem which, gem contents, etc).
859
- #
860
- # Just install minitest as a gem for real and you'll be happier.
861
- #
862
- # ## LICENSE:
863
- #
864
- # (The MIT License)
865
- #
866
- # Copyright (c) Ryan Davis, seattle.rb
867
- #
868
- # Permission is hereby granted, free of charge, to any person obtaining a copy
869
- # of this software and associated documentation files (the 'Software'), to deal
870
- # in the Software without restriction, including without limitation the rights
871
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
872
- # copies of the Software, and to permit persons to whom the Software is
873
- # furnished to do so, subject to the following conditions:
874
- #
875
- # The above copyright notice and this permission notice shall be included in all
876
- # copies or substantial portions of the Software.
877
- #
878
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
879
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
880
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
881
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
882
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
883
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
884
- # SOFTWARE.
885
- #
886
- module Minitest
887
- # <!--
888
- # rdoc-file=lib/minitest.rb
889
- # - autorun()
890
- # -->
891
- # Registers Minitest to run at process exit
892
- #
893
- def self.autorun: () -> untyped
894
-
895
- # <!--
896
- # rdoc-file=lib/minitest.rb
897
- # - after_run(&block)
898
- # -->
899
- # A simple hook allowing you to run a block of code after everything is done
900
- # running. Eg:
901
- #
902
- # Minitest.after_run { p $debugging_info }
903
- #
904
- def self.after_run: () { () -> untyped } -> untyped
905
-
906
- def self.init_plugins: (untyped options) -> untyped
907
-
908
- def self.load_plugins: () -> (nil | untyped)
909
-
910
- # <!--
911
- # rdoc-file=lib/minitest.rb
912
- # - run(args = [])
913
- # -->
914
- # This is the top-level run method. Everything starts from here. It tells each
915
- # Runnable sub-class to run, and each of those are responsible for doing
916
- # whatever they do.
917
- #
918
- # The overall structure of a run looks like this:
919
- #
920
- # Minitest.autorun
921
- # Minitest.run(args)
922
- # Minitest.__run(reporter, options)
923
- # Runnable.runnables.each
924
- # runnable.run(reporter, options)
925
- # self.runnable_methods.each
926
- # self.run_one_method(self, runnable_method, reporter)
927
- # Minitest.run_one_method(klass, runnable_method)
928
- # klass.new(runnable_method).run
929
- #
930
- def self.run: (?untyped args) -> untyped
931
-
932
- # <!--
933
- # rdoc-file=lib/minitest.rb
934
- # - __run(reporter, options)
935
- # -->
936
- # Internal run method. Responsible for telling all Runnable sub-classes to run.
937
- #
938
- def self.__run: (untyped reporter, untyped options) -> untyped
939
-
940
- def self.process_args: (?untyped args) -> untyped
941
-
942
- def self.filter_backtrace: (untyped bt) -> untyped
943
-
944
- def self.run_one_method: (untyped klass, untyped method_name) -> untyped
945
-
946
- # :nodoc:
947
- def self.clock_time: () -> untyped
948
-
949
- def self.plugin_pride_options: (untyped opts, untyped _options) -> untyped
950
-
951
- def self.plugin_pride_init: (untyped options) -> (untyped | nil)
952
-
953
- attr_accessor self.parallel_executor: untyped
954
-
955
- attr_accessor self.backtrace_filter: untyped
956
-
957
- attr_accessor self.reporter: untyped
958
-
959
- attr_accessor self.extensions: untyped
960
-
961
- attr_accessor self.info_signal: untyped
962
-
963
- ENCS: true
964
-
965
- VERSION: String
966
- end