qiita_org 0.1.32 → 0.1.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (416) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -2
  3. data/Gemfile.lock +15 -15
  4. data/lib/qiita_org.rb +18 -36
  5. data/lib/qiita_org/access_qiita.rb +0 -2
  6. data/lib/qiita_org/all.rb +4 -4
  7. data/lib/qiita_org/base.rb +20 -0
  8. data/lib/qiita_org/config.rb +0 -2
  9. data/lib/qiita_org/error_message.rb +15 -10
  10. data/lib/qiita_org/get.rb +0 -4
  11. data/lib/qiita_org/get_multiple_files.rb +1 -4
  12. data/lib/qiita_org/get_template.rb +0 -33
  13. data/lib/qiita_org/list.rb +0 -5
  14. data/lib/qiita_org/md_converter_for_image.rb +1 -1
  15. data/lib/qiita_org/{file_open.rb → old_programs/file_open.rb} +0 -0
  16. data/lib/qiita_org/post.rb +12 -21
  17. data/lib/qiita_org/template.org +1 -1
  18. data/lib/qiita_org/upload.rb +13 -30
  19. data/lib/qiita_org/version.rb +1 -1
  20. data/tests/test.org +2 -1
  21. metadata +3 -2436
  22. data/.bandle/ruby/2.7.0/bin/htmldiff +0 -29
  23. data/.bandle/ruby/2.7.0/bin/ldiff +0 -29
  24. data/.bandle/ruby/2.7.0/bin/qiita_org +0 -27
  25. data/.bandle/ruby/2.7.0/bin/rake +0 -27
  26. data/.bandle/ruby/2.7.0/bin/rspec +0 -27
  27. data/.bandle/ruby/2.7.0/bin/thor +0 -27
  28. data/.bandle/ruby/2.7.0/cache/diff-lcs-1.4.4.gem +0 -0
  29. data/.bandle/ruby/2.7.0/cache/rake-12.3.3.gem +0 -0
  30. data/.bandle/ruby/2.7.0/cache/rspec-3.9.0.gem +0 -0
  31. data/.bandle/ruby/2.7.0/cache/rspec-core-3.9.2.gem +0 -0
  32. data/.bandle/ruby/2.7.0/cache/rspec-expectations-3.9.2.gem +0 -0
  33. data/.bandle/ruby/2.7.0/cache/rspec-mocks-3.9.1.gem +0 -0
  34. data/.bandle/ruby/2.7.0/cache/rspec-support-3.9.3.gem +0 -0
  35. data/.bandle/ruby/2.7.0/cache/thor-1.0.1.gem +0 -0
  36. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/.rspec +0 -1
  37. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/Code-of-Conduct.md +0 -74
  38. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/Contributing.md +0 -118
  39. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/History.md +0 -319
  40. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/License.md +0 -39
  41. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/Manifest.txt +0 -45
  42. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/README.rdoc +0 -84
  43. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/Rakefile +0 -74
  44. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/autotest/discover.rb +0 -3
  45. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/bin/htmldiff +0 -35
  46. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/bin/ldiff +0 -9
  47. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/docs/COPYING.txt +0 -339
  48. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/docs/artistic.txt +0 -127
  49. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff-lcs.rb +0 -3
  50. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs.rb +0 -739
  51. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/array.rb +0 -7
  52. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/backports.rb +0 -9
  53. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/block.rb +0 -37
  54. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/callbacks.rb +0 -325
  55. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/change.rb +0 -174
  56. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/htmldiff.rb +0 -150
  57. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/hunk.rb +0 -358
  58. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/internals.rb +0 -304
  59. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/ldiff.rb +0 -171
  60. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/lib/diff/lcs/string.rb +0 -5
  61. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/change_spec.rb +0 -89
  62. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/diff_spec.rb +0 -51
  63. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/aX +0 -1
  64. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/bXaX +0 -1
  65. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ds1.csv +0 -50
  66. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ds2.csv +0 -51
  67. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff +0 -4
  68. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-c +0 -7
  69. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-e +0 -3
  70. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-f +0 -3
  71. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-u +0 -5
  72. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/hunk_spec.rb +0 -83
  73. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/issues_spec.rb +0 -154
  74. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/lcs_spec.rb +0 -56
  75. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/ldiff_spec.rb +0 -87
  76. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/patch_spec.rb +0 -416
  77. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/sdiff_spec.rb +0 -214
  78. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/spec_helper.rb +0 -375
  79. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/traverse_balanced_spec.rb +0 -310
  80. data/.bandle/ruby/2.7.0/gems/diff-lcs-1.4.4/spec/traverse_sequences_spec.rb +0 -139
  81. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/CONTRIBUTING.rdoc +0 -43
  82. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/Gemfile +0 -3
  83. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/History.rdoc +0 -2344
  84. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/MIT-LICENSE +0 -21
  85. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/README.rdoc +0 -156
  86. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/Rakefile +0 -41
  87. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/azure-pipelines.yml +0 -11
  88. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/bin/bundle +0 -105
  89. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/bin/console +0 -7
  90. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/bin/rake +0 -29
  91. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/bin/rdoc +0 -29
  92. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/bin/rubocop +0 -29
  93. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/bin/setup +0 -6
  94. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/command_line_usage.rdoc +0 -158
  95. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/example/Rakefile1 +0 -38
  96. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/example/Rakefile2 +0 -35
  97. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/example/a.c +0 -6
  98. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/example/b.c +0 -6
  99. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/example/main.c +0 -11
  100. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/glossary.rdoc +0 -42
  101. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/jamis.rb +0 -592
  102. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/proto_rake.rdoc +0 -127
  103. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/rake.1 +0 -156
  104. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/rakefile.rdoc +0 -622
  105. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/doc/rational.rdoc +0 -151
  106. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/exe/rake +0 -27
  107. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake.rb +0 -71
  108. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/application.rb +0 -824
  109. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/backtrace.rb +0 -24
  110. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/clean.rb +0 -78
  111. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/cloneable.rb +0 -17
  112. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/cpu_counter.rb +0 -107
  113. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/default_loader.rb +0 -15
  114. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/dsl_definition.rb +0 -195
  115. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/early_time.rb +0 -22
  116. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/ext/core.rb +0 -26
  117. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/ext/string.rb +0 -176
  118. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_creation_task.rb +0 -25
  119. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_list.rb +0 -435
  120. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_task.rb +0 -54
  121. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_utils.rb +0 -137
  122. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/file_utils_ext.rb +0 -145
  123. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/invocation_chain.rb +0 -57
  124. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/invocation_exception_mixin.rb +0 -17
  125. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/late_time.rb +0 -18
  126. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/linked_list.rb +0 -112
  127. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/loaders/makefile.rb +0 -54
  128. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/multi_task.rb +0 -14
  129. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/name_space.rb +0 -38
  130. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/packagetask.rb +0 -207
  131. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/phony.rb +0 -16
  132. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/private_reader.rb +0 -21
  133. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/promise.rb +0 -100
  134. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/pseudo_status.rb +0 -30
  135. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/rake_module.rb +0 -67
  136. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/rake_test_loader.rb +0 -27
  137. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/rule_recursion_overflow_error.rb +0 -20
  138. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/scope.rb +0 -43
  139. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task.rb +0 -413
  140. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task_argument_error.rb +0 -8
  141. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task_arguments.rb +0 -109
  142. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/task_manager.rb +0 -324
  143. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/tasklib.rb +0 -12
  144. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/testtask.rb +0 -224
  145. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/thread_history_display.rb +0 -49
  146. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/thread_pool.rb +0 -163
  147. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/trace_output.rb +0 -23
  148. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/version.rb +0 -10
  149. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/lib/rake/win32.rb +0 -51
  150. data/.bandle/ruby/2.7.0/gems/rake-12.3.3/rake.gemspec +0 -42
  151. data/.bandle/ruby/2.7.0/gems/rspec-3.9.0/LICENSE.md +0 -27
  152. data/.bandle/ruby/2.7.0/gems/rspec-3.9.0/README.md +0 -43
  153. data/.bandle/ruby/2.7.0/gems/rspec-3.9.0/lib/rspec.rb +0 -3
  154. data/.bandle/ruby/2.7.0/gems/rspec-3.9.0/lib/rspec/version.rb +0 -5
  155. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/.document +0 -5
  156. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/.yardopts +0 -8
  157. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/Changelog.md +0 -2291
  158. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/LICENSE.md +0 -26
  159. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/README.md +0 -384
  160. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/exe/rspec +0 -4
  161. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/autorun.rb +0 -3
  162. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core.rb +0 -186
  163. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/backtrace_formatter.rb +0 -65
  164. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/coordinator.rb +0 -62
  165. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/example_minimizer.rb +0 -173
  166. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/fork_runner.rb +0 -135
  167. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/server.rb +0 -61
  168. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/shell_command.rb +0 -126
  169. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/shell_runner.rb +0 -73
  170. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/bisect/utilities.rb +0 -58
  171. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration.rb +0 -2363
  172. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/configuration_options.rb +0 -233
  173. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/did_you_mean.rb +0 -46
  174. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/drb.rb +0 -113
  175. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/dsl.rb +0 -98
  176. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/example.rb +0 -656
  177. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/example_group.rb +0 -900
  178. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/example_status_persister.rb +0 -235
  179. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/filter_manager.rb +0 -231
  180. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/flat_map.rb +0 -20
  181. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters.rb +0 -273
  182. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_bisect_formatter.rb +0 -45
  183. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_formatter.rb +0 -70
  184. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/base_text_formatter.rb +0 -75
  185. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/bisect_drb_formatter.rb +0 -29
  186. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/bisect_progress_formatter.rb +0 -157
  187. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/console_codes.rb +0 -68
  188. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/deprecation_formatter.rb +0 -223
  189. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/documentation_formatter.rb +0 -102
  190. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/exception_presenter.rb +0 -511
  191. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/failure_list_formatter.rb +0 -23
  192. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/fallback_message_formatter.rb +0 -28
  193. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/helpers.rb +0 -110
  194. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/html_formatter.rb +0 -153
  195. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/html_printer.rb +0 -414
  196. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/html_snippet_extractor.rb +0 -120
  197. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/json_formatter.rb +0 -102
  198. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/profile_formatter.rb +0 -68
  199. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/progress_formatter.rb +0 -29
  200. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/protocol.rb +0 -182
  201. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/snippet_extractor.rb +0 -134
  202. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/formatters/syntax_highlighter.rb +0 -91
  203. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/hooks.rb +0 -641
  204. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/invocations.rb +0 -87
  205. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/memoized_helpers.rb +0 -554
  206. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/metadata.rb +0 -498
  207. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/metadata_filter.rb +0 -255
  208. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/minitest_assertions_adapter.rb +0 -31
  209. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/mocking_adapters/flexmock.rb +0 -31
  210. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/mocking_adapters/mocha.rb +0 -57
  211. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/mocking_adapters/null.rb +0 -14
  212. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/mocking_adapters/rr.rb +0 -31
  213. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/mocking_adapters/rspec.rb +0 -32
  214. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/notifications.rb +0 -521
  215. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/option_parser.rb +0 -316
  216. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/ordering.rb +0 -158
  217. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/output_wrapper.rb +0 -29
  218. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/pending.rb +0 -165
  219. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/profiler.rb +0 -34
  220. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/project_initializer.rb +0 -48
  221. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/project_initializer/.rspec +0 -1
  222. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/project_initializer/spec/spec_helper.rb +0 -100
  223. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/rake_task.rb +0 -188
  224. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/reporter.rb +0 -265
  225. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/ruby_project.rb +0 -53
  226. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/runner.rb +0 -204
  227. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/sandbox.rb +0 -37
  228. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/set.rb +0 -54
  229. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/shared_context.rb +0 -55
  230. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/shared_example_group.rb +0 -271
  231. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/shell_escape.rb +0 -49
  232. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/test_unit_assertions_adapter.rb +0 -30
  233. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/version.rb +0 -9
  234. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/warnings.rb +0 -40
  235. data/.bandle/ruby/2.7.0/gems/rspec-core-3.9.2/lib/rspec/core/world.rb +0 -276
  236. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/.document +0 -5
  237. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/.yardopts +0 -6
  238. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/Changelog.md +0 -1191
  239. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/LICENSE.md +0 -25
  240. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/README.md +0 -320
  241. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations.rb +0 -82
  242. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/block_snippet_extractor.rb +0 -253
  243. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/configuration.rb +0 -215
  244. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/expectation_target.rb +0 -127
  245. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/fail_with.rb +0 -39
  246. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/failure_aggregator.rb +0 -194
  247. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/handler.rb +0 -170
  248. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/minitest_integration.rb +0 -58
  249. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/syntax.rb +0 -132
  250. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/expectations/version.rb +0 -8
  251. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers.rb +0 -1038
  252. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/aliased_matcher.rb +0 -116
  253. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in.rb +0 -52
  254. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/all.rb +0 -86
  255. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/base_matcher.rb +0 -193
  256. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/be.rb +0 -288
  257. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/be_between.rb +0 -77
  258. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/be_instance_of.rb +0 -26
  259. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/be_kind_of.rb +0 -20
  260. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/be_within.rb +0 -72
  261. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/change.rb +0 -428
  262. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/compound.rb +0 -276
  263. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/contain_exactly.rb +0 -302
  264. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/cover.rb +0 -24
  265. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/eq.rb +0 -40
  266. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/eql.rb +0 -34
  267. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/equal.rb +0 -81
  268. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/exist.rb +0 -90
  269. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/has.rb +0 -103
  270. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/have_attributes.rb +0 -114
  271. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/include.rb +0 -149
  272. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/match.rb +0 -106
  273. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/operators.rb +0 -128
  274. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/output.rb +0 -200
  275. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/raise_error.rb +0 -230
  276. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/respond_to.rb +0 -199
  277. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/satisfy.rb +0 -60
  278. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/start_or_end_with.rb +0 -94
  279. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/throw_symbol.rb +0 -132
  280. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/built_in/yield.rb +0 -441
  281. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/composable.rb +0 -171
  282. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/dsl.rb +0 -540
  283. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/english_phrasing.rb +0 -58
  284. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +0 -82
  285. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/fail_matchers.rb +0 -42
  286. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/generated_descriptions.rb +0 -41
  287. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/matcher_delegator.rb +0 -35
  288. data/.bandle/ruby/2.7.0/gems/rspec-expectations-3.9.2/lib/rspec/matchers/matcher_protocol.rb +0 -99
  289. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/.document +0 -5
  290. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/.yardopts +0 -6
  291. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/Changelog.md +0 -1133
  292. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/LICENSE.md +0 -25
  293. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/README.md +0 -463
  294. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks.rb +0 -130
  295. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance.rb +0 -11
  296. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/chain.rb +0 -111
  297. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/error_generator.rb +0 -31
  298. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/expect_chain_chain.rb +0 -31
  299. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/expectation_chain.rb +0 -50
  300. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/message_chains.rb +0 -83
  301. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/proxy.rb +0 -116
  302. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/recorder.rb +0 -294
  303. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/stub_chain.rb +0 -51
  304. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/any_instance/stub_chain_chain.rb +0 -23
  305. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/argument_list_matcher.rb +0 -100
  306. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/argument_matchers.rb +0 -322
  307. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/configuration.rb +0 -212
  308. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/error_generator.rb +0 -369
  309. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/example_methods.rb +0 -434
  310. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/instance_method_stasher.rb +0 -146
  311. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/marshal_extension.rb +0 -41
  312. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/matchers/expectation_customization.rb +0 -20
  313. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/matchers/have_received.rb +0 -134
  314. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/matchers/receive.rb +0 -132
  315. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/matchers/receive_message_chain.rb +0 -82
  316. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/matchers/receive_messages.rb +0 -77
  317. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/message_chain.rb +0 -87
  318. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/message_expectation.rb +0 -751
  319. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/method_double.rb +0 -287
  320. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/method_reference.rb +0 -202
  321. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/minitest_integration.rb +0 -68
  322. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/mutate_const.rb +0 -339
  323. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/object_reference.rb +0 -149
  324. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/order_group.rb +0 -81
  325. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/proxy.rb +0 -503
  326. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/space.rb +0 -238
  327. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/standalone.rb +0 -3
  328. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/syntax.rb +0 -325
  329. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/targets.rb +0 -124
  330. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/test_double.rb +0 -171
  331. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/verifying_double.rb +0 -129
  332. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/verifying_message_expectation.rb +0 -54
  333. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/verifying_proxy.rb +0 -220
  334. data/.bandle/ruby/2.7.0/gems/rspec-mocks-3.9.1/lib/rspec/mocks/version.rb +0 -9
  335. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/Changelog.md +0 -302
  336. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/LICENSE.md +0 -23
  337. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/README.md +0 -40
  338. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support.rb +0 -149
  339. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/caller_filter.rb +0 -83
  340. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/comparable_version.rb +0 -46
  341. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/differ.rb +0 -215
  342. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/directory_maker.rb +0 -63
  343. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/encoded_string.rb +0 -161
  344. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/fuzzy_matcher.rb +0 -48
  345. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/hunk_generator.rb +0 -47
  346. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/matcher_definition.rb +0 -42
  347. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/method_signature_verifier.rb +0 -438
  348. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/mutex.rb +0 -73
  349. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/object_formatter.rb +0 -275
  350. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/recursive_const_methods.rb +0 -76
  351. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/reentrant_mutex.rb +0 -61
  352. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/ruby_features.rb +0 -190
  353. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/source.rb +0 -75
  354. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/source/location.rb +0 -21
  355. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/source/node.rb +0 -110
  356. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/source/token.rb +0 -87
  357. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec.rb +0 -81
  358. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/deprecation_helpers.rb +0 -64
  359. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/formatting_support.rb +0 -9
  360. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/in_sub_process.rb +0 -69
  361. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/library_wide_checks.rb +0 -150
  362. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/shell_out.rb +0 -89
  363. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/stderr_splitter.rb +0 -75
  364. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/string_matcher.rb +0 -46
  365. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/with_isolated_directory.rb +0 -13
  366. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/spec/with_isolated_stderr.rb +0 -13
  367. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/version.rb +0 -7
  368. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/warnings.rb +0 -39
  369. data/.bandle/ruby/2.7.0/gems/rspec-support-3.9.3/lib/rspec/support/with_keywords_when_needed.rb +0 -33
  370. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/.document +0 -5
  371. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/CHANGELOG.md +0 -220
  372. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/CONTRIBUTING.md +0 -15
  373. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/LICENSE.md +0 -20
  374. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/README.md +0 -51
  375. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/bin/thor +0 -6
  376. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor.rb +0 -517
  377. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions.rb +0 -336
  378. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb +0 -104
  379. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions/create_link.rb +0 -61
  380. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions/directory.rb +0 -108
  381. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions/empty_directory.rb +0 -143
  382. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions/file_manipulation.rb +0 -373
  383. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/actions/inject_into_file.rb +0 -120
  384. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/base.rb +0 -699
  385. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/command.rb +0 -142
  386. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/core_ext/hash_with_indifferent_access.rb +0 -97
  387. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/error.rb +0 -110
  388. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/group.rb +0 -281
  389. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb +0 -178
  390. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/line_editor.rb +0 -17
  391. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/line_editor/basic.rb +0 -37
  392. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/line_editor/readline.rb +0 -88
  393. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/nested_context.rb +0 -29
  394. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/parser.rb +0 -4
  395. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/parser/argument.rb +0 -70
  396. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/parser/arguments.rb +0 -175
  397. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/parser/option.rb +0 -159
  398. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/parser/options.rb +0 -236
  399. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/rake_compat.rb +0 -72
  400. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/runner.rb +0 -325
  401. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/shell.rb +0 -81
  402. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/shell/basic.rb +0 -491
  403. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/shell/color.rb +0 -153
  404. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/shell/html.rb +0 -126
  405. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/util.rb +0 -284
  406. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/version.rb +0 -3
  407. data/.bandle/ruby/2.7.0/gems/thor-1.0.1/thor.gemspec +0 -28
  408. data/.bandle/ruby/2.7.0/specifications/diff-lcs-1.4.4.gemspec +0 -50
  409. data/.bandle/ruby/2.7.0/specifications/rake-12.3.3.gemspec +0 -43
  410. data/.bandle/ruby/2.7.0/specifications/rspec-3.9.0.gemspec +0 -39
  411. data/.bandle/ruby/2.7.0/specifications/rspec-core-3.9.2.gemspec +0 -53
  412. data/.bandle/ruby/2.7.0/specifications/rspec-expectations-3.9.2.gemspec +0 -44
  413. data/.bandle/ruby/2.7.0/specifications/rspec-mocks-3.9.1.gemspec +0 -44
  414. data/.bandle/ruby/2.7.0/specifications/rspec-support-3.9.3.gemspec +0 -36
  415. data/.bandle/ruby/2.7.0/specifications/thor-1.0.1.gemspec +0 -34
  416. data/lib/qiita_org/hoge.txt +0 -3
@@ -1,126 +0,0 @@
1
- RSpec::Support.require_rspec_core "shell_escape"
2
- require 'shellwords'
3
-
4
- module RSpec
5
- module Core
6
- module Bisect
7
- # Provides an API to generate shell commands to run the suite for a
8
- # set of locations, using the given bisect server to capture the results.
9
- # @private
10
- class ShellCommand
11
- attr_reader :original_cli_args
12
-
13
- def initialize(original_cli_args)
14
- @original_cli_args = original_cli_args.reject { |arg| arg.start_with?("--bisect") }
15
- end
16
-
17
- def command_for(locations, server)
18
- parts = []
19
-
20
- parts << RUBY << load_path
21
- parts << open3_safe_escape(RSpec::Core.path_to_executable)
22
-
23
- parts << "--format" << "bisect-drb"
24
- parts << "--drb-port" << server.drb_port
25
-
26
- parts.concat(reusable_cli_options)
27
- parts.concat(locations.map { |l| open3_safe_escape(l) })
28
-
29
- parts.join(" ")
30
- end
31
-
32
- def repro_command_from(locations)
33
- parts = []
34
-
35
- parts.concat environment_repro_parts
36
- parts << "rspec"
37
- parts.concat Formatters::Helpers.organize_ids(locations)
38
- parts.concat original_cli_args_without_locations
39
-
40
- parts.join(" ")
41
- end
42
-
43
- def original_locations
44
- parsed_original_cli_options.fetch(:files_or_directories_to_run)
45
- end
46
-
47
- def bisect_environment_hash
48
- if ENV.key?('SPEC_OPTS')
49
- { 'SPEC_OPTS' => spec_opts_without_bisect }
50
- else
51
- {}
52
- end
53
- end
54
-
55
- def spec_opts_without_bisect
56
- Shellwords.join(
57
- Shellwords.split(ENV.fetch('SPEC_OPTS', '')).reject do |arg|
58
- arg =~ /^--bisect/
59
- end
60
- )
61
- end
62
-
63
- private
64
-
65
- include RSpec::Core::ShellEscape
66
- # On JRuby, Open3.popen3 does not handle shellescaped args properly:
67
- # https://github.com/jruby/jruby/issues/2767
68
- if RSpec::Support::Ruby.jruby?
69
- # :nocov:
70
- alias open3_safe_escape quote
71
- # :nocov:
72
- else
73
- alias open3_safe_escape escape
74
- end
75
-
76
- def environment_repro_parts
77
- bisect_environment_hash.map do |k, v|
78
- %Q(#{k}="#{v}")
79
- end
80
- end
81
-
82
- def reusable_cli_options
83
- @reusable_cli_options ||= begin
84
- opts = original_cli_args_without_locations
85
-
86
- if (port = parsed_original_cli_options[:drb_port])
87
- opts -= %W[ --drb-port #{port} ]
88
- end
89
-
90
- parsed_original_cli_options.fetch(:formatters) { [] }.each do |(name, out)|
91
- opts -= %W[ --format #{name} -f -f#{name} ]
92
- opts -= %W[ --out #{out} -o -o#{out} ]
93
- end
94
-
95
- opts
96
- end
97
- end
98
-
99
- def original_cli_args_without_locations
100
- @original_cli_args_without_locations ||= begin
101
- files_or_dirs = parsed_original_cli_options.fetch(:files_or_directories_to_run)
102
- @original_cli_args - files_or_dirs
103
- end
104
- end
105
-
106
- def parsed_original_cli_options
107
- @parsed_original_cli_options ||= Parser.parse(@original_cli_args)
108
- end
109
-
110
- def load_path
111
- @load_path ||= "-I#{$LOAD_PATH.map { |p| open3_safe_escape(p) }.join(':')}"
112
- end
113
-
114
- # Path to the currently running Ruby executable, borrowed from Rake:
115
- # https://github.com/ruby/rake/blob/v10.4.2/lib/rake/file_utils.rb#L8-L12
116
- # Note that we skip `ENV['RUBY']` because we don't have to deal with running
117
- # RSpec from within a MRI source repository:
118
- # https://github.com/ruby/rake/commit/968682759b3b65e42748cd2befb2ff3e982272d9
119
- RUBY = File.join(
120
- RbConfig::CONFIG['bindir'],
121
- RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
122
- sub(/.*\s.*/m, '"\&"')
123
- end
124
- end
125
- end
126
- end
@@ -1,73 +0,0 @@
1
- require 'open3'
2
- RSpec::Support.require_rspec_core "bisect/server"
3
-
4
- module RSpec
5
- module Core
6
- module Bisect
7
- # Provides an API to run the suite for a set of locations, using
8
- # the given bisect server to capture the results.
9
- #
10
- # Sets of specs are run by shelling out.
11
- # @private
12
- class ShellRunner
13
- def self.start(shell_command, _spec_runner)
14
- Server.run do |server|
15
- yield new(server, shell_command)
16
- end
17
- end
18
-
19
- def self.name
20
- :shell
21
- end
22
-
23
- def initialize(server, shell_command)
24
- @server = server
25
- @shell_command = shell_command
26
- end
27
-
28
- def run(locations)
29
- run_locations(locations, original_results.failed_example_ids)
30
- end
31
-
32
- def original_results
33
- @original_results ||= run_locations(@shell_command.original_locations)
34
- end
35
-
36
- private
37
-
38
- def run_locations(*capture_args)
39
- @server.capture_run_results(*capture_args) do
40
- run_command @shell_command.command_for([], @server)
41
- end
42
- end
43
-
44
- # `Open3.capture2e` does not work on JRuby:
45
- # https://github.com/jruby/jruby/issues/2766
46
- if Open3.respond_to?(:capture2e) && !RSpec::Support::Ruby.jruby?
47
- def run_command(cmd)
48
- Open3.capture2e(@shell_command.bisect_environment_hash, cmd).first
49
- end
50
- else # for 1.8.7
51
- # :nocov:
52
- def run_command(cmd)
53
- out = err = nil
54
-
55
- original_spec_opts = ENV['SPEC_OPTS']
56
- ENV['SPEC_OPTS'] = @shell_command.spec_opts_without_bisect
57
-
58
- Open3.popen3(cmd) do |_, stdout, stderr|
59
- # Reading the streams blocks until the process is complete
60
- out = stdout.read
61
- err = stderr.read
62
- end
63
-
64
- "Stdout:\n#{out}\n\nStderr:\n#{err}"
65
- ensure
66
- ENV['SPEC_OPTS'] = original_spec_opts
67
- end
68
- # :nocov:
69
- end
70
- end
71
- end
72
- end
73
- end
@@ -1,58 +0,0 @@
1
- module RSpec
2
- module Core
3
- module Bisect
4
- # @private
5
- ExampleSetDescriptor = Struct.new(:all_example_ids, :failed_example_ids)
6
-
7
- # @private
8
- class BisectFailedError < StandardError
9
- def self.for_failed_spec_run(spec_output)
10
- new("Failed to get results from the spec run. Spec run output:\n\n" +
11
- spec_output)
12
- end
13
- end
14
-
15
- # Wraps a `formatter` providing a simple means to notify it in place
16
- # of an `RSpec::Core::Reporter`, without involving configuration in
17
- # any way.
18
- # @private
19
- class Notifier
20
- def initialize(formatter)
21
- @formatter = formatter
22
- end
23
-
24
- def publish(event, *args)
25
- return unless @formatter.respond_to?(event)
26
- notification = Notifications::CustomNotification.for(*args)
27
- @formatter.__send__(event, notification)
28
- end
29
- end
30
-
31
- # Wraps a pipe to support sending objects between a child and
32
- # parent process.
33
- # @private
34
- class Channel
35
- def initialize
36
- @read_io, @write_io = IO.pipe
37
- end
38
-
39
- def send(message)
40
- packet = Marshal.dump(message)
41
- @write_io.write("#{packet.bytesize}\n#{packet}")
42
- end
43
-
44
- # rubocop:disable Security/MarshalLoad
45
- def receive
46
- packet_size = Integer(@read_io.gets)
47
- Marshal.load(@read_io.read(packet_size))
48
- end
49
- # rubocop:enable Security/MarshalLoad
50
-
51
- def close
52
- @read_io.close
53
- @write_io.close
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,2363 +0,0 @@
1
- RSpec::Support.require_rspec_core "backtrace_formatter"
2
- RSpec::Support.require_rspec_core "ruby_project"
3
- RSpec::Support.require_rspec_core "formatters/deprecation_formatter"
4
- RSpec::Support.require_rspec_core "output_wrapper"
5
-
6
- module RSpec
7
- module Core
8
- # rubocop:disable Metrics/ClassLength
9
-
10
- # Stores runtime configuration information.
11
- #
12
- # Configuration options are loaded from multiple files and joined together
13
- # with command-line switches and the `SPEC_OPTS` environment variable.
14
- #
15
- # Precedence order (where later entries overwrite earlier entries on
16
- # conflicts):
17
- #
18
- # * Global (`$XDG_CONFIG_HOME/rspec/options`, or `~/.rspec` if it does
19
- # not exist)
20
- # * Project-specific (`./.rspec`)
21
- # * Local (`./.rspec-local`)
22
- # * Command-line options
23
- # * `SPEC_OPTS`
24
- #
25
- # For example, an option set in the local file will override an option set
26
- # in your global file.
27
- #
28
- # The global, project-specific and local files can all be overridden with a
29
- # separate custom file using the --options command-line parameter.
30
- #
31
- # @example Standard settings
32
- # RSpec.configure do |c|
33
- # c.drb = true
34
- # c.drb_port = 1234
35
- # c.default_path = 'behavior'
36
- # end
37
- #
38
- # @example Hooks
39
- # RSpec.configure do |c|
40
- # c.before(:suite) { establish_connection }
41
- # c.before(:example) { log_in_as :authorized }
42
- # c.around(:example) { |ex| Database.transaction(&ex) }
43
- # end
44
- #
45
- # @see RSpec.configure
46
- # @see Hooks
47
- class Configuration
48
- include RSpec::Core::Hooks
49
-
50
- # Module that holds `attr_reader` declarations. It's in a separate
51
- # module to allow us to override those methods and use `super`.
52
- # @private
53
- Readers = Module.new
54
- include Readers
55
-
56
- # @private
57
- class MustBeConfiguredBeforeExampleGroupsError < StandardError; end
58
-
59
- # @private
60
- def self.define_reader(name)
61
- Readers.class_eval do
62
- remove_method name if method_defined?(name)
63
- attr_reader name
64
- end
65
-
66
- define_method(name) { value_for(name) { super() } }
67
- end
68
-
69
- # @private
70
- def self.define_aliases(name, alias_name)
71
- alias_method alias_name, name
72
- alias_method "#{alias_name}=", "#{name}="
73
- define_predicate_for alias_name
74
- end
75
-
76
- # @private
77
- def self.define_predicate_for(*names)
78
- names.each { |name| alias_method "#{name}?", name }
79
- end
80
-
81
- # @private
82
- #
83
- # Invoked by the `add_setting` instance method. Use that method on a
84
- # `Configuration` instance rather than this class method.
85
- def self.add_setting(name, opts={})
86
- raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
87
- attr_writer name
88
- add_read_only_setting name
89
-
90
- Array(opts[:alias_with]).each do |alias_name|
91
- define_aliases(name, alias_name)
92
- end
93
- end
94
-
95
- # @private
96
- #
97
- # As `add_setting` but only add the reader.
98
- def self.add_read_only_setting(name, opts={})
99
- raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
100
- define_reader name
101
- define_predicate_for name
102
- end
103
-
104
- # @macro [attach] add_setting
105
- # @!attribute [rw] $1
106
- #
107
- # @macro [attach] define_reader
108
- # @!attribute [r] $1
109
-
110
- # @macro add_setting
111
- # Path to use if no path is provided to the `rspec` command (default:
112
- # `"spec"`). Allows you to just type `rspec` instead of `rspec spec` to
113
- # run all the examples in the `spec` directory.
114
- #
115
- # @note Other scripts invoking `rspec` indirectly will ignore this
116
- # setting.
117
- # @return [String]
118
- add_read_only_setting :default_path
119
- def default_path=(path)
120
- project_source_dirs << path
121
- @default_path = path
122
- end
123
-
124
- # @macro add_setting
125
- # Run examples over DRb (default: `false`). RSpec doesn't supply the DRb
126
- # server, but you can use tools like spork.
127
- # @return [Boolean]
128
- add_setting :drb
129
-
130
- # @macro add_setting
131
- # The drb_port (default: nil).
132
- add_setting :drb_port
133
-
134
- # @macro add_setting
135
- # Default: `$stderr`.
136
- add_setting :error_stream
137
-
138
- # Indicates if the DSL has been exposed off of modules and `main`.
139
- # Default: true
140
- # @return [Boolean]
141
- def expose_dsl_globally?
142
- Core::DSL.exposed_globally?
143
- end
144
-
145
- # Use this to expose the core RSpec DSL via `Module` and the `main`
146
- # object. It will be set automatically but you can override it to
147
- # remove the DSL.
148
- # Default: true
149
- def expose_dsl_globally=(value)
150
- if value
151
- Core::DSL.expose_globally!
152
- Core::SharedExampleGroup::TopLevelDSL.expose_globally!
153
- else
154
- Core::DSL.remove_globally!
155
- Core::SharedExampleGroup::TopLevelDSL.remove_globally!
156
- end
157
- end
158
-
159
- # Determines where deprecation warnings are printed.
160
- # Defaults to `$stderr`.
161
- # @return [IO, String] IO or filename to write to
162
- define_reader :deprecation_stream
163
-
164
- # Determines where deprecation warnings are printed.
165
- # @param value [IO, String] IO to write to or filename to write to
166
- def deprecation_stream=(value)
167
- if @reporter && !value.equal?(@deprecation_stream)
168
- warn "RSpec's reporter has already been initialized with " \
169
- "#{deprecation_stream.inspect} as the deprecation stream, so your change to "\
170
- "`deprecation_stream` will be ignored. You should configure it earlier for " \
171
- "it to take effect, or use the `--deprecation-out` CLI option. " \
172
- "(Called from #{CallerFilter.first_non_rspec_line})"
173
- else
174
- @deprecation_stream = value
175
- end
176
- end
177
-
178
- # @macro define_reader
179
- # The file path to use for persisting example statuses. Necessary for the
180
- # `--only-failures` and `--next-failure` CLI options.
181
- #
182
- # @overload example_status_persistence_file_path
183
- # @return [String] the file path
184
- # @overload example_status_persistence_file_path=(value)
185
- # @param value [String] the file path
186
- define_reader :example_status_persistence_file_path
187
-
188
- # Sets the file path to use for persisting example statuses. Necessary for the
189
- # `--only-failures` and `--next-failure` CLI options.
190
- def example_status_persistence_file_path=(value)
191
- @example_status_persistence_file_path = value
192
- clear_values_derived_from_example_status_persistence_file_path
193
- end
194
-
195
- # @macro define_reader
196
- # Indicates if the `--only-failures` (or `--next-failure`) flag is being used.
197
- define_reader :only_failures
198
- alias_method :only_failures?, :only_failures
199
-
200
- # @private
201
- def only_failures_but_not_configured?
202
- only_failures? && !example_status_persistence_file_path
203
- end
204
-
205
- # @macro define_reader
206
- # If specified, indicates the number of failures required before cleaning
207
- # up and exit (default: `nil`). Can also be `true` to fail and exit on first
208
- # failure
209
- define_reader :fail_fast
210
-
211
- # @see fail_fast
212
- def fail_fast=(value)
213
- case value
214
- when true, 'true'
215
- @fail_fast = true
216
- when false, 'false', 0
217
- @fail_fast = false
218
- when nil
219
- @fail_fast = nil
220
- else
221
- @fail_fast = value.to_i
222
-
223
- if value.to_i == 0
224
- # TODO: in RSpec 4, consider raising an error here.
225
- RSpec.warning "Cannot set `RSpec.configuration.fail_fast`" \
226
- " to `#{value.inspect}`. Only `true`, `false`, `nil` and integers" \
227
- " are valid values."
228
- @fail_fast = true
229
- end
230
- end
231
- end
232
-
233
- # @macro add_setting
234
- # Prints the formatter output of your suite without running any
235
- # examples or hooks.
236
- add_setting :dry_run
237
-
238
- # @macro add_setting
239
- # The exit code to return if there are any failures (default: 1).
240
- # @return [Integer]
241
- add_setting :failure_exit_code
242
-
243
- # @macro add_setting
244
- # Whether or not to fail when there are no RSpec examples (default: false).
245
- # @return [Boolean]
246
- add_setting :fail_if_no_examples
247
-
248
- # @macro define_reader
249
- # Indicates files configured to be required.
250
- # @return [Array<String>]
251
- define_reader :requires
252
-
253
- # @macro define_reader
254
- # Returns dirs that have been prepended to the load path by the `-I`
255
- # command line option.
256
- # @return [Array<String>]
257
- define_reader :libs
258
-
259
- # @macro add_setting
260
- # Determines where RSpec will send its output.
261
- # Default: `$stdout`.
262
- # @return [IO, String]
263
- define_reader :output_stream
264
-
265
- # Set the output stream for reporter.
266
- # @attr value [IO, String] IO to write to or filename to write to, defaults to $stdout
267
- def output_stream=(value)
268
- if @reporter && !value.equal?(@output_stream)
269
- warn "RSpec's reporter has already been initialized with " \
270
- "#{output_stream.inspect} as the output stream, so your change to "\
271
- "`output_stream` will be ignored. You should configure it earlier for " \
272
- "it to take effect. (Called from #{CallerFilter.first_non_rspec_line})"
273
- else
274
- @output_stream = value
275
- output_wrapper.output = @output_stream
276
- end
277
- end
278
-
279
- # @macro define_reader
280
- # Load files matching this pattern (default: `'**{,/*/**}/*_spec.rb'`).
281
- # @return [String]
282
- define_reader :pattern
283
-
284
- # Set pattern to match files to load.
285
- # @attr value [String] the filename pattern to filter spec files by
286
- def pattern=(value)
287
- update_pattern_attr :pattern, value
288
- end
289
-
290
- # @macro define_reader
291
- # Exclude files matching this pattern.
292
- # @return [String]
293
- define_reader :exclude_pattern
294
-
295
- # Set pattern to match files to exclude.
296
- # @attr value [String] the filename pattern to exclude spec files by
297
- def exclude_pattern=(value)
298
- update_pattern_attr :exclude_pattern, value
299
- end
300
-
301
- # @macro add_setting
302
- # Specifies which directories contain the source code for your project.
303
- # When a failure occurs, RSpec looks through the backtrace to find a
304
- # a line of source to print. It first looks for a line coming from
305
- # one of the project source directories so that, for example, it prints
306
- # the expectation or assertion call rather than the source code from
307
- # the expectation or assertion framework.
308
- # @return [Array<String>]
309
- add_setting :project_source_dirs
310
-
311
- # @macro add_setting
312
- # Report the times for the slowest examples (default: `false`).
313
- # Use this to specify the number of examples to include in the profile.
314
- # @return [Boolean]
315
- add_setting :profile_examples
316
-
317
- # @macro add_setting
318
- # Run all examples if none match the configured filters
319
- # (default: `false`).
320
- # @deprecated Use {#filter_run_when_matching} instead for the specific
321
- # filters that you want to be ignored if none match.
322
- add_setting :run_all_when_everything_filtered
323
-
324
- # @macro add_setting
325
- # Color to use to indicate success. Defaults to `:green` but can be set
326
- # to one of the following: `[:black, :white, :red, :green, :yellow,
327
- # :blue, :magenta, :cyan]`
328
- # @return [Symbol]
329
- add_setting :success_color
330
-
331
- # @macro add_setting
332
- # Color to use to print pending examples. Defaults to `:yellow` but can
333
- # be set to one of the following: `[:black, :white, :red, :green,
334
- # :yellow, :blue, :magenta, :cyan]`
335
- # @return [Symbol]
336
- add_setting :pending_color
337
-
338
- # @macro add_setting
339
- # Color to use to indicate failure. Defaults to `:red` but can be set to
340
- # one of the following: `[:black, :white, :red, :green, :yellow, :blue,
341
- # :magenta, :cyan]`
342
- # @return [Symbol]
343
- add_setting :failure_color
344
-
345
- # @macro add_setting
346
- # The default output color. Defaults to `:white` but can be set to one of
347
- # the following: `[:black, :white, :red, :green, :yellow, :blue,
348
- # :magenta, :cyan]`
349
- # @return [Symbol]
350
- add_setting :default_color
351
-
352
- # @macro add_setting
353
- # Color used when a pending example is fixed. Defaults to `:blue` but can
354
- # be set to one of the following: `[:black, :white, :red, :green,
355
- # :yellow, :blue, :magenta, :cyan]`
356
- # @return [Symbol]
357
- add_setting :fixed_color
358
-
359
- # @macro add_setting
360
- # Color used to print details. Defaults to `:cyan` but can be set to one
361
- # of the following: `[:black, :white, :red, :green, :yellow, :blue,
362
- # :magenta, :cyan]`
363
- # @return [Symbol]
364
- add_setting :detail_color
365
-
366
- # @macro add_setting
367
- # Don't print filter info i.e. "Run options: include {:focus=>true}"
368
- # (default `false`).
369
- # return [Boolean]
370
- add_setting :silence_filter_announcements
371
-
372
- # @deprecated This config option was added in RSpec 2 to pave the way
373
- # for this being the default behavior in RSpec 3. Now this option is
374
- # a no-op.
375
- def treat_symbols_as_metadata_keys_with_true_values=(_value)
376
- RSpec.deprecate(
377
- "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values=",
378
- :message => "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values= " \
379
- "is deprecated, it is now set to true as default and " \
380
- "setting it to false has no effect."
381
- )
382
- end
383
-
384
- # @macro define_reader
385
- # Configures how RSpec treats metadata passed as part of a shared example
386
- # group definition. For example, given this shared example group definition:
387
- #
388
- # RSpec.shared_context "uses DB", :db => true do
389
- # around(:example) do |ex|
390
- # MyORM.transaction(:rollback => true, &ex)
391
- # end
392
- # end
393
- #
394
- # ...there are two ways RSpec can treat the `:db => true` metadata, each
395
- # of which has a corresponding config option:
396
- #
397
- # 1. `:trigger_inclusion`: this shared context will be implicitly included
398
- # in any groups (or examples) that have `:db => true` metadata.
399
- # 2. `:apply_to_host_groups`: the metadata will be inherited by the metadata
400
- # hash of all host groups and examples.
401
- #
402
- # `:trigger_inclusion` is the legacy behavior from before RSpec 3.5 but should
403
- # be considered deprecated. Instead, you can explicitly include a group with
404
- # `include_context`:
405
- #
406
- # RSpec.describe "My model" do
407
- # include_context "uses DB"
408
- # end
409
- #
410
- # ...or you can configure RSpec to include the context based on matching metadata
411
- # using an API that mirrors configured module inclusion:
412
- #
413
- # RSpec.configure do |rspec|
414
- # rspec.include_context "uses DB", :db => true
415
- # end
416
- #
417
- # `:apply_to_host_groups` is a new feature of RSpec 3.5 and will be the only
418
- # supported behavior in RSpec 4.
419
- #
420
- # @overload shared_context_metadata_behavior
421
- # @return [:trigger_inclusion, :apply_to_host_groups] the configured behavior
422
- # @overload shared_context_metadata_behavior=(value)
423
- # @param value [:trigger_inclusion, :apply_to_host_groups] sets the configured behavior
424
- define_reader :shared_context_metadata_behavior
425
- # @see shared_context_metadata_behavior
426
- def shared_context_metadata_behavior=(value)
427
- case value
428
- when :trigger_inclusion, :apply_to_host_groups
429
- @shared_context_metadata_behavior = value
430
- else
431
- raise ArgumentError, "Cannot set `RSpec.configuration." \
432
- "shared_context_metadata_behavior` to `#{value.inspect}`. Only " \
433
- "`:trigger_inclusion` and `:apply_to_host_groups` are valid values."
434
- end
435
- end
436
-
437
- # Record the start time of the spec suite to measure load time.
438
- # return [Time]
439
- add_setting :start_time
440
-
441
- # @macro add_setting
442
- # Use threadsafe options where available.
443
- # Currently this will place a mutex around memoized values such as let blocks.
444
- # return [Boolean]
445
- add_setting :threadsafe
446
-
447
- # @macro add_setting
448
- # Maximum count of failed source lines to display in the failure reports.
449
- # (default `10`).
450
- # return [Integer]
451
- add_setting :max_displayed_failure_line_count
452
-
453
- # Determines which bisect runner implementation gets used to run subsets
454
- # of the suite during a bisection. Your choices are:
455
- #
456
- # - `:shell`: Performs a spec run by shelling out, booting RSpec and your
457
- # application environment each time. This runner is the most widely
458
- # compatible runner, but is not as fast. On platforms that do not
459
- # support forking, this is the default.
460
- # - `:fork`: Pre-boots RSpec and your application environment in a parent
461
- # process, and then forks a child process for each spec run. This runner
462
- # tends to be significantly faster than the `:shell` runner but cannot
463
- # be used in some situations. On platforms that support forking, this
464
- # is the default. If you use this runner, you should ensure that all
465
- # of your one-time setup logic goes in a `before(:suite)` hook instead
466
- # of getting run at the top-level of a file loaded by `--require`.
467
- #
468
- # @note This option will only be used by `--bisect` if you set it in a file
469
- # loaded via `--require`.
470
- #
471
- # @return [Symbol]
472
- attr_reader :bisect_runner
473
- def bisect_runner=(value)
474
- if @bisect_runner_class && value != @bisect_runner
475
- raise "`config.bisect_runner = #{value.inspect}` can no longer take " \
476
- "effect as the #{@bisect_runner.inspect} bisect runnner is already " \
477
- "in use. This config setting must be set in a file loaded by a " \
478
- "`--require` option (passed at the CLI or in a `.rspec` file) for " \
479
- "it to have any effect."
480
- end
481
-
482
- @bisect_runner = value
483
- end
484
-
485
- # @private
486
- # @deprecated Use {#color_mode} = :on, instead of {#color} with {#tty}
487
- add_setting :tty
488
- # @private
489
- attr_writer :files_to_run
490
- # @private
491
- attr_accessor :filter_manager, :world
492
- # @private
493
- attr_accessor :static_config_filter_manager
494
- # @private
495
- attr_reader :backtrace_formatter, :ordering_manager, :loaded_spec_files
496
-
497
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
498
-
499
- # Build an object to store runtime configuration options and set defaults
500
- def initialize
501
- # rubocop:disable Style/GlobalVars
502
- @start_time = $_rspec_core_load_started_at || ::RSpec::Core::Time.now
503
- # rubocop:enable Style/GlobalVars
504
- @expectation_frameworks = []
505
- @include_modules = FilterableItemRepository::QueryOptimized.new(:any?)
506
- @extend_modules = FilterableItemRepository::QueryOptimized.new(:any?)
507
- @prepend_modules = FilterableItemRepository::QueryOptimized.new(:any?)
508
-
509
- @bisect_runner = RSpec::Support::RubyFeatures.fork_supported? ? :fork : :shell
510
- @bisect_runner_class = nil
511
-
512
- @before_suite_hooks = []
513
- @after_suite_hooks = []
514
-
515
- @mock_framework = nil
516
- @files_or_directories_to_run = []
517
- @loaded_spec_files = Set.new
518
- @color = false
519
- @color_mode = :automatic
520
- @pattern = '**{,/*/**}/*_spec.rb'
521
- @exclude_pattern = ''
522
- @failure_exit_code = 1
523
- @fail_if_no_examples = false
524
- @spec_files_loaded = false
525
-
526
- @backtrace_formatter = BacktraceFormatter.new
527
-
528
- @default_path = 'spec'
529
- @project_source_dirs = %w[ spec lib app ]
530
- @deprecation_stream = $stderr
531
- @output_stream = $stdout
532
- @reporter = nil
533
- @reporter_buffer = nil
534
- @filter_manager = FilterManager.new
535
- @static_config_filter_manager = FilterManager.new
536
- @ordering_manager = Ordering::ConfigurationManager.new
537
- @preferred_options = {}
538
- @failure_color = :red
539
- @success_color = :green
540
- @pending_color = :yellow
541
- @default_color = :white
542
- @fixed_color = :blue
543
- @detail_color = :cyan
544
- @profile_examples = false
545
- @requires = []
546
- @libs = []
547
- @derived_metadata_blocks = FilterableItemRepository::QueryOptimized.new(:any?)
548
- @threadsafe = true
549
- @max_displayed_failure_line_count = 10
550
- @world = World::Null
551
- @shared_context_metadata_behavior = :trigger_inclusion
552
-
553
- define_built_in_hooks
554
- end
555
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
556
-
557
- # @private
558
- #
559
- # Used to set higher priority option values from the command line.
560
- def force(hash)
561
- ordering_manager.force(hash)
562
- @preferred_options.merge!(hash)
563
-
564
- return unless hash.key?(:example_status_persistence_file_path)
565
- clear_values_derived_from_example_status_persistence_file_path
566
- end
567
-
568
- # @private
569
- def reset
570
- @spec_files_loaded = false
571
- reset_reporter
572
- end
573
-
574
- # @private
575
- def reset_reporter
576
- @reporter = nil
577
- @formatter_loader = nil
578
- @output_wrapper = nil
579
- end
580
-
581
- # @private
582
- def reset_filters
583
- self.filter_manager = FilterManager.new
584
- filter_manager.include_only(
585
- Metadata.deep_hash_dup(static_config_filter_manager.inclusions.rules)
586
- )
587
- filter_manager.exclude_only(
588
- Metadata.deep_hash_dup(static_config_filter_manager.exclusions.rules)
589
- )
590
- end
591
-
592
- # @overload add_setting(name)
593
- # @overload add_setting(name, opts)
594
- # @option opts [Symbol] :default
595
- #
596
- # Set a default value for the generated getter and predicate methods:
597
- #
598
- # add_setting(:foo, :default => "default value")
599
- #
600
- # @option opts [Symbol] :alias_with
601
- #
602
- # Use `:alias_with` to alias the setter, getter, and predicate to
603
- # another name, or names:
604
- #
605
- # add_setting(:foo, :alias_with => :bar)
606
- # add_setting(:foo, :alias_with => [:bar, :baz])
607
- #
608
- # Adds a custom setting to the RSpec.configuration object.
609
- #
610
- # RSpec.configuration.add_setting :foo
611
- #
612
- # Used internally and by extension frameworks like rspec-rails, so they
613
- # can add config settings that are domain specific. For example:
614
- #
615
- # RSpec.configure do |c|
616
- # c.add_setting :use_transactional_fixtures,
617
- # :default => true,
618
- # :alias_with => :use_transactional_examples
619
- # end
620
- #
621
- # `add_setting` creates three methods on the configuration object, a
622
- # setter, a getter, and a predicate:
623
- #
624
- # RSpec.configuration.foo=(value)
625
- # RSpec.configuration.foo
626
- # RSpec.configuration.foo? # Returns true if foo returns anything but nil or false.
627
- def add_setting(name, opts={})
628
- default = opts.delete(:default)
629
- (class << self; self; end).class_exec do
630
- add_setting(name, opts)
631
- end
632
- __send__("#{name}=", default) if default
633
- end
634
-
635
- # Returns the configured mock framework adapter module.
636
- # @return [Symbol]
637
- def mock_framework
638
- if @mock_framework.nil?
639
- begin
640
- mock_with :rspec
641
- rescue LoadError
642
- mock_with :nothing
643
- end
644
- end
645
- @mock_framework
646
- end
647
-
648
- # Delegates to mock_framework=(framework).
649
- def mock_framework=(framework)
650
- mock_with framework
651
- end
652
-
653
- # Regexps used to exclude lines from backtraces.
654
- #
655
- # Excludes lines from ruby (and jruby) source, installed gems, anything
656
- # in any "bin" directory, and any of the RSpec libs (outside gem
657
- # installs) by default.
658
- #
659
- # You can modify the list via the getter, or replace it with the setter.
660
- #
661
- # To override this behaviour and display a full backtrace, use
662
- # `--backtrace` on the command line, in a `.rspec` file, or in the
663
- # `rspec_options` attribute of RSpec's rake task.
664
- # @return [Array<Regexp>]
665
- def backtrace_exclusion_patterns
666
- @backtrace_formatter.exclusion_patterns
667
- end
668
-
669
- # Set regular expressions used to exclude lines in backtrace.
670
- # @param patterns [Array<Regexp>] set backtrace_formatter exlusion_patterns
671
- def backtrace_exclusion_patterns=(patterns)
672
- @backtrace_formatter.exclusion_patterns = patterns
673
- end
674
-
675
- # Regexps used to include lines in backtraces.
676
- #
677
- # Defaults to [Regexp.new Dir.getwd].
678
- #
679
- # Lines that match an exclusion _and_ an inclusion pattern
680
- # will be included.
681
- #
682
- # You can modify the list via the getter, or replace it with the setter.
683
- # @return [Array<Regexp>]
684
- def backtrace_inclusion_patterns
685
- @backtrace_formatter.inclusion_patterns
686
- end
687
-
688
- # Set regular expressions used to include lines in backtrace.
689
- # @attr patterns [Array<Regexp>] set backtrace_formatter inclusion_patterns
690
- def backtrace_inclusion_patterns=(patterns)
691
- @backtrace_formatter.inclusion_patterns = patterns
692
- end
693
-
694
- # Adds {#backtrace_exclusion_patterns} that will filter lines from
695
- # the named gems from backtraces.
696
- #
697
- # @param gem_names [Array<String>] Names of the gems to filter
698
- #
699
- # @example
700
- # RSpec.configure do |config|
701
- # config.filter_gems_from_backtrace "rack", "rake"
702
- # end
703
- #
704
- # @note The patterns this adds will match the named gems in their common
705
- # locations (e.g. system gems, vendored with bundler, installed as a
706
- # :git dependency with bundler, etc) but is not guaranteed to work for
707
- # all possible gem locations. For example, if you have the gem source
708
- # in a directory with a completely unrelated name, and use bundler's
709
- # :path option, this will not filter it.
710
- def filter_gems_from_backtrace(*gem_names)
711
- gem_names.each do |name|
712
- @backtrace_formatter.filter_gem(name)
713
- end
714
- end
715
-
716
- # @private
717
- MOCKING_ADAPTERS = {
718
- :rspec => :RSpec,
719
- :flexmock => :Flexmock,
720
- :rr => :RR,
721
- :mocha => :Mocha,
722
- :nothing => :Null
723
- }
724
-
725
- # Sets the mock framework adapter module.
726
- #
727
- # `framework` can be a Symbol or a Module.
728
- #
729
- # Given any of `:rspec`, `:mocha`, `:flexmock`, or `:rr`, configures the
730
- # named framework.
731
- #
732
- # Given `:nothing`, configures no framework. Use this if you don't use
733
- # any mocking framework to save a little bit of overhead.
734
- #
735
- # Given a Module, includes that module in every example group. The module
736
- # should adhere to RSpec's mock framework adapter API:
737
- #
738
- # setup_mocks_for_rspec
739
- # - called before each example
740
- #
741
- # verify_mocks_for_rspec
742
- # - called after each example if the example hasn't yet failed.
743
- # Framework should raise an exception when expectations fail
744
- #
745
- # teardown_mocks_for_rspec
746
- # - called after verify_mocks_for_rspec (even if there are errors)
747
- #
748
- # If the module responds to `configuration` and `mock_with` receives a
749
- # block, it will yield the configuration object to the block e.g.
750
- #
751
- # config.mock_with OtherMockFrameworkAdapter do |mod_config|
752
- # mod_config.custom_setting = true
753
- # end
754
- def mock_with(framework)
755
- framework_module =
756
- if framework.is_a?(Module)
757
- framework
758
- else
759
- const_name = MOCKING_ADAPTERS.fetch(framework) do
760
- raise ArgumentError,
761
- "Unknown mocking framework: #{framework.inspect}. " \
762
- "Pass a module or one of #{MOCKING_ADAPTERS.keys.inspect}"
763
- end
764
-
765
- RSpec::Support.require_rspec_core "mocking_adapters/#{const_name.to_s.downcase}"
766
- RSpec::Core::MockingAdapters.const_get(const_name)
767
- end
768
-
769
- new_name, old_name = [framework_module, @mock_framework].map do |mod|
770
- mod.respond_to?(:framework_name) ? mod.framework_name : :unnamed
771
- end
772
-
773
- unless new_name == old_name
774
- assert_no_example_groups_defined(:mock_framework)
775
- end
776
-
777
- if block_given?
778
- raise "#{framework_module} must respond to `configuration` so that " \
779
- "mock_with can yield it." unless framework_module.respond_to?(:configuration)
780
- yield framework_module.configuration
781
- end
782
-
783
- @mock_framework = framework_module
784
- end
785
-
786
- # Returns the configured expectation framework adapter module(s)
787
- def expectation_frameworks
788
- if @expectation_frameworks.empty?
789
- begin
790
- expect_with :rspec
791
- rescue LoadError
792
- expect_with Module.new
793
- end
794
- end
795
- @expectation_frameworks
796
- end
797
-
798
- # Delegates to expect_with(framework).
799
- def expectation_framework=(framework)
800
- expect_with(framework)
801
- end
802
-
803
- # Sets the expectation framework module(s) to be included in each example
804
- # group.
805
- #
806
- # `frameworks` can be `:rspec`, `:test_unit`, `:minitest`, a custom
807
- # module, or any combination thereof:
808
- #
809
- # config.expect_with :rspec
810
- # config.expect_with :test_unit
811
- # config.expect_with :minitest
812
- # config.expect_with :rspec, :minitest
813
- # config.expect_with OtherExpectationFramework
814
- #
815
- # RSpec will translate `:rspec`, `:minitest`, and `:test_unit` into the
816
- # appropriate modules.
817
- #
818
- # ## Configuration
819
- #
820
- # If the module responds to `configuration`, `expect_with` will
821
- # yield the `configuration` object if given a block:
822
- #
823
- # config.expect_with OtherExpectationFramework do |custom_config|
824
- # custom_config.custom_setting = true
825
- # end
826
- def expect_with(*frameworks)
827
- modules = frameworks.map do |framework|
828
- case framework
829
- when Module
830
- framework
831
- when :rspec
832
- require 'rspec/expectations'
833
-
834
- # Tag this exception class so our exception formatting logic knows
835
- # that it satisfies the `MultipleExceptionError` interface.
836
- ::RSpec::Expectations::MultipleExpectationsNotMetError.__send__(
837
- :include, MultipleExceptionError::InterfaceTag
838
- )
839
-
840
- ::RSpec::Matchers
841
- when :test_unit
842
- require 'rspec/core/test_unit_assertions_adapter'
843
- ::RSpec::Core::TestUnitAssertionsAdapter
844
- when :minitest
845
- require 'rspec/core/minitest_assertions_adapter'
846
- ::RSpec::Core::MinitestAssertionsAdapter
847
- else
848
- raise ArgumentError, "#{framework.inspect} is not supported"
849
- end
850
- end
851
-
852
- if (modules - @expectation_frameworks).any?
853
- assert_no_example_groups_defined(:expect_with)
854
- end
855
-
856
- if block_given?
857
- raise "expect_with only accepts a block with a single argument. " \
858
- "Call expect_with #{modules.length} times, " \
859
- "once with each argument, instead." if modules.length > 1
860
- raise "#{modules.first} must respond to `configuration` so that " \
861
- "expect_with can yield it." unless modules.first.respond_to?(:configuration)
862
- yield modules.first.configuration
863
- end
864
-
865
- @expectation_frameworks.push(*modules)
866
- end
867
-
868
- # Check if full backtrace is enabled.
869
- # @return [Boolean] is full backtrace enabled
870
- def full_backtrace?
871
- @backtrace_formatter.full_backtrace?
872
- end
873
-
874
- # Toggle full backtrace.
875
- # @attr true_or_false [Boolean] toggle full backtrace display
876
- def full_backtrace=(true_or_false)
877
- @backtrace_formatter.full_backtrace = true_or_false
878
- end
879
-
880
- # Enables color output if the output is a TTY. As of RSpec 3.6, this is
881
- # the default behavior and this option is retained only for backwards
882
- # compatibility.
883
- #
884
- # @deprecated No longer recommended because of complex behavior. Instead,
885
- # rely on the fact that TTYs will display color by default, or set
886
- # {#color_mode} to :on to display color on a non-TTY output.
887
- # @see color_mode
888
- # @see color_enabled?
889
- # @return [Boolean]
890
- def color
891
- value_for(:color) { @color }
892
- end
893
-
894
- # The mode for determining whether to display output in color. One of:
895
- #
896
- # - :automatic - the output will be in color if the output is a TTY (the
897
- # default)
898
- # - :on - the output will be in color, whether or not the output is a TTY
899
- # - :off - the output will not be in color
900
- #
901
- # @see color_enabled?
902
- # @return [Boolean]
903
- def color_mode
904
- value_for(:color_mode) { @color_mode }
905
- end
906
-
907
- # Check if color is enabled for a particular output.
908
- # @param output [IO] an output stream to use, defaults to the current
909
- # `output_stream`
910
- # @return [Boolean]
911
- def color_enabled?(output=output_stream)
912
- case color_mode
913
- when :on then true
914
- when :off then false
915
- else # automatic
916
- output_to_tty?(output) || (color && tty?)
917
- end
918
- end
919
-
920
- # Set the color mode.
921
- attr_writer :color_mode
922
-
923
- # Toggle output color.
924
- #
925
- # @deprecated No longer recommended because of complex behavior. Instead,
926
- # rely on the fact that TTYs will display color by default, or set
927
- # {:color_mode} to :on to display color on a non-TTY output.
928
- attr_writer :color
929
-
930
- # @private
931
- def libs=(libs)
932
- libs.map do |lib|
933
- @libs.unshift lib
934
- $LOAD_PATH.unshift lib
935
- end
936
- end
937
-
938
- # Run examples matching on `description` in all files to run.
939
- # @param description [String, Regexp] the pattern to filter on
940
- def full_description=(description)
941
- filter_run :full_description => Regexp.union(*Array(description).map { |d| Regexp.new(d) })
942
- end
943
-
944
- # @return [Array] full description filter
945
- def full_description
946
- filter.fetch :full_description, nil
947
- end
948
-
949
- # @overload add_formatter(formatter)
950
- # @overload add_formatter(formatter, output)
951
- #
952
- # @param formatter [Class, String, Object] formatter to use. Can be any of the
953
- # string values supported from the CLI (`p`/`progress`,
954
- # `d`/`doc`/`documentation`, `h`/`html`, or `j`/`json`), any
955
- # class that implements the formatter protocol and has registered
956
- # itself with RSpec as a formatter, or a formatter instance.
957
- # @param output [String, IO] where the formatter will write its output.
958
- # Can be an IO object or a string path to a file. If not provided,
959
- # the configured `output_stream` (`$stdout`, by default) will be used.
960
- #
961
- # Adds a formatter to the set RSpec will use for this run.
962
- #
963
- # @see RSpec::Core::Formatters::Protocol
964
- def add_formatter(formatter, output=output_wrapper)
965
- formatter_loader.add(formatter, output)
966
- end
967
- alias_method :formatter=, :add_formatter
968
-
969
- # The formatter that will be used if no formatter has been set.
970
- # Defaults to 'progress'.
971
- def default_formatter
972
- formatter_loader.default_formatter
973
- end
974
-
975
- # Sets a fallback formatter to use if none other has been set.
976
- #
977
- # @example
978
- #
979
- # RSpec.configure do |rspec|
980
- # rspec.default_formatter = 'doc'
981
- # end
982
- def default_formatter=(value)
983
- formatter_loader.default_formatter = value
984
- end
985
-
986
- # Returns a duplicate of the formatters currently loaded in
987
- # the `FormatterLoader` for introspection.
988
- #
989
- # Note as this is a duplicate, any mutations will be disregarded.
990
- #
991
- # @return [Array] the formatters currently loaded
992
- def formatters
993
- formatter_loader.formatters.dup
994
- end
995
-
996
- # @private
997
- def formatter_loader
998
- @formatter_loader ||= Formatters::Loader.new(Reporter.new(self))
999
- end
1000
-
1001
- # @private
1002
- #
1003
- # This buffer is used to capture all messages sent to the reporter during
1004
- # reporter initialization. It can then replay those messages after the
1005
- # formatter is correctly initialized. Otherwise, deprecation warnings
1006
- # during formatter initialization can cause an infinite loop.
1007
- class DeprecationReporterBuffer
1008
- def initialize
1009
- @calls = []
1010
- end
1011
-
1012
- def deprecation(*args)
1013
- @calls << args
1014
- end
1015
-
1016
- def play_onto(reporter)
1017
- @calls.each do |args|
1018
- reporter.deprecation(*args)
1019
- end
1020
- end
1021
- end
1022
-
1023
- # @return [RSpec::Core::Reporter] the currently configured reporter
1024
- def reporter
1025
- # @reporter_buffer should only ever be set in this method to cover
1026
- # initialization of @reporter.
1027
- @reporter_buffer || @reporter ||=
1028
- begin
1029
- @reporter_buffer = DeprecationReporterBuffer.new
1030
- formatter_loader.prepare_default output_wrapper, deprecation_stream
1031
- @reporter_buffer.play_onto(formatter_loader.reporter)
1032
- @reporter_buffer = nil
1033
- formatter_loader.reporter
1034
- end
1035
- end
1036
-
1037
- # @api private
1038
- #
1039
- # Defaults `profile_examples` to 10 examples when `@profile_examples` is
1040
- # `true`.
1041
- def profile_examples
1042
- profile = value_for(:profile_examples) { @profile_examples }
1043
- if profile && !profile.is_a?(Integer)
1044
- 10
1045
- else
1046
- profile
1047
- end
1048
- end
1049
-
1050
- # @private
1051
- def files_or_directories_to_run=(*files)
1052
- files = files.flatten
1053
-
1054
- if (command == 'rspec' || Runner.running_in_drb?) && default_path && files.empty?
1055
- files << default_path
1056
- end
1057
-
1058
- @files_or_directories_to_run = files
1059
- @files_to_run = nil
1060
- end
1061
-
1062
- # The spec files RSpec will run.
1063
- # @return [Array] specified files about to run
1064
- def files_to_run
1065
- @files_to_run ||= get_files_to_run(@files_or_directories_to_run)
1066
- end
1067
-
1068
- # @private
1069
- def last_run_statuses
1070
- @last_run_statuses ||= Hash.new(UNKNOWN_STATUS).tap do |statuses|
1071
- if (path = example_status_persistence_file_path)
1072
- begin
1073
- ExampleStatusPersister.load_from(path).inject(statuses) do |hash, example|
1074
- status = example[:status]
1075
- status = UNKNOWN_STATUS unless VALID_STATUSES.include?(status)
1076
- hash[example.fetch(:example_id)] = status
1077
- hash
1078
- end
1079
- rescue SystemCallError => e
1080
- RSpec.warning "Could not read from #{path.inspect} (configured as " \
1081
- "`config.example_status_persistence_file_path`) due " \
1082
- "to a system error: #{e.inspect}. Please check that " \
1083
- "the config option is set to an accessible, valid " \
1084
- "file path", :call_site => nil
1085
- end
1086
- end
1087
- end
1088
- end
1089
-
1090
- # @private
1091
- UNKNOWN_STATUS = "unknown".freeze
1092
-
1093
- # @private
1094
- FAILED_STATUS = "failed".freeze
1095
-
1096
- # @private
1097
- PASSED_STATUS = "passed".freeze
1098
-
1099
- # @private
1100
- PENDING_STATUS = "pending".freeze
1101
-
1102
- # @private
1103
- VALID_STATUSES = [UNKNOWN_STATUS, FAILED_STATUS, PASSED_STATUS, PENDING_STATUS]
1104
-
1105
- # @private
1106
- def spec_files_with_failures
1107
- @spec_files_with_failures ||= last_run_statuses.inject(Set.new) do |files, (id, status)|
1108
- files << Example.parse_id(id).first if status == FAILED_STATUS
1109
- files
1110
- end.to_a
1111
- end
1112
-
1113
- # Creates a method that delegates to `example` including the submitted
1114
- # `args`. Used internally to add variants of `example` like `pending`:
1115
- # @param name [String] example name alias
1116
- # @param args [Array<Symbol>, Hash] metadata for the generated example
1117
- #
1118
- # @note The specific example alias below (`pending`) is already
1119
- # defined for you.
1120
- # @note Use with caution. This extends the language used in your
1121
- # specs, but does not add any additional documentation. We use this
1122
- # in RSpec to define methods like `focus` and `xit`, but we also add
1123
- # docs for those methods.
1124
- #
1125
- # @example
1126
- # RSpec.configure do |config|
1127
- # config.alias_example_to :pending, :pending => true
1128
- # end
1129
- #
1130
- # # This lets you do this:
1131
- #
1132
- # RSpec.describe Thing do
1133
- # pending "does something" do
1134
- # thing = Thing.new
1135
- # end
1136
- # end
1137
- #
1138
- # # ... which is the equivalent of
1139
- #
1140
- # RSpec.describe Thing do
1141
- # it "does something", :pending => true do
1142
- # thing = Thing.new
1143
- # end
1144
- # end
1145
- def alias_example_to(name, *args)
1146
- extra_options = Metadata.build_hash_from(args)
1147
- RSpec::Core::ExampleGroup.define_example_method(name, extra_options)
1148
- end
1149
-
1150
- # Creates a method that defines an example group with the provided
1151
- # metadata. Can be used to define example group/metadata shortcuts.
1152
- #
1153
- # @example
1154
- # RSpec.configure do |config|
1155
- # config.alias_example_group_to :describe_model, :type => :model
1156
- # end
1157
- #
1158
- # shared_context_for "model tests", :type => :model do
1159
- # # define common model test helper methods, `let` declarations, etc
1160
- # end
1161
- #
1162
- # # This lets you do this:
1163
- #
1164
- # RSpec.describe_model User do
1165
- # end
1166
- #
1167
- # # ... which is the equivalent of
1168
- #
1169
- # RSpec.describe User, :type => :model do
1170
- # end
1171
- #
1172
- # @note The defined aliased will also be added to the top level
1173
- # (e.g. `main` and from within modules) if
1174
- # `expose_dsl_globally` is set to true.
1175
- # @see #alias_example_to
1176
- # @see #expose_dsl_globally=
1177
- def alias_example_group_to(new_name, *args)
1178
- extra_options = Metadata.build_hash_from(args)
1179
- RSpec::Core::ExampleGroup.define_example_group_method(new_name, extra_options)
1180
- end
1181
-
1182
- # Define an alias for it_should_behave_like that allows different
1183
- # language (like "it_has_behavior" or "it_behaves_like") to be
1184
- # employed when including shared examples.
1185
- #
1186
- # @example
1187
- # RSpec.configure do |config|
1188
- # config.alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
1189
- # end
1190
- #
1191
- # # allows the user to include a shared example group like:
1192
- #
1193
- # RSpec.describe Entity do
1194
- # it_has_behavior 'sortability' do
1195
- # let(:sortable) { Entity.new }
1196
- # end
1197
- # end
1198
- #
1199
- # # which is reported in the output as:
1200
- # # Entity
1201
- # # has behavior: sortability
1202
- # # ...sortability examples here
1203
- #
1204
- # @note Use with caution. This extends the language used in your
1205
- # specs, but does not add any additional documentation. We use this
1206
- # in RSpec to define `it_should_behave_like` (for backward
1207
- # compatibility), but we also add docs for that method.
1208
- def alias_it_behaves_like_to(new_name, report_label='')
1209
- RSpec::Core::ExampleGroup.define_nested_shared_group_method(new_name, report_label)
1210
- end
1211
- alias_method :alias_it_should_behave_like_to, :alias_it_behaves_like_to
1212
-
1213
- # Adds key/value pairs to the `inclusion_filter`. If `args`
1214
- # includes any symbols that are not part of the hash, each symbol
1215
- # is treated as a key in the hash with the value `true`.
1216
- #
1217
- # ### Note
1218
- #
1219
- # Filters set using this method can be overridden from the command line
1220
- # or config files (e.g. `.rspec`).
1221
- #
1222
- # @example
1223
- # # Given this declaration.
1224
- # describe "something", :foo => 'bar' do
1225
- # # ...
1226
- # end
1227
- #
1228
- # # Any of the following will include that group.
1229
- # config.filter_run_including :foo => 'bar'
1230
- # config.filter_run_including :foo => /^ba/
1231
- # config.filter_run_including :foo => lambda {|v| v == 'bar'}
1232
- # config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
1233
- #
1234
- # # Given a proc with an arity of 1, the lambda is passed the value
1235
- # # related to the key, e.g.
1236
- # config.filter_run_including :foo => lambda {|v| v == 'bar'}
1237
- #
1238
- # # Given a proc with an arity of 2, the lambda is passed the value
1239
- # # related to the key, and the metadata itself e.g.
1240
- # config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
1241
- #
1242
- # filter_run_including :foo # same as filter_run_including :foo => true
1243
- def filter_run_including(*args)
1244
- meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
1245
- filter_manager.include_with_low_priority meta
1246
- static_config_filter_manager.include_with_low_priority Metadata.deep_hash_dup(meta)
1247
- end
1248
- alias_method :filter_run, :filter_run_including
1249
-
1250
- # Applies the provided filter only if any of examples match, in constrast
1251
- # to {#filter_run}, which always applies even if no examples match, in
1252
- # which case no examples will be run. This allows you to leave configured
1253
- # filters in place that are intended only for temporary use. The most common
1254
- # example is focus filtering: `config.filter_run_when_matching :focus`.
1255
- # With that configured, you can temporarily focus an example or group
1256
- # by tagging it with `:focus` metadata, or prefixing it with an `f`
1257
- # (as in `fdescribe`, `fcontext` and `fit`) since those are aliases for
1258
- # `describe`/`context`/`it` with `:focus` metadata.
1259
- def filter_run_when_matching(*args)
1260
- when_first_matching_example_defined(*args) do
1261
- filter_run(*args)
1262
- end
1263
- end
1264
-
1265
- # Clears and reassigns the `inclusion_filter`. Set to `nil` if you don't
1266
- # want any inclusion filter at all.
1267
- #
1268
- # ### Warning
1269
- #
1270
- # This overrides any inclusion filters/tags set on the command line or in
1271
- # configuration files.
1272
- def inclusion_filter=(filter)
1273
- meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
1274
- filter_manager.include_only meta
1275
- end
1276
-
1277
- alias_method :filter=, :inclusion_filter=
1278
-
1279
- # Returns the `inclusion_filter`. If none has been set, returns an empty
1280
- # hash.
1281
- def inclusion_filter
1282
- filter_manager.inclusions
1283
- end
1284
-
1285
- alias_method :filter, :inclusion_filter
1286
-
1287
- # Adds key/value pairs to the `exclusion_filter`. If `args`
1288
- # includes any symbols that are not part of the hash, each symbol
1289
- # is treated as a key in the hash with the value `true`.
1290
- #
1291
- # ### Note
1292
- #
1293
- # Filters set using this method can be overridden from the command line
1294
- # or config files (e.g. `.rspec`).
1295
- #
1296
- # @example
1297
- # # Given this declaration.
1298
- # describe "something", :foo => 'bar' do
1299
- # # ...
1300
- # end
1301
- #
1302
- # # Any of the following will exclude that group.
1303
- # config.filter_run_excluding :foo => 'bar'
1304
- # config.filter_run_excluding :foo => /^ba/
1305
- # config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
1306
- # config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
1307
- #
1308
- # # Given a proc with an arity of 1, the lambda is passed the value
1309
- # # related to the key, e.g.
1310
- # config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
1311
- #
1312
- # # Given a proc with an arity of 2, the lambda is passed the value
1313
- # # related to the key, and the metadata itself e.g.
1314
- # config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
1315
- #
1316
- # filter_run_excluding :foo # same as filter_run_excluding :foo => true
1317
- def filter_run_excluding(*args)
1318
- meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
1319
- filter_manager.exclude_with_low_priority meta
1320
- static_config_filter_manager.exclude_with_low_priority Metadata.deep_hash_dup(meta)
1321
- end
1322
-
1323
- # Clears and reassigns the `exclusion_filter`. Set to `nil` if you don't
1324
- # want any exclusion filter at all.
1325
- #
1326
- # ### Warning
1327
- #
1328
- # This overrides any exclusion filters/tags set on the command line or in
1329
- # configuration files.
1330
- def exclusion_filter=(filter)
1331
- meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
1332
- filter_manager.exclude_only meta
1333
- end
1334
-
1335
- # Returns the `exclusion_filter`. If none has been set, returns an empty
1336
- # hash.
1337
- def exclusion_filter
1338
- filter_manager.exclusions
1339
- end
1340
-
1341
- # Tells RSpec to include `mod` in example groups. Methods defined in
1342
- # `mod` are exposed to examples (not example groups). Use `filters` to
1343
- # constrain the groups or examples in which to include the module.
1344
- #
1345
- # @example
1346
- #
1347
- # module AuthenticationHelpers
1348
- # def login_as(user)
1349
- # # ...
1350
- # end
1351
- # end
1352
- #
1353
- # module PreferencesHelpers
1354
- # def preferences(user, preferences = {})
1355
- # # ...
1356
- # end
1357
- # end
1358
- #
1359
- # module UserHelpers
1360
- # def users(username)
1361
- # # ...
1362
- # end
1363
- # end
1364
- #
1365
- # RSpec.configure do |config|
1366
- # config.include(UserHelpers) # included in all groups
1367
- #
1368
- # # included in examples with `:preferences` metadata
1369
- # config.include(PreferenceHelpers, :preferences)
1370
- #
1371
- # # included in examples with `:type => :request` metadata
1372
- # config.include(AuthenticationHelpers, :type => :request)
1373
- # end
1374
- #
1375
- # describe "edit profile", :preferences, :type => :request do
1376
- # it "can be viewed by owning user" do
1377
- # login_as preferences(users(:jdoe), :lang => 'es')
1378
- # get "/profiles/jdoe"
1379
- # assert_select ".username", :text => 'jdoe'
1380
- # end
1381
- # end
1382
- #
1383
- # @note Filtered module inclusions can also be applied to
1384
- # individual examples that have matching metadata. Just like
1385
- # Ruby's object model is that every object has a singleton class
1386
- # which has only a single instance, RSpec's model is that every
1387
- # example has a singleton example group containing just the one
1388
- # example.
1389
- #
1390
- # @see #include_context
1391
- # @see #extend
1392
- # @see #prepend
1393
- def include(mod, *filters)
1394
- define_mixed_in_module(mod, filters, @include_modules, :include) do |group|
1395
- safe_include(mod, group)
1396
- end
1397
- end
1398
-
1399
- # Tells RSpec to include the named shared example group in example groups.
1400
- # Use `filters` to constrain the groups or examples in which to include
1401
- # the example group.
1402
- #
1403
- # @example
1404
- #
1405
- # RSpec.shared_context "example admin user" do
1406
- # let(:admin_user) { create_user(:admin) }
1407
- # end
1408
- #
1409
- # RSpec.shared_context "example guest user" do
1410
- # let(:guest_user) { create_user(:guest) }
1411
- # end
1412
- #
1413
- # RSpec.configure do |config|
1414
- # config.include_context "example guest user", :type => :request
1415
- # config.include_context "example admin user", :admin, :type => :request
1416
- # end
1417
- #
1418
- # RSpec.describe "The admin page", :type => :request do
1419
- # it "can be viewed by admins", :admin do
1420
- # login_with admin_user
1421
- # get "/admin"
1422
- # expect(response).to be_ok
1423
- # end
1424
- #
1425
- # it "cannot be viewed by guests" do
1426
- # login_with guest_user
1427
- # get "/admin"
1428
- # expect(response).to be_forbidden
1429
- # end
1430
- # end
1431
- #
1432
- # @note Filtered context inclusions can also be applied to
1433
- # individual examples that have matching metadata. Just like
1434
- # Ruby's object model is that every object has a singleton class
1435
- # which has only a single instance, RSpec's model is that every
1436
- # example has a singleton example group containing just the one
1437
- # example.
1438
- #
1439
- # @see #include
1440
- def include_context(shared_group_name, *filters)
1441
- shared_module = world.shared_example_group_registry.find([:main], shared_group_name)
1442
- include shared_module, *filters
1443
- end
1444
-
1445
- # Tells RSpec to extend example groups with `mod`. Methods defined in
1446
- # `mod` are exposed to example groups (not examples). Use `filters` to
1447
- # constrain the groups to extend.
1448
- #
1449
- # Similar to `include`, but behavior is added to example groups, which
1450
- # are classes, rather than the examples, which are instances of those
1451
- # classes.
1452
- #
1453
- # @example
1454
- #
1455
- # module UiHelpers
1456
- # def run_in_browser
1457
- # # ...
1458
- # end
1459
- # end
1460
- #
1461
- # module PermissionHelpers
1462
- # def define_permissions
1463
- # # ...
1464
- # end
1465
- # end
1466
- #
1467
- # RSpec.configure do |config|
1468
- # config.extend(UiHelpers, :type => :request)
1469
- # config.extend(PermissionHelpers, :with_permissions, :type => :request)
1470
- # end
1471
- #
1472
- # describe "edit profile", :with_permissions, :type => :request do
1473
- # run_in_browser
1474
- # define_permissions
1475
- #
1476
- # it "does stuff in the client" do
1477
- # # ...
1478
- # end
1479
- # end
1480
- #
1481
- # @see #include
1482
- # @see #prepend
1483
- def extend(mod, *filters)
1484
- define_mixed_in_module(mod, filters, @extend_modules, :extend) do |group|
1485
- safe_extend(mod, group)
1486
- end
1487
- end
1488
-
1489
- if RSpec::Support::RubyFeatures.module_prepends_supported?
1490
- # Tells RSpec to prepend example groups with `mod`. Methods defined in
1491
- # `mod` are exposed to examples (not example groups). Use `filters` to
1492
- # constrain the groups in which to prepend the module.
1493
- #
1494
- # Similar to `include`, but module is included before the example group's class
1495
- # in the ancestor chain.
1496
- #
1497
- # @example
1498
- #
1499
- # module OverrideMod
1500
- # def override_me
1501
- # "overridden"
1502
- # end
1503
- # end
1504
- #
1505
- # RSpec.configure do |config|
1506
- # config.prepend(OverrideMod, :method => :prepend)
1507
- # end
1508
- #
1509
- # describe "overriding example's class", :method => :prepend do
1510
- # it "finds the user" do
1511
- # self.class.class_eval do
1512
- # def override_me
1513
- # end
1514
- # end
1515
- # override_me # => "overridden"
1516
- # # ...
1517
- # end
1518
- # end
1519
- #
1520
- # @see #include
1521
- # @see #extend
1522
- def prepend(mod, *filters)
1523
- define_mixed_in_module(mod, filters, @prepend_modules, :prepend) do |group|
1524
- safe_prepend(mod, group)
1525
- end
1526
- end
1527
- end
1528
-
1529
- # @private
1530
- #
1531
- # Used internally to extend a group with modules using `include`, `prepend` and/or
1532
- # `extend`.
1533
- def configure_group(group)
1534
- group.hooks.register_globals(group, hooks)
1535
-
1536
- configure_group_with group, @include_modules, :safe_include
1537
- configure_group_with group, @extend_modules, :safe_extend
1538
- configure_group_with group, @prepend_modules, :safe_prepend
1539
- end
1540
-
1541
- # @private
1542
- #
1543
- # Used internally to extend the singleton class of a single example's
1544
- # example group instance with modules using `include` and/or `extend`.
1545
- def configure_example(example, example_hooks)
1546
- example_hooks.register_global_singleton_context_hooks(example, hooks)
1547
- singleton_group = example.example_group_instance.singleton_class
1548
-
1549
- # We replace the metadata so that SharedExampleGroupModule#included
1550
- # has access to the example's metadata[:location].
1551
- singleton_group.with_replaced_metadata(example.metadata) do
1552
- modules = @include_modules.items_for(example.metadata)
1553
- modules.each do |mod|
1554
- safe_include(mod, example.example_group_instance.singleton_class)
1555
- end
1556
-
1557
- MemoizedHelpers.define_helpers_on(singleton_group) unless modules.empty?
1558
- end
1559
- end
1560
-
1561
- # @private
1562
- def requires=(paths)
1563
- directories = ['lib', default_path].select { |p| File.directory? p }
1564
- RSpec::Core::RubyProject.add_to_load_path(*directories)
1565
- paths.each { |path| load_file_handling_errors(:require, path) }
1566
- @requires += paths
1567
- end
1568
-
1569
- # @private
1570
- def in_project_source_dir_regex
1571
- regexes = project_source_dirs.map do |dir|
1572
- /\A#{Regexp.escape(File.expand_path(dir))}\//
1573
- end
1574
-
1575
- Regexp.union(regexes)
1576
- end
1577
-
1578
- # @private
1579
- def configure_mock_framework
1580
- RSpec::Core::ExampleGroup.__send__(:include, mock_framework)
1581
- conditionally_disable_mocks_monkey_patching
1582
- end
1583
-
1584
- # @private
1585
- def configure_expectation_framework
1586
- expectation_frameworks.each do |framework|
1587
- RSpec::Core::ExampleGroup.__send__(:include, framework)
1588
- end
1589
- conditionally_disable_expectations_monkey_patching
1590
- end
1591
-
1592
- # @private
1593
- def load_spec_files
1594
- # Note which spec files world is already aware of.
1595
- # This is generally only needed for when the user runs
1596
- # `ruby path/to/spec.rb` (and loads `rspec/autorun`) --
1597
- # in that case, the spec file was loaded by `ruby` and
1598
- # isn't loaded by us here so we only know about it because
1599
- # of an example group being registered in it.
1600
- world.registered_example_group_files.each do |f|
1601
- loaded_spec_files << f # the registered files are already expended absolute paths
1602
- end
1603
-
1604
- files_to_run.uniq.each do |f|
1605
- file = File.expand_path(f)
1606
- load_file_handling_errors(:load, file)
1607
- loaded_spec_files << file
1608
- end
1609
-
1610
- @spec_files_loaded = true
1611
- end
1612
-
1613
- # @private
1614
- DEFAULT_FORMATTER = lambda { |string| string }
1615
-
1616
- # Formats the docstring output using the block provided.
1617
- #
1618
- # @example
1619
- # # This will strip the descriptions of both examples and example
1620
- # # groups.
1621
- # RSpec.configure do |config|
1622
- # config.format_docstrings { |s| s.strip }
1623
- # end
1624
- def format_docstrings(&block)
1625
- @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
1626
- end
1627
-
1628
- # @private
1629
- def format_docstrings_block
1630
- @format_docstrings_block ||= DEFAULT_FORMATTER
1631
- end
1632
-
1633
- # @private
1634
- def self.delegate_to_ordering_manager(*methods)
1635
- methods.each do |method|
1636
- define_method method do |*args, &block|
1637
- ordering_manager.__send__(method, *args, &block)
1638
- end
1639
- end
1640
- end
1641
-
1642
- # @!method seed=(value)
1643
- #
1644
- # Sets the seed value and sets the default global ordering to random.
1645
- delegate_to_ordering_manager :seed=
1646
-
1647
- # @!method seed
1648
- # Seed for random ordering (default: generated randomly each run).
1649
- #
1650
- # When you run specs with `--order random`, RSpec generates a random seed
1651
- # for the randomization and prints it to the `output_stream` (assuming
1652
- # you're using RSpec's built-in formatters). If you discover an ordering
1653
- # dependency (i.e. examples fail intermittently depending on order), set
1654
- # this (on Configuration or on the command line with `--seed`) to run
1655
- # using the same seed while you debug the issue.
1656
- #
1657
- # We recommend, actually, that you use the command line approach so you
1658
- # don't accidentally leave the seed encoded.
1659
- delegate_to_ordering_manager :seed
1660
-
1661
- # @!method order=(value)
1662
- #
1663
- # Sets the default global ordering strategy. By default this can be one
1664
- # of `:defined`, `:random`, but is customizable through the
1665
- # `register_ordering` API. If order is set to `'rand:<seed>'`,
1666
- # the seed will also be set.
1667
- #
1668
- # @see #register_ordering
1669
- delegate_to_ordering_manager :order=
1670
-
1671
- # @!method register_ordering(name)
1672
- #
1673
- # Registers a named ordering strategy that can later be
1674
- # used to order an example group's subgroups by adding
1675
- # `:order => <name>` metadata to the example group.
1676
- #
1677
- # @param name [Symbol] The name of the ordering.
1678
- # @yield Block that will order the given examples or example groups
1679
- # @yieldparam list [Array<RSpec::Core::Example>,
1680
- # Array<RSpec::Core::ExampleGroup>] The examples or groups to order
1681
- # @yieldreturn [Array<RSpec::Core::Example>,
1682
- # Array<RSpec::Core::ExampleGroup>] The re-ordered examples or groups
1683
- #
1684
- # @example
1685
- # RSpec.configure do |rspec|
1686
- # rspec.register_ordering :reverse do |list|
1687
- # list.reverse
1688
- # end
1689
- # end
1690
- #
1691
- # RSpec.describe 'MyClass', :order => :reverse do
1692
- # # ...
1693
- # end
1694
- #
1695
- # @note Pass the symbol `:global` to set the ordering strategy that
1696
- # will be used to order the top-level example groups and any example
1697
- # groups that do not have declared `:order` metadata.
1698
- #
1699
- # @example
1700
- # RSpec.configure do |rspec|
1701
- # rspec.register_ordering :global do |examples|
1702
- # acceptance, other = examples.partition do |example|
1703
- # example.metadata[:type] == :acceptance
1704
- # end
1705
- # other + acceptance
1706
- # end
1707
- # end
1708
- #
1709
- # RSpec.describe 'MyClass', :type => :acceptance do
1710
- # # will run last
1711
- # end
1712
- #
1713
- # RSpec.describe 'MyClass' do
1714
- # # will run first
1715
- # end
1716
- #
1717
- delegate_to_ordering_manager :register_ordering
1718
-
1719
- # @private
1720
- delegate_to_ordering_manager :seed_used?, :ordering_registry
1721
-
1722
- # Set Ruby warnings on or off.
1723
- def warnings=(value)
1724
- $VERBOSE = !!value
1725
- end
1726
-
1727
- # @return [Boolean] Whether or not ruby warnings are enabled.
1728
- def warnings?
1729
- $VERBOSE
1730
- end
1731
-
1732
- # @private
1733
- RAISE_ERROR_WARNING_NOTIFIER = lambda { |message| raise message }
1734
-
1735
- # Turns warnings into errors. This can be useful when
1736
- # you want RSpec to run in a 'strict' no warning situation.
1737
- #
1738
- # @example
1739
- #
1740
- # RSpec.configure do |rspec|
1741
- # rspec.raise_on_warning = true
1742
- # end
1743
- def raise_on_warning=(value)
1744
- if value
1745
- RSpec::Support.warning_notifier = RAISE_ERROR_WARNING_NOTIFIER
1746
- else
1747
- RSpec::Support.warning_notifier = RSpec::Support::DEFAULT_WARNING_NOTIFIER
1748
- end
1749
- end
1750
-
1751
- # Exposes the current running example via the named
1752
- # helper method. RSpec 2.x exposed this via `example`,
1753
- # but in RSpec 3.0, the example is instead exposed via
1754
- # an arg yielded to `it`, `before`, `let`, etc. However,
1755
- # some extension gems (such as Capybara) depend on the
1756
- # RSpec 2.x's `example` method, so this config option
1757
- # can be used to maintain compatibility.
1758
- #
1759
- # @param method_name [Symbol] the name of the helper method
1760
- #
1761
- # @example
1762
- #
1763
- # RSpec.configure do |rspec|
1764
- # rspec.expose_current_running_example_as :example
1765
- # end
1766
- #
1767
- # RSpec.describe MyClass do
1768
- # before do
1769
- # # `example` can be used here because of the above config.
1770
- # do_something if example.metadata[:type] == "foo"
1771
- # end
1772
- # end
1773
- def expose_current_running_example_as(method_name)
1774
- ExposeCurrentExample.module_exec do
1775
- extend RSpec::SharedContext
1776
- let(method_name) { |ex| ex }
1777
- end
1778
-
1779
- include ExposeCurrentExample
1780
- end
1781
-
1782
- # @private
1783
- module ExposeCurrentExample; end
1784
-
1785
- # Turns deprecation warnings into errors, in order to surface
1786
- # the full backtrace of the call site. This can be useful when
1787
- # you need more context to address a deprecation than the
1788
- # single-line call site normally provided.
1789
- #
1790
- # @example
1791
- #
1792
- # RSpec.configure do |rspec|
1793
- # rspec.raise_errors_for_deprecations!
1794
- # end
1795
- def raise_errors_for_deprecations!
1796
- self.deprecation_stream = Formatters::DeprecationFormatter::RaiseErrorStream.new
1797
- end
1798
-
1799
- # Enables zero monkey patching mode for RSpec. It removes monkey
1800
- # patching of the top-level DSL methods (`describe`,
1801
- # `shared_examples_for`, etc) onto `main` and `Module`, instead
1802
- # requiring you to prefix these methods with `RSpec.`. It enables
1803
- # expect-only syntax for rspec-mocks and rspec-expectations. It
1804
- # simply disables monkey patching on whatever pieces of RSpec
1805
- # the user is using.
1806
- #
1807
- # @note It configures rspec-mocks and rspec-expectations only
1808
- # if the user is using those (either explicitly or implicitly
1809
- # by not setting `mock_with` or `expect_with` to anything else).
1810
- #
1811
- # @note If the user uses this options with `mock_with :mocha`
1812
- # (or similiar) they will still have monkey patching active
1813
- # in their test environment from mocha.
1814
- #
1815
- # @example
1816
- #
1817
- # # It disables all monkey patching.
1818
- # RSpec.configure do |config|
1819
- # config.disable_monkey_patching!
1820
- # end
1821
- #
1822
- # # Is an equivalent to
1823
- # RSpec.configure do |config|
1824
- # config.expose_dsl_globally = false
1825
- #
1826
- # config.mock_with :rspec do |mocks|
1827
- # mocks.syntax = :expect
1828
- # mocks.patch_marshal_to_support_partial_doubles = false
1829
- # end
1830
- #
1831
- # config.expect_with :rspec do |expectations|
1832
- # expectations.syntax = :expect
1833
- # end
1834
- # end
1835
- def disable_monkey_patching!
1836
- self.expose_dsl_globally = false
1837
- self.disable_monkey_patching = true
1838
- conditionally_disable_mocks_monkey_patching
1839
- conditionally_disable_expectations_monkey_patching
1840
- end
1841
-
1842
- # @private
1843
- attr_accessor :disable_monkey_patching
1844
-
1845
- # Defines a callback that can assign derived metadata values.
1846
- #
1847
- # @param filters [Array<Symbol>, Hash] metadata filters that determine
1848
- # which example or group metadata hashes the callback will be triggered
1849
- # for. If none are given, the callback will be run against the metadata
1850
- # hashes of all groups and examples.
1851
- # @yieldparam metadata [Hash] original metadata hash from an example or
1852
- # group. Mutate this in your block as needed.
1853
- #
1854
- # @example
1855
- # RSpec.configure do |config|
1856
- # # Tag all groups and examples in the spec/unit directory with
1857
- # # :type => :unit
1858
- # config.define_derived_metadata(:file_path => %r{/spec/unit/}) do |metadata|
1859
- # metadata[:type] = :unit
1860
- # end
1861
- # end
1862
- def define_derived_metadata(*filters, &block)
1863
- meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1864
- @derived_metadata_blocks.append(block, meta)
1865
- end
1866
-
1867
- # Defines a callback that runs after the first example with matching
1868
- # metadata is defined. If no examples are defined with matching metadata,
1869
- # it will not get called at all.
1870
- #
1871
- # This can be used to ensure some setup is performed (such as bootstrapping
1872
- # a DB or loading a specific file that adds significantly to the boot time)
1873
- # if needed (as indicated by the presence of an example with matching metadata)
1874
- # but avoided otherwise.
1875
- #
1876
- # @example
1877
- # RSpec.configure do |config|
1878
- # config.when_first_matching_example_defined(:db) do
1879
- # # Load a support file that does some heavyweight setup,
1880
- # # including bootstrapping the DB, but only if we have loaded
1881
- # # any examples tagged with `:db`.
1882
- # require 'support/db'
1883
- # end
1884
- # end
1885
- def when_first_matching_example_defined(*filters)
1886
- specified_meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1887
-
1888
- callback = lambda do |example_or_group_meta|
1889
- # Example groups do not have `:example_group` metadata
1890
- # (instead they have `:parent_example_group` metadata).
1891
- return unless example_or_group_meta.key?(:example_group)
1892
-
1893
- # Ensure the callback only fires once.
1894
- @derived_metadata_blocks.delete(callback, specified_meta)
1895
-
1896
- yield
1897
- end
1898
-
1899
- @derived_metadata_blocks.append(callback, specified_meta)
1900
- end
1901
-
1902
- # @private
1903
- def apply_derived_metadata_to(metadata)
1904
- already_run_blocks = Set.new
1905
-
1906
- # We loop and attempt to re-apply metadata blocks to support cascades
1907
- # (e.g. where a derived bit of metadata triggers the application of
1908
- # another piece of derived metadata, etc)
1909
- #
1910
- # We limit our looping to 200 times as a way to detect infinitely recursing derived metadata blocks.
1911
- # It's hard to imagine a valid use case for a derived metadata cascade greater than 200 iterations.
1912
- 200.times do
1913
- return if @derived_metadata_blocks.items_for(metadata).all? do |block|
1914
- already_run_blocks.include?(block).tap do |skip_block|
1915
- block.call(metadata) unless skip_block
1916
- already_run_blocks << block
1917
- end
1918
- end
1919
- end
1920
-
1921
- # If we got here, then `@derived_metadata_blocks.items_for(metadata).all?` never returned
1922
- # `true` above and we treat this as an attempt to recurse infinitely. It's better to fail
1923
- # with a clear # error than hang indefinitely, which is what would happen if we didn't limit
1924
- # the looping above.
1925
- raise SystemStackError, "Attempted to recursively derive metadata indefinitely."
1926
- end
1927
-
1928
- # Defines a `before` hook. See {Hooks#before} for full docs.
1929
- #
1930
- # This method differs from {Hooks#before} in only one way: it supports
1931
- # the `:suite` scope. Hooks with the `:suite` scope will be run once before
1932
- # the first example of the entire suite is executed. Conditions passed along
1933
- # with `:suite` are effectively ignored.
1934
- #
1935
- # @see #prepend_before
1936
- # @see #after
1937
- # @see #append_after
1938
- def before(scope=nil, *meta, &block)
1939
- handle_suite_hook(scope, meta) do
1940
- @before_suite_hooks << Hooks::BeforeHook.new(block, {})
1941
- end || begin
1942
- # defeat Ruby 2.5 lazy proc allocation to ensure
1943
- # the methods below are passed the same proc instances
1944
- # so `Hook` equality is preserved. For more info, see:
1945
- # https://bugs.ruby-lang.org/issues/14045#note-5
1946
- block.__id__
1947
-
1948
- add_hook_to_existing_matching_groups(meta, scope) { |g| g.before(scope, *meta, &block) }
1949
- super(scope, *meta, &block)
1950
- end
1951
- end
1952
- alias_method :append_before, :before
1953
-
1954
- # Adds `block` to the start of the list of `before` blocks in the same
1955
- # scope (`:example`, `:context`, or `:suite`), in contrast to {#before},
1956
- # which adds the hook to the end of the list.
1957
- #
1958
- # See {Hooks#before} for full `before` hook docs.
1959
- #
1960
- # This method differs from {Hooks#prepend_before} in only one way: it supports
1961
- # the `:suite` scope. Hooks with the `:suite` scope will be run once before
1962
- # the first example of the entire suite is executed. Conditions passed along
1963
- # with `:suite` are effectively ignored.
1964
- #
1965
- # @see #before
1966
- # @see #after
1967
- # @see #append_after
1968
- def prepend_before(scope=nil, *meta, &block)
1969
- handle_suite_hook(scope, meta) do
1970
- @before_suite_hooks.unshift Hooks::BeforeHook.new(block, {})
1971
- end || begin
1972
- # defeat Ruby 2.5 lazy proc allocation to ensure
1973
- # the methods below are passed the same proc instances
1974
- # so `Hook` equality is preserved. For more info, see:
1975
- # https://bugs.ruby-lang.org/issues/14045#note-5
1976
- block.__id__
1977
-
1978
- add_hook_to_existing_matching_groups(meta, scope) { |g| g.prepend_before(scope, *meta, &block) }
1979
- super(scope, *meta, &block)
1980
- end
1981
- end
1982
-
1983
- # Defines a `after` hook. See {Hooks#after} for full docs.
1984
- #
1985
- # This method differs from {Hooks#after} in only one way: it supports
1986
- # the `:suite` scope. Hooks with the `:suite` scope will be run once after
1987
- # the last example of the entire suite is executed. Conditions passed along
1988
- # with `:suite` are effectively ignored.
1989
- #
1990
- # @see #append_after
1991
- # @see #before
1992
- # @see #prepend_before
1993
- def after(scope=nil, *meta, &block)
1994
- handle_suite_hook(scope, meta) do
1995
- @after_suite_hooks.unshift Hooks::AfterHook.new(block, {})
1996
- end || begin
1997
- # defeat Ruby 2.5 lazy proc allocation to ensure
1998
- # the methods below are passed the same proc instances
1999
- # so `Hook` equality is preserved. For more info, see:
2000
- # https://bugs.ruby-lang.org/issues/14045#note-5
2001
- block.__id__
2002
-
2003
- add_hook_to_existing_matching_groups(meta, scope) { |g| g.after(scope, *meta, &block) }
2004
- super(scope, *meta, &block)
2005
- end
2006
- end
2007
- alias_method :prepend_after, :after
2008
-
2009
- # Adds `block` to the end of the list of `after` blocks in the same
2010
- # scope (`:example`, `:context`, or `:suite`), in contrast to {#after},
2011
- # which adds the hook to the start of the list.
2012
- #
2013
- # See {Hooks#after} for full `after` hook docs.
2014
- #
2015
- # This method differs from {Hooks#append_after} in only one way: it supports
2016
- # the `:suite` scope. Hooks with the `:suite` scope will be run once after
2017
- # the last example of the entire suite is executed. Conditions passed along
2018
- # with `:suite` are effectively ignored.
2019
- #
2020
- # @see #append_after
2021
- # @see #before
2022
- # @see #prepend_before
2023
- def append_after(scope=nil, *meta, &block)
2024
- handle_suite_hook(scope, meta) do
2025
- @after_suite_hooks << Hooks::AfterHook.new(block, {})
2026
- end || begin
2027
- # defeat Ruby 2.5 lazy proc allocation to ensure
2028
- # the methods below are passed the same proc instances
2029
- # so `Hook` equality is preserved. For more info, see:
2030
- # https://bugs.ruby-lang.org/issues/14045#note-5
2031
- block.__id__
2032
-
2033
- add_hook_to_existing_matching_groups(meta, scope) { |g| g.append_after(scope, *meta, &block) }
2034
- super(scope, *meta, &block)
2035
- end
2036
- end
2037
-
2038
- # Registers `block` as an `around` hook.
2039
- #
2040
- # See {Hooks#around} for full `around` hook docs.
2041
- def around(scope=nil, *meta, &block)
2042
- # defeat Ruby 2.5 lazy proc allocation to ensure
2043
- # the methods below are passed the same proc instances
2044
- # so `Hook` equality is preserved. For more info, see:
2045
- # https://bugs.ruby-lang.org/issues/14045#note-5
2046
- block.__id__
2047
-
2048
- add_hook_to_existing_matching_groups(meta, scope) { |g| g.around(scope, *meta, &block) }
2049
- super(scope, *meta, &block)
2050
- end
2051
-
2052
- # @private
2053
- def with_suite_hooks
2054
- return yield if dry_run?
2055
-
2056
- begin
2057
- run_suite_hooks("a `before(:suite)` hook", @before_suite_hooks)
2058
- yield
2059
- ensure
2060
- run_suite_hooks("an `after(:suite)` hook", @after_suite_hooks)
2061
- end
2062
- end
2063
-
2064
- # @private
2065
- # Holds the various registered hooks. Here we use a FilterableItemRepository
2066
- # implementation that is specifically optimized for the read/write patterns
2067
- # of the config object.
2068
- def hooks
2069
- @hooks ||= HookCollections.new(self, FilterableItemRepository::QueryOptimized)
2070
- end
2071
-
2072
- # Invokes block before defining an example group
2073
- def on_example_group_definition(&block)
2074
- on_example_group_definition_callbacks << block
2075
- end
2076
-
2077
- # @api private
2078
- # Returns an array of blocks to call before defining an example group
2079
- def on_example_group_definition_callbacks
2080
- @on_example_group_definition_callbacks ||= []
2081
- end
2082
-
2083
- # @private
2084
- def bisect_runner_class
2085
- @bisect_runner_class ||= begin
2086
- case bisect_runner
2087
- when :fork
2088
- RSpec::Support.require_rspec_core 'bisect/fork_runner'
2089
- Bisect::ForkRunner
2090
- when :shell
2091
- RSpec::Support.require_rspec_core 'bisect/shell_runner'
2092
- Bisect::ShellRunner
2093
- else
2094
- raise "Unsupported value for `bisect_runner` (#{bisect_runner.inspect}). " \
2095
- "Only `:fork` and `:shell` are supported."
2096
- end
2097
- end
2098
- end
2099
-
2100
- private
2101
-
2102
- def load_file_handling_errors(method, file)
2103
- __send__(method, file)
2104
- rescue LoadError => ex
2105
- relative_file = Metadata.relative_path(file)
2106
- suggestions = DidYouMean.new(relative_file).call
2107
- reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.#{suggestions}")
2108
- RSpec.world.wants_to_quit = true
2109
- rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
2110
- relative_file = Metadata.relative_path(file)
2111
- reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.")
2112
- RSpec.world.wants_to_quit = true
2113
- end
2114
-
2115
- def handle_suite_hook(scope, meta)
2116
- return nil unless scope == :suite
2117
-
2118
- unless meta.empty?
2119
- # TODO: in RSpec 4, consider raising an error here.
2120
- # We warn only for backwards compatibility.
2121
- RSpec.warn_with "WARNING: `:suite` hooks do not support metadata since " \
2122
- "they apply to the suite as a whole rather than " \
2123
- "any individual example or example group that has metadata. " \
2124
- "The metadata you have provided (#{meta.inspect}) will be ignored."
2125
- end
2126
-
2127
- yield
2128
- end
2129
-
2130
- def run_suite_hooks(hook_description, hooks)
2131
- context = SuiteHookContext.new(hook_description, reporter)
2132
-
2133
- hooks.each do |hook|
2134
- begin
2135
- hook.run(context)
2136
- rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
2137
- context.set_exception(ex)
2138
-
2139
- # Do not run subsequent `before` hooks if one fails.
2140
- # But for `after` hooks, we run them all so that all
2141
- # cleanup bits get a chance to complete, minimizing the
2142
- # chance that resources get left behind.
2143
- break if hooks.equal?(@before_suite_hooks)
2144
- end
2145
- end
2146
- end
2147
-
2148
- def get_files_to_run(paths)
2149
- files = FlatMap.flat_map(paths_to_check(paths)) do |path|
2150
- path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
2151
- File.directory?(path) ? gather_directories(path) : extract_location(path)
2152
- end.uniq
2153
-
2154
- return files unless only_failures?
2155
- relative_files = files.map { |f| Metadata.relative_path(File.expand_path f) }
2156
- intersection = (relative_files & spec_files_with_failures.to_a)
2157
- intersection.empty? ? files : intersection
2158
- end
2159
-
2160
- def paths_to_check(paths)
2161
- return paths if pattern_might_load_specs_from_vendored_dirs?
2162
- paths + [Dir.getwd]
2163
- end
2164
-
2165
- def pattern_might_load_specs_from_vendored_dirs?
2166
- pattern.split(File::SEPARATOR).first.include?('**')
2167
- end
2168
-
2169
- def gather_directories(path)
2170
- include_files = get_matching_files(path, pattern)
2171
- exclude_files = get_matching_files(path, exclude_pattern)
2172
- (include_files - exclude_files).uniq
2173
- end
2174
-
2175
- def get_matching_files(path, pattern)
2176
- raw_files = Dir[file_glob_from(path, pattern)]
2177
- raw_files.map { |file| File.expand_path(file) }.sort
2178
- end
2179
-
2180
- def file_glob_from(path, pattern)
2181
- stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}"
2182
- return stripped if pattern =~ /^(\.\/)?#{Regexp.escape path}/ || absolute_pattern?(pattern)
2183
- File.join(path, stripped)
2184
- end
2185
-
2186
- if RSpec::Support::OS.windows?
2187
- # :nocov:
2188
- def absolute_pattern?(pattern)
2189
- pattern =~ /\A[A-Z]:\\/ || windows_absolute_network_path?(pattern)
2190
- end
2191
-
2192
- def windows_absolute_network_path?(pattern)
2193
- return false unless ::File::ALT_SEPARATOR
2194
- pattern.start_with?(::File::ALT_SEPARATOR + ::File::ALT_SEPARATOR)
2195
- end
2196
- # :nocov:
2197
- else
2198
- def absolute_pattern?(pattern)
2199
- pattern.start_with?(File::Separator)
2200
- end
2201
- end
2202
-
2203
- def extract_location(path)
2204
- match = /^(.*?)((?:\:\d+)+)$/.match(path)
2205
-
2206
- if match
2207
- captures = match.captures
2208
- path = captures[0]
2209
- lines = captures[1][1..-1].split(":").map(&:to_i)
2210
- filter_manager.add_location path, lines
2211
- else
2212
- path, scoped_ids = Example.parse_id(path)
2213
- filter_manager.add_ids(path, scoped_ids.split(/\s*,\s*/)) if scoped_ids
2214
- end
2215
-
2216
- return [] if path == default_path
2217
- File.expand_path(path)
2218
- end
2219
-
2220
- def command
2221
- $0.split(File::SEPARATOR).last
2222
- end
2223
-
2224
- def value_for(key)
2225
- @preferred_options.fetch(key) { yield }
2226
- end
2227
-
2228
- def define_built_in_hooks
2229
- around(:example, :aggregate_failures => true) do |procsy|
2230
- begin
2231
- aggregate_failures(nil, :hide_backtrace => true, &procsy)
2232
- rescue Support::AllExceptionsExceptOnesWeMustNotRescue => exception
2233
- procsy.example.set_aggregate_failures_exception(exception)
2234
- end
2235
- end
2236
- end
2237
-
2238
- def assert_no_example_groups_defined(config_option)
2239
- return unless world.example_groups.any?
2240
-
2241
- raise MustBeConfiguredBeforeExampleGroupsError.new(
2242
- "RSpec's #{config_option} configuration option must be configured before " \
2243
- "any example groups are defined, but you have already defined a group."
2244
- )
2245
- end
2246
-
2247
- def output_wrapper
2248
- @output_wrapper ||= OutputWrapper.new(output_stream)
2249
- end
2250
-
2251
- def output_to_tty?(output=output_stream)
2252
- output.respond_to?(:tty?) && output.tty?
2253
- end
2254
-
2255
- def conditionally_disable_mocks_monkey_patching
2256
- return unless disable_monkey_patching && rspec_mocks_loaded?
2257
-
2258
- RSpec::Mocks.configuration.tap do |config|
2259
- config.syntax = :expect
2260
- config.patch_marshal_to_support_partial_doubles = false
2261
- end
2262
- end
2263
-
2264
- def conditionally_disable_expectations_monkey_patching
2265
- return unless disable_monkey_patching && rspec_expectations_loaded?
2266
-
2267
- RSpec::Expectations.configuration.syntax = :expect
2268
- end
2269
-
2270
- def rspec_mocks_loaded?
2271
- defined?(RSpec::Mocks.configuration)
2272
- end
2273
-
2274
- def rspec_expectations_loaded?
2275
- defined?(RSpec::Expectations.configuration)
2276
- end
2277
-
2278
- def update_pattern_attr(name, value)
2279
- if @spec_files_loaded
2280
- RSpec.warning "Configuring `#{name}` to #{value} has no effect since " \
2281
- "RSpec has already loaded the spec files."
2282
- end
2283
-
2284
- instance_variable_set(:"@#{name}", value)
2285
- @files_to_run = nil
2286
- end
2287
-
2288
- def clear_values_derived_from_example_status_persistence_file_path
2289
- @last_run_statuses = nil
2290
- @spec_files_with_failures = nil
2291
- end
2292
-
2293
- def configure_group_with(group, module_list, application_method)
2294
- module_list.items_for(group.metadata).each do |mod|
2295
- __send__(application_method, mod, group)
2296
- end
2297
- end
2298
-
2299
- def add_hook_to_existing_matching_groups(meta, scope, &block)
2300
- # For example hooks, we have to apply it to each of the top level
2301
- # groups, even if the groups do not match. When we apply it, we
2302
- # apply it with the metadata, so it will only apply to examples
2303
- # in the group that match the metadata.
2304
- # #2280 for background and discussion.
2305
- if scope == :example || scope == :each || scope.nil?
2306
- world.example_groups.each(&block)
2307
- else
2308
- meta = Metadata.build_hash_from(meta.dup)
2309
- on_existing_matching_groups(meta, &block)
2310
- end
2311
- end
2312
-
2313
- def on_existing_matching_groups(meta)
2314
- world.traverse_example_group_trees_until do |group|
2315
- metadata_applies_to_group?(meta, group).tap do |applies|
2316
- yield group if applies
2317
- end
2318
- end
2319
- end
2320
-
2321
- def metadata_applies_to_group?(meta, group)
2322
- meta.empty? || MetadataFilter.apply?(:any?, meta, group.metadata)
2323
- end
2324
-
2325
- if RSpec::Support::RubyFeatures.module_prepends_supported?
2326
- def safe_prepend(mod, host)
2327
- host.__send__(:prepend, mod) unless host < mod
2328
- end
2329
- end
2330
-
2331
- if RUBY_VERSION.to_f >= 1.9
2332
- def safe_include(mod, host)
2333
- host.__send__(:include, mod) unless host < mod
2334
- end
2335
-
2336
- def safe_extend(mod, host)
2337
- host.extend(mod) unless host.singleton_class < mod
2338
- end
2339
- else # for 1.8.7
2340
- # :nocov:
2341
- def safe_include(mod, host)
2342
- host.__send__(:include, mod) unless host.included_modules.include?(mod)
2343
- end
2344
-
2345
- def safe_extend(mod, host)
2346
- host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
2347
- end
2348
- # :nocov:
2349
- end
2350
-
2351
- def define_mixed_in_module(mod, filters, mod_list, config_method, &block)
2352
- unless Module === mod
2353
- raise TypeError, "`RSpec.configuration.#{config_method}` expects a module but got: #{mod.inspect}"
2354
- end
2355
-
2356
- meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
2357
- mod_list.append(mod, meta)
2358
- on_existing_matching_groups(meta, &block)
2359
- end
2360
- end
2361
- # rubocop:enable Metrics/ClassLength
2362
- end
2363
- end