sublimetheme 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +230 -0
  9. data/Rakefile +8 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +7 -0
  12. data/lib/sublimetheme.rb +6832 -0
  13. data/lib/sublimetheme/version.rb +3 -0
  14. data/path/bin/htmldiff +25 -0
  15. data/path/bin/htmldiff.bat +6 -0
  16. data/path/bin/ldiff +25 -0
  17. data/path/bin/ldiff.bat +6 -0
  18. data/path/bin/rspec +23 -0
  19. data/path/bin/rspec.bat +6 -0
  20. data/path/cache/diff-lcs-1.2.5.gem +0 -0
  21. data/path/cache/rspec-3.3.0.gem +0 -0
  22. data/path/cache/rspec-core-3.3.2.gem +0 -0
  23. data/path/cache/rspec-expectations-3.3.1.gem +0 -0
  24. data/path/cache/rspec-mocks-3.3.2.gem +0 -0
  25. data/path/cache/rspec-support-3.3.0.gem +0 -0
  26. data/path/gems/diff-lcs-1.2.5/.autotest +3 -0
  27. data/path/gems/diff-lcs-1.2.5/.gemtest +0 -0
  28. data/path/gems/diff-lcs-1.2.5/.hoerc +2 -0
  29. data/path/gems/diff-lcs-1.2.5/.rspec +2 -0
  30. data/path/gems/diff-lcs-1.2.5/.travis.yml +22 -0
  31. data/path/gems/diff-lcs-1.2.5/Contributing.rdoc +64 -0
  32. data/path/gems/diff-lcs-1.2.5/Gemfile +20 -0
  33. data/path/gems/diff-lcs-1.2.5/History.rdoc +152 -0
  34. data/path/gems/diff-lcs-1.2.5/License.rdoc +39 -0
  35. data/path/gems/diff-lcs-1.2.5/Manifest.txt +38 -0
  36. data/path/gems/diff-lcs-1.2.5/README.rdoc +85 -0
  37. data/path/gems/diff-lcs-1.2.5/Rakefile +41 -0
  38. data/path/gems/diff-lcs-1.2.5/autotest/discover.rb +1 -0
  39. data/path/gems/diff-lcs-1.2.5/bin/htmldiff +32 -0
  40. data/path/gems/diff-lcs-1.2.5/bin/ldiff +6 -0
  41. data/path/gems/diff-lcs-1.2.5/docs/COPYING.txt +339 -0
  42. data/path/gems/diff-lcs-1.2.5/docs/artistic.txt +127 -0
  43. data/path/gems/diff-lcs-1.2.5/lib/diff-lcs.rb +3 -0
  44. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs.rb +805 -0
  45. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/array.rb +7 -0
  46. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/block.rb +37 -0
  47. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/callbacks.rb +322 -0
  48. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/change.rb +177 -0
  49. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/htmldiff.rb +149 -0
  50. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/hunk.rb +276 -0
  51. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/internals.rb +301 -0
  52. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/ldiff.rb +195 -0
  53. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/string.rb +5 -0
  54. data/path/gems/diff-lcs-1.2.5/spec/change_spec.rb +65 -0
  55. data/path/gems/diff-lcs-1.2.5/spec/diff_spec.rb +47 -0
  56. data/path/gems/diff-lcs-1.2.5/spec/hunk_spec.rb +72 -0
  57. data/path/gems/diff-lcs-1.2.5/spec/issues_spec.rb +24 -0
  58. data/path/gems/diff-lcs-1.2.5/spec/lcs_spec.rb +54 -0
  59. data/path/gems/diff-lcs-1.2.5/spec/patch_spec.rb +414 -0
  60. data/path/gems/diff-lcs-1.2.5/spec/sdiff_spec.rb +214 -0
  61. data/path/gems/diff-lcs-1.2.5/spec/spec_helper.rb +290 -0
  62. data/path/gems/diff-lcs-1.2.5/spec/traverse_balanced_spec.rb +310 -0
  63. data/path/gems/diff-lcs-1.2.5/spec/traverse_sequences_spec.rb +139 -0
  64. data/path/gems/rspec-3.3.0/License.txt +24 -0
  65. data/path/gems/rspec-3.3.0/README.md +34 -0
  66. data/path/gems/rspec-3.3.0/lib/rspec.rb +3 -0
  67. data/path/gems/rspec-3.3.0/lib/rspec/version.rb +5 -0
  68. data/path/gems/rspec-core-3.3.2/.document +5 -0
  69. data/path/gems/rspec-core-3.3.2/.yardopts +8 -0
  70. data/path/gems/rspec-core-3.3.2/Changelog.md +1856 -0
  71. data/path/gems/rspec-core-3.3.2/License.txt +25 -0
  72. data/path/gems/rspec-core-3.3.2/README.md +369 -0
  73. data/path/gems/rspec-core-3.3.2/exe/rspec +4 -0
  74. data/path/gems/rspec-core-3.3.2/lib/rspec/autorun.rb +3 -0
  75. data/path/gems/rspec-core-3.3.2/lib/rspec/core.rb +181 -0
  76. data/path/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb +64 -0
  77. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb +66 -0
  78. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb +130 -0
  79. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb +139 -0
  80. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb +61 -0
  81. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb +39 -0
  82. data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb +1807 -0
  83. data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb +191 -0
  84. data/path/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb +111 -0
  85. data/path/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb +96 -0
  86. data/path/gems/rspec-core-3.3.2/lib/rspec/core/example.rb +573 -0
  87. data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb +796 -0
  88. data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb +235 -0
  89. data/path/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb +231 -0
  90. data/path/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb +20 -0
  91. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb +254 -0
  92. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb +70 -0
  93. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb +77 -0
  94. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb +68 -0
  95. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb +115 -0
  96. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb +65 -0
  97. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
  98. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb +70 -0
  99. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb +393 -0
  100. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
  101. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb +109 -0
  102. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb +151 -0
  103. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb +415 -0
  104. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/json_formatter.rb +96 -0
  105. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/profile_formatter.rb +68 -0
  106. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/progress_formatter.rb +28 -0
  107. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/protocol.rb +172 -0
  108. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/snippet_extractor.rb +116 -0
  109. data/path/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb +638 -0
  110. data/path/gems/rspec-core-3.3.2/lib/rspec/core/memoized_helpers.rb +532 -0
  111. data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata.rb +490 -0
  112. data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata_filter.rb +235 -0
  113. data/path/gems/rspec-core-3.3.2/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
  114. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
  115. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
  116. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/null.rb +14 -0
  117. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rr.rb +31 -0
  118. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
  119. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mutex.rb +63 -0
  120. data/path/gems/rspec-core-3.3.2/lib/rspec/core/notifications.rb +498 -0
  121. data/path/gems/rspec-core-3.3.2/lib/rspec/core/option_parser.rb +301 -0
  122. data/path/gems/rspec-core-3.3.2/lib/rspec/core/ordering.rb +158 -0
  123. data/path/gems/rspec-core-3.3.2/lib/rspec/core/pending.rb +165 -0
  124. data/path/gems/rspec-core-3.3.2/lib/rspec/core/profiler.rb +32 -0
  125. data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer.rb +48 -0
  126. data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/.rspec +2 -0
  127. data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/spec/spec_helper.rb +96 -0
  128. data/path/gems/rspec-core-3.3.2/lib/rspec/core/rake_task.rb +158 -0
  129. data/path/gems/rspec-core-3.3.2/lib/rspec/core/reentrant_mutex.rb +52 -0
  130. data/path/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb +220 -0
  131. data/path/gems/rspec-core-3.3.2/lib/rspec/core/ruby_project.rb +53 -0
  132. data/path/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb +179 -0
  133. data/path/gems/rspec-core-3.3.2/lib/rspec/core/sandbox.rb +37 -0
  134. data/path/gems/rspec-core-3.3.2/lib/rspec/core/set.rb +49 -0
  135. data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_context.rb +55 -0
  136. data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb +210 -0
  137. data/path/gems/rspec-core-3.3.2/lib/rspec/core/shell_escape.rb +49 -0
  138. data/path/gems/rspec-core-3.3.2/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
  139. data/path/gems/rspec-core-3.3.2/lib/rspec/core/version.rb +9 -0
  140. data/path/gems/rspec-core-3.3.2/lib/rspec/core/warnings.rb +40 -0
  141. data/path/gems/rspec-core-3.3.2/lib/rspec/core/world.rb +178 -0
  142. data/path/gems/rspec-expectations-3.3.1/.document +5 -0
  143. data/path/gems/rspec-expectations-3.3.1/.yardopts +6 -0
  144. data/path/gems/rspec-expectations-3.3.1/Changelog.md +953 -0
  145. data/path/gems/rspec-expectations-3.3.1/License.txt +24 -0
  146. data/path/gems/rspec-expectations-3.3.1/README.md +289 -0
  147. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations.rb +81 -0
  148. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/configuration.rb +164 -0
  149. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb +113 -0
  150. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/fail_with.rb +31 -0
  151. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/failure_aggregator.rb +194 -0
  152. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb +170 -0
  153. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/minitest_integration.rb +31 -0
  154. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/syntax.rb +132 -0
  155. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/version.rb +8 -0
  156. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers.rb +1009 -0
  157. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/aliased_matcher.rb +116 -0
  158. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in.rb +52 -0
  159. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/all.rb +85 -0
  160. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/base_matcher.rb +181 -0
  161. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be.rb +285 -0
  162. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_between.rb +77 -0
  163. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_instance_of.rb +22 -0
  164. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_kind_of.rb +16 -0
  165. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_within.rb +72 -0
  166. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/change.rb +337 -0
  167. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/compound.rb +293 -0
  168. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/contain_exactly.rb +253 -0
  169. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/cover.rb +24 -0
  170. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eq.rb +40 -0
  171. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eql.rb +34 -0
  172. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/equal.rb +81 -0
  173. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/exist.rb +86 -0
  174. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/has.rb +103 -0
  175. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  176. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/include.rb +130 -0
  177. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/match.rb +37 -0
  178. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/operators.rb +128 -0
  179. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/output.rb +200 -0
  180. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/raise_error.rb +216 -0
  181. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/respond_to.rb +90 -0
  182. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/satisfy.rb +37 -0
  183. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  184. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
  185. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/yield.rb +418 -0
  186. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/composable.rb +184 -0
  187. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/dsl.rb +453 -0
  188. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/english_phrasing.rb +42 -0
  189. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +73 -0
  190. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/fail_matchers.rb +42 -0
  191. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/generated_descriptions.rb +42 -0
  192. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_delegator.rb +35 -0
  193. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_protocol.rb +99 -0
  194. data/path/gems/rspec-mocks-3.3.2/.document +5 -0
  195. data/path/gems/rspec-mocks-3.3.2/.yardopts +6 -0
  196. data/path/gems/rspec-mocks-3.3.2/Changelog.md +965 -0
  197. data/path/gems/rspec-mocks-3.3.2/License.txt +24 -0
  198. data/path/gems/rspec-mocks-3.3.2/README.md +430 -0
  199. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks.rb +126 -0
  200. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance.rb +11 -0
  201. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/chain.rb +110 -0
  202. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
  203. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expect_chain_chain.rb +35 -0
  204. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expectation_chain.rb +48 -0
  205. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
  206. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/proxy.rb +116 -0
  207. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/recorder.rb +264 -0
  208. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain.rb +46 -0
  209. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain_chain.rb +27 -0
  210. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_list_matcher.rb +100 -0
  211. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_matchers.rb +320 -0
  212. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/configuration.rb +188 -0
  213. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/error_generator.rb +362 -0
  214. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/example_methods.rb +421 -0
  215. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/instance_method_stasher.rb +135 -0
  216. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/marshal_extension.rb +41 -0
  217. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
  218. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/have_received.rb +116 -0
  219. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive.rb +130 -0
  220. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_message_chain.rb +80 -0
  221. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_messages.rb +75 -0
  222. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_chain.rb +87 -0
  223. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_expectation.rb +717 -0
  224. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_double.rb +287 -0
  225. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_reference.rb +192 -0
  226. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutate_const.rb +335 -0
  227. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutex.rb +73 -0
  228. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/object_reference.rb +149 -0
  229. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/order_group.rb +81 -0
  230. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/proxy.rb +439 -0
  231. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/reentrant_mutex.rb +53 -0
  232. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/space.rb +238 -0
  233. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/standalone.rb +3 -0
  234. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/syntax.rb +325 -0
  235. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/targets.rb +97 -0
  236. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/test_double.rb +170 -0
  237. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_double.rb +129 -0
  238. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_message_expecation.rb +54 -0
  239. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_proxy.rb +213 -0
  240. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/version.rb +9 -0
  241. data/path/gems/rspec-support-3.3.0/Changelog.md +125 -0
  242. data/path/gems/rspec-support-3.3.0/LICENSE.txt +22 -0
  243. data/path/gems/rspec-support-3.3.0/README.md +26 -0
  244. data/path/gems/rspec-support-3.3.0/lib/rspec/support.rb +111 -0
  245. data/path/gems/rspec-support-3.3.0/lib/rspec/support/caller_filter.rb +83 -0
  246. data/path/gems/rspec-support-3.3.0/lib/rspec/support/differ.rb +215 -0
  247. data/path/gems/rspec-support-3.3.0/lib/rspec/support/directory_maker.rb +63 -0
  248. data/path/gems/rspec-support-3.3.0/lib/rspec/support/encoded_string.rb +155 -0
  249. data/path/gems/rspec-support-3.3.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
  250. data/path/gems/rspec-support-3.3.0/lib/rspec/support/hunk_generator.rb +47 -0
  251. data/path/gems/rspec-support-3.3.0/lib/rspec/support/matcher_definition.rb +42 -0
  252. data/path/gems/rspec-support-3.3.0/lib/rspec/support/method_signature_verifier.rb +273 -0
  253. data/path/gems/rspec-support-3.3.0/lib/rspec/support/object_formatter.rb +93 -0
  254. data/path/gems/rspec-support-3.3.0/lib/rspec/support/recursive_const_methods.rb +76 -0
  255. data/path/gems/rspec-support-3.3.0/lib/rspec/support/ruby_features.rb +118 -0
  256. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec.rb +81 -0
  257. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
  258. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/formatting_support.rb +9 -0
  259. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/in_sub_process.rb +52 -0
  260. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/library_wide_checks.rb +145 -0
  261. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/shell_out.rb +71 -0
  262. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
  263. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/string_matcher.rb +46 -0
  264. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_directory.rb +9 -0
  265. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
  266. data/path/gems/rspec-support-3.3.0/lib/rspec/support/version.rb +7 -0
  267. data/path/gems/rspec-support-3.3.0/lib/rspec/support/version_checker.rb +53 -0
  268. data/path/gems/rspec-support-3.3.0/lib/rspec/support/warnings.rb +39 -0
  269. data/path/specifications/diff-lcs-1.2.5.gemspec +68 -0
  270. data/path/specifications/rspec-3.3.0.gemspec +42 -0
  271. data/path/specifications/rspec-core-3.3.2.gemspec +68 -0
  272. data/path/specifications/rspec-expectations-3.3.1.gemspec +50 -0
  273. data/path/specifications/rspec-mocks-3.3.2.gemspec +53 -0
  274. data/path/specifications/rspec-support-3.3.0.gemspec +38 -0
  275. data/sublimetheme.gemspec +32 -0
  276. metadata +363 -0
@@ -0,0 +1,39 @@
1
+ module RSpec
2
+ module Core
3
+ module Bisect
4
+ # Enumerates each subset of the given list of ids that is half the
5
+ # size of the total list, so that hopefully we can discard half the
6
+ # list each repeatedly in order to our minimal repro case.
7
+ # @private
8
+ class SubsetEnumerator
9
+ include Enumerable
10
+
11
+ def initialize(ids)
12
+ @ids = ids
13
+ end
14
+
15
+ def subset_size
16
+ @subset_size ||= (@ids.size / 2.0).ceil
17
+ end
18
+
19
+ def each
20
+ yielded = Set.new
21
+ slice_size = subset_size
22
+ combo_count = 1
23
+
24
+ while slice_size > 0
25
+ @ids.each_slice(slice_size).to_a.combination(combo_count) do |combos|
26
+ subset = combos.flatten
27
+ next if yielded.include?(subset)
28
+ yield subset
29
+ yielded << subset
30
+ end
31
+
32
+ slice_size /= 2
33
+ combo_count *= 2
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,1807 @@
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
+
5
+ module RSpec
6
+ module Core
7
+ # rubocop:disable Style/ClassLength
8
+
9
+ # Stores runtime configuration information.
10
+ #
11
+ # Configuration options are loaded from `~/.rspec`, `.rspec`,
12
+ # `.rspec-local`, command line switches, and the `SPEC_OPTS` environment
13
+ # variable (listed in lowest to highest precedence; for example, an option
14
+ # in `~/.rspec` can be overridden by an option in `.rspec-local`).
15
+ #
16
+ # @example Standard settings
17
+ # RSpec.configure do |c|
18
+ # c.drb = true
19
+ # c.drb_port = 1234
20
+ # c.default_path = 'behavior'
21
+ # end
22
+ #
23
+ # @example Hooks
24
+ # RSpec.configure do |c|
25
+ # c.before(:suite) { establish_connection }
26
+ # c.before(:example) { log_in_as :authorized }
27
+ # c.around(:example) { |ex| Database.transaction(&ex) }
28
+ # end
29
+ #
30
+ # @see RSpec.configure
31
+ # @see Hooks
32
+ class Configuration
33
+ include RSpec::Core::Hooks
34
+
35
+ # Module that holds `attr_reader` declarations. It's in a separate
36
+ # module to allow us to override those methods and use `super`.
37
+ # @private
38
+ Readers = Module.new
39
+ include Readers
40
+
41
+ # @private
42
+ class MustBeConfiguredBeforeExampleGroupsError < StandardError; end
43
+
44
+ # @private
45
+ def self.define_reader(name)
46
+ Readers.class_eval do
47
+ remove_method name if method_defined?(name)
48
+ attr_reader name
49
+ end
50
+
51
+ define_method(name) { value_for(name) { super() } }
52
+ end
53
+
54
+ # @private
55
+ def self.define_aliases(name, alias_name)
56
+ alias_method alias_name, name
57
+ alias_method "#{alias_name}=", "#{name}="
58
+ define_predicate_for alias_name
59
+ end
60
+
61
+ # @private
62
+ def self.define_predicate_for(*names)
63
+ names.each { |name| alias_method "#{name}?", name }
64
+ end
65
+
66
+ # @private
67
+ #
68
+ # Invoked by the `add_setting` instance method. Use that method on a
69
+ # `Configuration` instance rather than this class method.
70
+ def self.add_setting(name, opts={})
71
+ raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
72
+ attr_writer name
73
+ add_read_only_setting name
74
+
75
+ Array(opts[:alias_with]).each do |alias_name|
76
+ define_aliases(name, alias_name)
77
+ end
78
+ end
79
+
80
+ # @private
81
+ #
82
+ # As `add_setting` but only add the reader.
83
+ def self.add_read_only_setting(name, opts={})
84
+ raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
85
+ define_reader name
86
+ define_predicate_for name
87
+ end
88
+
89
+ # @macro [attach] add_setting
90
+ # @!attribute [rw] $1
91
+ # @!method $1=(value)
92
+ #
93
+ # @macro [attach] define_reader
94
+ # @!attribute [r] $1
95
+
96
+ # @macro add_setting
97
+ # Path to use if no path is provided to the `rspec` command (default:
98
+ # `"spec"`). Allows you to just type `rspec` instead of `rspec spec` to
99
+ # run all the examples in the `spec` directory.
100
+ #
101
+ # @note Other scripts invoking `rspec` indirectly will ignore this
102
+ # setting.
103
+ add_setting :default_path
104
+
105
+ # @macro add_setting
106
+ # Run examples over DRb (default: `false`). RSpec doesn't supply the DRb
107
+ # server, but you can use tools like spork.
108
+ add_setting :drb
109
+
110
+ # @macro add_setting
111
+ # The drb_port (default: nil).
112
+ add_setting :drb_port
113
+
114
+ # @macro add_setting
115
+ # Default: `$stderr`.
116
+ add_setting :error_stream
117
+
118
+ # Indicates if the DSL has been exposed off of modules and `main`.
119
+ # Default: true
120
+ def expose_dsl_globally?
121
+ Core::DSL.exposed_globally?
122
+ end
123
+
124
+ # Use this to expose the core RSpec DSL via `Module` and the `main`
125
+ # object. It will be set automatically but you can override it to
126
+ # remove the DSL.
127
+ # Default: true
128
+ def expose_dsl_globally=(value)
129
+ if value
130
+ Core::DSL.expose_globally!
131
+ Core::SharedExampleGroup::TopLevelDSL.expose_globally!
132
+ else
133
+ Core::DSL.remove_globally!
134
+ Core::SharedExampleGroup::TopLevelDSL.remove_globally!
135
+ end
136
+ end
137
+
138
+ # Determines where deprecation warnings are printed.
139
+ # Defaults to `$stderr`.
140
+ # @return [IO, String] IO to write to or filename to write to
141
+ define_reader :deprecation_stream
142
+
143
+ # Determines where deprecation warnings are printed.
144
+ # @param value [IO, String] IO to write to or filename to write to
145
+ def deprecation_stream=(value)
146
+ if @reporter && !value.equal?(@deprecation_stream)
147
+ warn "RSpec's reporter has already been initialized with " \
148
+ "#{deprecation_stream.inspect} as the deprecation stream, so your change to "\
149
+ "`deprecation_stream` will be ignored. You should configure it earlier for " \
150
+ "it to take effect, or use the `--deprecation-out` CLI option. " \
151
+ "(Called from #{CallerFilter.first_non_rspec_line})"
152
+ else
153
+ @deprecation_stream = value
154
+ end
155
+ end
156
+
157
+ # @macro define_reader
158
+ # The file path to use for persisting example statuses. Necessary for the
159
+ # `--only-failures` and `--next-failures` CLI options.
160
+ #
161
+ # @overload example_status_persistence_file_path
162
+ # @return [String] the file path
163
+ # @overload example_status_persistence_file_path=(value)
164
+ # @param value [String] the file path
165
+ define_reader :example_status_persistence_file_path
166
+
167
+ # Sets the file path to use for persisting example statuses. Necessary for the
168
+ # `--only-failures` and `--next-failures` CLI options.
169
+ def example_status_persistence_file_path=(value)
170
+ @example_status_persistence_file_path = value
171
+ clear_values_derived_from_example_status_persistence_file_path
172
+ end
173
+
174
+ # @macro define_reader
175
+ # Indicates if the `--only-failures` (or `--next-failure`) flag is being used.
176
+ define_reader :only_failures
177
+ alias_method :only_failures?, :only_failures
178
+
179
+ # @private
180
+ def only_failures_but_not_configured?
181
+ only_failures? && !example_status_persistence_file_path
182
+ end
183
+
184
+ # @macro add_setting
185
+ # Clean up and exit after the first failure (default: `false`).
186
+ add_setting :fail_fast
187
+
188
+ # @macro add_setting
189
+ # Prints the formatter output of your suite without running any
190
+ # examples or hooks.
191
+ add_setting :dry_run
192
+
193
+ # @macro add_setting
194
+ # The exit code to return if there are any failures (default: 1).
195
+ add_setting :failure_exit_code
196
+
197
+ # @macro define_reader
198
+ # Indicates files configured to be required.
199
+ define_reader :requires
200
+
201
+ # @macro define_reader
202
+ # Returns dirs that have been prepended to the load path by the `-I`
203
+ # command line option.
204
+ define_reader :libs
205
+
206
+ # @macro add_setting
207
+ # Determines where RSpec will send its output.
208
+ # Default: `$stdout`.
209
+ define_reader :output_stream
210
+
211
+ # Set the output stream for reporter.
212
+ # @attr value [IO] value for output, defaults to $stdout
213
+ def output_stream=(value)
214
+ if @reporter && !value.equal?(@output_stream)
215
+ warn "RSpec's reporter has already been initialized with " \
216
+ "#{output_stream.inspect} as the output stream, so your change to "\
217
+ "`output_stream` will be ignored. You should configure it earlier for " \
218
+ "it to take effect. (Called from #{CallerFilter.first_non_rspec_line})"
219
+ else
220
+ @output_stream = value
221
+ end
222
+ end
223
+
224
+ # @macro define_reader
225
+ # Load files matching this pattern (default: `'**{,/*/**}/*_spec.rb'`).
226
+ define_reader :pattern
227
+
228
+ # Set pattern to match files to load.
229
+ # @attr value [String] the filename pattern to filter spec files by
230
+ def pattern=(value)
231
+ update_pattern_attr :pattern, value
232
+ end
233
+
234
+ # @macro define_reader
235
+ # Exclude files matching this pattern.
236
+ define_reader :exclude_pattern
237
+
238
+ # Set pattern to match files to exclude.
239
+ # @attr value [String] the filename pattern to exclude spec files by
240
+ def exclude_pattern=(value)
241
+ update_pattern_attr :exclude_pattern, value
242
+ end
243
+
244
+ # @macro add_setting
245
+ # Report the times for the slowest examples (default: `false`).
246
+ # Use this to specify the number of examples to include in the profile.
247
+ add_setting :profile_examples
248
+
249
+ # @macro add_setting
250
+ # Run all examples if none match the configured filters
251
+ # (default: `false`).
252
+ add_setting :run_all_when_everything_filtered
253
+
254
+ # @macro add_setting
255
+ # Color to use to indicate success.
256
+ # @param color [Symbol] defaults to `:green` but can be set to one of the
257
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
258
+ # :cyan]`
259
+ add_setting :success_color
260
+
261
+ # @macro add_setting
262
+ # Color to use to print pending examples.
263
+ # @param color [Symbol] defaults to `:yellow` but can be set to one of the
264
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
265
+ # :cyan]`
266
+ add_setting :pending_color
267
+
268
+ # @macro add_setting
269
+ # Color to use to indicate failure.
270
+ # @param color [Symbol] defaults to `:red` but can be set to one of the
271
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
272
+ # :cyan]`
273
+ add_setting :failure_color
274
+
275
+ # @macro add_setting
276
+ # The default output color.
277
+ # @param color [Symbol] defaults to `:white` but can be set to one of the
278
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
279
+ # :cyan]`
280
+ add_setting :default_color
281
+
282
+ # @macro add_setting
283
+ # Color used when a pending example is fixed.
284
+ # @param color [Symbol] defaults to `:blue` but can be set to one of the
285
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
286
+ # :cyan]`
287
+ add_setting :fixed_color
288
+
289
+ # @macro add_setting
290
+ # Color used to print details.
291
+ # @param color [Symbol] defaults to `:cyan` but can be set to one of the
292
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
293
+ # :cyan]`
294
+ add_setting :detail_color
295
+
296
+ # Deprecated. This config option was added in RSpec 2 to pave the way
297
+ # for this being the default behavior in RSpec 3. Now this option is
298
+ # a no-op.
299
+ def treat_symbols_as_metadata_keys_with_true_values=(_value)
300
+ RSpec.deprecate(
301
+ "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values=",
302
+ :message => "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values= " \
303
+ "is deprecated, it is now set to true as default and " \
304
+ "setting it to false has no effect."
305
+ )
306
+ end
307
+
308
+ # Record the start time of the spec suite to measure load time.
309
+ add_setting :start_time
310
+
311
+ # @macro add_setting
312
+ # Use threadsafe options where available.
313
+ # Currently this will place a mutex around memoized values such as let blocks.
314
+ add_setting :threadsafe
315
+
316
+ # @private
317
+ add_setting :tty
318
+ # @private
319
+ attr_writer :files_to_run
320
+ # @private
321
+ attr_accessor :filter_manager
322
+ # @private
323
+ attr_accessor :static_config_filter_manager
324
+ # @private
325
+ attr_reader :backtrace_formatter, :ordering_manager, :loaded_spec_files
326
+
327
+ def initialize
328
+ # rubocop:disable Style/GlobalVars
329
+ @start_time = $_rspec_core_load_started_at || ::RSpec::Core::Time.now
330
+ # rubocop:enable Style/GlobalVars
331
+ @expectation_frameworks = []
332
+ @include_modules = FilterableItemRepository::QueryOptimized.new(:any?)
333
+ @extend_modules = FilterableItemRepository::QueryOptimized.new(:any?)
334
+ @prepend_modules = FilterableItemRepository::QueryOptimized.new(:any?)
335
+
336
+ @before_suite_hooks = []
337
+ @after_suite_hooks = []
338
+
339
+ @mock_framework = nil
340
+ @files_or_directories_to_run = []
341
+ @loaded_spec_files = Set.new
342
+ @color = false
343
+ @pattern = '**{,/*/**}/*_spec.rb'
344
+ @exclude_pattern = ''
345
+ @failure_exit_code = 1
346
+ @spec_files_loaded = false
347
+
348
+ @backtrace_formatter = BacktraceFormatter.new
349
+
350
+ @default_path = 'spec'
351
+ @deprecation_stream = $stderr
352
+ @output_stream = $stdout
353
+ @reporter = nil
354
+ @reporter_buffer = nil
355
+ @filter_manager = FilterManager.new
356
+ @static_config_filter_manager = FilterManager.new
357
+ @ordering_manager = Ordering::ConfigurationManager.new
358
+ @preferred_options = {}
359
+ @failure_color = :red
360
+ @success_color = :green
361
+ @pending_color = :yellow
362
+ @default_color = :white
363
+ @fixed_color = :blue
364
+ @detail_color = :cyan
365
+ @profile_examples = false
366
+ @requires = []
367
+ @libs = []
368
+ @derived_metadata_blocks = FilterableItemRepository::QueryOptimized.new(:any?)
369
+ @threadsafe = true
370
+
371
+ define_built_in_hooks
372
+ end
373
+
374
+ # @private
375
+ #
376
+ # Used to set higher priority option values from the command line.
377
+ def force(hash)
378
+ ordering_manager.force(hash)
379
+ @preferred_options.merge!(hash)
380
+
381
+ return unless hash.key?(:example_status_persistence_file_path)
382
+ clear_values_derived_from_example_status_persistence_file_path
383
+ end
384
+
385
+ # @private
386
+ def reset
387
+ @spec_files_loaded = false
388
+ @reporter = nil
389
+ @formatter_loader = nil
390
+ end
391
+
392
+ # @private
393
+ def reset_filters
394
+ self.filter_manager = FilterManager.new
395
+ filter_manager.include_only(
396
+ Metadata.deep_hash_dup(static_config_filter_manager.inclusions.rules)
397
+ )
398
+ filter_manager.exclude_only(
399
+ Metadata.deep_hash_dup(static_config_filter_manager.exclusions.rules)
400
+ )
401
+ end
402
+
403
+ # @overload add_setting(name)
404
+ # @overload add_setting(name, opts)
405
+ # @option opts [Symbol] :default
406
+ #
407
+ # Set a default value for the generated getter and predicate methods:
408
+ #
409
+ # add_setting(:foo, :default => "default value")
410
+ #
411
+ # @option opts [Symbol] :alias_with
412
+ #
413
+ # Use `:alias_with` to alias the setter, getter, and predicate to
414
+ # another name, or names:
415
+ #
416
+ # add_setting(:foo, :alias_with => :bar)
417
+ # add_setting(:foo, :alias_with => [:bar, :baz])
418
+ #
419
+ # Adds a custom setting to the RSpec.configuration object.
420
+ #
421
+ # RSpec.configuration.add_setting :foo
422
+ #
423
+ # Used internally and by extension frameworks like rspec-rails, so they
424
+ # can add config settings that are domain specific. For example:
425
+ #
426
+ # RSpec.configure do |c|
427
+ # c.add_setting :use_transactional_fixtures,
428
+ # :default => true,
429
+ # :alias_with => :use_transactional_examples
430
+ # end
431
+ #
432
+ # `add_setting` creates three methods on the configuration object, a
433
+ # setter, a getter, and a predicate:
434
+ #
435
+ # RSpec.configuration.foo=(value)
436
+ # RSpec.configuration.foo
437
+ # RSpec.configuration.foo? # Returns true if foo returns anything but nil or false.
438
+ def add_setting(name, opts={})
439
+ default = opts.delete(:default)
440
+ (class << self; self; end).class_exec do
441
+ add_setting(name, opts)
442
+ end
443
+ __send__("#{name}=", default) if default
444
+ end
445
+
446
+ # Returns the configured mock framework adapter module.
447
+ def mock_framework
448
+ if @mock_framework.nil?
449
+ begin
450
+ mock_with :rspec
451
+ rescue LoadError
452
+ mock_with :nothing
453
+ end
454
+ end
455
+ @mock_framework
456
+ end
457
+
458
+ # Delegates to mock_framework=(framework).
459
+ def mock_framework=(framework)
460
+ mock_with framework
461
+ end
462
+
463
+ # Regexps used to exclude lines from backtraces.
464
+ #
465
+ # Excludes lines from ruby (and jruby) source, installed gems, anything
466
+ # in any "bin" directory, and any of the RSpec libs (outside gem
467
+ # installs) by default.
468
+ #
469
+ # You can modify the list via the getter, or replace it with the setter.
470
+ #
471
+ # To override this behaviour and display a full backtrace, use
472
+ # `--backtrace` on the command line, in a `.rspec` file, or in the
473
+ # `rspec_options` attribute of RSpec's rake task.
474
+ def backtrace_exclusion_patterns
475
+ @backtrace_formatter.exclusion_patterns
476
+ end
477
+
478
+ # Set regular expressions used to exclude lines in backtrace.
479
+ # @param patterns [Regexp] set the backtrace exlusion pattern
480
+ def backtrace_exclusion_patterns=(patterns)
481
+ @backtrace_formatter.exclusion_patterns = patterns
482
+ end
483
+
484
+ # Regexps used to include lines in backtraces.
485
+ #
486
+ # Defaults to [Regexp.new Dir.getwd].
487
+ #
488
+ # Lines that match an exclusion _and_ an inclusion pattern
489
+ # will be included.
490
+ #
491
+ # You can modify the list via the getter, or replace it with the setter.
492
+ def backtrace_inclusion_patterns
493
+ @backtrace_formatter.inclusion_patterns
494
+ end
495
+
496
+ # Set regular expressions used to include lines in backtrace.
497
+ # @attr patterns [Regexp] set backtrace_formatter inclusion_patterns
498
+ def backtrace_inclusion_patterns=(patterns)
499
+ @backtrace_formatter.inclusion_patterns = patterns
500
+ end
501
+
502
+ # Adds {#backtrace_exclusion_patterns} that will filter lines from
503
+ # the named gems from backtraces.
504
+ #
505
+ # @param gem_names [Array<String>] Names of the gems to filter
506
+ #
507
+ # @example
508
+ # RSpec.configure do |config|
509
+ # config.filter_gems_from_backtrace "rack", "rake"
510
+ # end
511
+ #
512
+ # @note The patterns this adds will match the named gems in their common
513
+ # locations (e.g. system gems, vendored with bundler, installed as a
514
+ # :git dependency with bundler, etc) but is not guaranteed to work for
515
+ # all possible gem locations. For example, if you have the gem source
516
+ # in a directory with a completely unrelated name, and use bundler's
517
+ # :path option, this will not filter it.
518
+ def filter_gems_from_backtrace(*gem_names)
519
+ gem_names.each do |name|
520
+ @backtrace_formatter.filter_gem(name)
521
+ end
522
+ end
523
+
524
+ # @private
525
+ MOCKING_ADAPTERS = {
526
+ :rspec => :RSpec,
527
+ :flexmock => :Flexmock,
528
+ :rr => :RR,
529
+ :mocha => :Mocha,
530
+ :nothing => :Null
531
+ }
532
+
533
+ # Sets the mock framework adapter module.
534
+ #
535
+ # `framework` can be a Symbol or a Module.
536
+ #
537
+ # Given any of `:rspec`, `:mocha`, `:flexmock`, or `:rr`, configures the
538
+ # named framework.
539
+ #
540
+ # Given `:nothing`, configures no framework. Use this if you don't use
541
+ # any mocking framework to save a little bit of overhead.
542
+ #
543
+ # Given a Module, includes that module in every example group. The module
544
+ # should adhere to RSpec's mock framework adapter API:
545
+ #
546
+ # setup_mocks_for_rspec
547
+ # - called before each example
548
+ #
549
+ # verify_mocks_for_rspec
550
+ # - called after each example if the example hasn't yet failed.
551
+ # Framework should raise an exception when expectations fail
552
+ #
553
+ # teardown_mocks_for_rspec
554
+ # - called after verify_mocks_for_rspec (even if there are errors)
555
+ #
556
+ # If the module responds to `configuration` and `mock_with` receives a
557
+ # block, it will yield the configuration object to the block e.g.
558
+ #
559
+ # config.mock_with OtherMockFrameworkAdapter do |mod_config|
560
+ # mod_config.custom_setting = true
561
+ # end
562
+ def mock_with(framework)
563
+ framework_module =
564
+ if framework.is_a?(Module)
565
+ framework
566
+ else
567
+ const_name = MOCKING_ADAPTERS.fetch(framework) do
568
+ raise ArgumentError,
569
+ "Unknown mocking framework: #{framework.inspect}. " \
570
+ "Pass a module or one of #{MOCKING_ADAPTERS.keys.inspect}"
571
+ end
572
+
573
+ RSpec::Support.require_rspec_core "mocking_adapters/#{const_name.to_s.downcase}"
574
+ RSpec::Core::MockingAdapters.const_get(const_name)
575
+ end
576
+
577
+ new_name, old_name = [framework_module, @mock_framework].map do |mod|
578
+ mod.respond_to?(:framework_name) ? mod.framework_name : :unnamed
579
+ end
580
+
581
+ unless new_name == old_name
582
+ assert_no_example_groups_defined(:mock_framework)
583
+ end
584
+
585
+ if block_given?
586
+ raise "#{framework_module} must respond to `configuration` so that " \
587
+ "mock_with can yield it." unless framework_module.respond_to?(:configuration)
588
+ yield framework_module.configuration
589
+ end
590
+
591
+ @mock_framework = framework_module
592
+ end
593
+
594
+ # Returns the configured expectation framework adapter module(s)
595
+ def expectation_frameworks
596
+ if @expectation_frameworks.empty?
597
+ begin
598
+ expect_with :rspec
599
+ rescue LoadError
600
+ expect_with Module.new
601
+ end
602
+ end
603
+ @expectation_frameworks
604
+ end
605
+
606
+ # Delegates to expect_with(framework).
607
+ def expectation_framework=(framework)
608
+ expect_with(framework)
609
+ end
610
+
611
+ # Sets the expectation framework module(s) to be included in each example
612
+ # group.
613
+ #
614
+ # `frameworks` can be `:rspec`, `:test_unit`, `:minitest`, a custom
615
+ # module, or any combination thereof:
616
+ #
617
+ # config.expect_with :rspec
618
+ # config.expect_with :test_unit
619
+ # config.expect_with :minitest
620
+ # config.expect_with :rspec, :minitest
621
+ # config.expect_with OtherExpectationFramework
622
+ #
623
+ # RSpec will translate `:rspec`, `:minitest`, and `:test_unit` into the
624
+ # appropriate modules.
625
+ #
626
+ # ## Configuration
627
+ #
628
+ # If the module responds to `configuration`, `expect_with` will
629
+ # yield the `configuration` object if given a block:
630
+ #
631
+ # config.expect_with OtherExpectationFramework do |custom_config|
632
+ # custom_config.custom_setting = true
633
+ # end
634
+ def expect_with(*frameworks)
635
+ modules = frameworks.map do |framework|
636
+ case framework
637
+ when Module
638
+ framework
639
+ when :rspec
640
+ require 'rspec/expectations'
641
+
642
+ # Tag this exception class so our exception formatting logic knows
643
+ # that it satisfies the `MultipleExceptionError` interface.
644
+ ::RSpec::Expectations::MultipleExpectationsNotMetError.__send__(
645
+ :include, MultipleExceptionError::InterfaceTag
646
+ )
647
+
648
+ ::RSpec::Matchers
649
+ when :test_unit
650
+ require 'rspec/core/test_unit_assertions_adapter'
651
+ ::RSpec::Core::TestUnitAssertionsAdapter
652
+ when :minitest
653
+ require 'rspec/core/minitest_assertions_adapter'
654
+ ::RSpec::Core::MinitestAssertionsAdapter
655
+ else
656
+ raise ArgumentError, "#{framework.inspect} is not supported"
657
+ end
658
+ end
659
+
660
+ if (modules - @expectation_frameworks).any?
661
+ assert_no_example_groups_defined(:expect_with)
662
+ end
663
+
664
+ if block_given?
665
+ raise "expect_with only accepts a block with a single argument. " \
666
+ "Call expect_with #{modules.length} times, " \
667
+ "once with each argument, instead." if modules.length > 1
668
+ raise "#{modules.first} must respond to `configuration` so that " \
669
+ "expect_with can yield it." unless modules.first.respond_to?(:configuration)
670
+ yield modules.first.configuration
671
+ end
672
+
673
+ @expectation_frameworks.push(*modules)
674
+ end
675
+
676
+ # Check if full backtrace is enabled.
677
+ # @return [Boolean] is full backtrace enabled
678
+ def full_backtrace?
679
+ @backtrace_formatter.full_backtrace?
680
+ end
681
+
682
+ # Toggle full backtrace.
683
+ # @attr true_or_false [Boolean] toggle full backtrace display
684
+ def full_backtrace=(true_or_false)
685
+ @backtrace_formatter.full_backtrace = true_or_false
686
+ end
687
+
688
+ # Returns the configuration option for color, but should not
689
+ # be used to check if color is supported.
690
+ #
691
+ # @see color_enabled?
692
+ # @return [Boolean]
693
+ def color
694
+ value_for(:color) { @color }
695
+ end
696
+
697
+ # Check if color is enabled for a particular output.
698
+ # @param output [IO] an output stream to use, defaults to the current
699
+ # `output_stream`
700
+ # @return [Boolean]
701
+ def color_enabled?(output=output_stream)
702
+ output_to_tty?(output) && color
703
+ end
704
+
705
+ # Toggle output color.
706
+ # @attr true_or_false [Boolean] toggle color enabled
707
+ def color=(true_or_false)
708
+ return unless true_or_false
709
+
710
+ if RSpec::Support::OS.windows? && !ENV['ANSICON']
711
+ RSpec.warning "You must use ANSICON 1.31 or later " \
712
+ "(http://adoxa.3eeweb.com/ansicon/) to use colour " \
713
+ "on Windows"
714
+ @color = false
715
+ else
716
+ @color = true
717
+ end
718
+ end
719
+
720
+ # @private
721
+ def libs=(libs)
722
+ libs.map do |lib|
723
+ @libs.unshift lib
724
+ $LOAD_PATH.unshift lib
725
+ end
726
+ end
727
+
728
+ # Run examples matching on `description` in all files to run.
729
+ # @param description [String, Regexp] the pattern to filter on
730
+ def full_description=(description)
731
+ filter_run :full_description => Regexp.union(*Array(description).map { |d| Regexp.new(d) })
732
+ end
733
+
734
+ # @return [Array] full description filter
735
+ def full_description
736
+ filter.fetch :full_description, nil
737
+ end
738
+
739
+ # @overload add_formatter(formatter)
740
+ #
741
+ # Adds a formatter to the formatters collection. `formatter` can be a
742
+ # string representing any of the built-in formatters (see
743
+ # `built_in_formatter`), or a custom formatter class.
744
+ #
745
+ # ### Note
746
+ #
747
+ # For internal purposes, `add_formatter` also accepts the name of a class
748
+ # and paths to use for output streams, but you should consider that a
749
+ # private api that may change at any time without notice.
750
+ def add_formatter(formatter_to_use, *paths)
751
+ paths << output_stream if paths.empty?
752
+ formatter_loader.add formatter_to_use, *paths
753
+ end
754
+ alias_method :formatter=, :add_formatter
755
+
756
+ # The formatter that will be used if no formatter has been set.
757
+ # Defaults to 'progress'.
758
+ def default_formatter
759
+ formatter_loader.default_formatter
760
+ end
761
+
762
+ # Sets a fallback formatter to use if none other has been set.
763
+ #
764
+ # @example
765
+ #
766
+ # RSpec.configure do |rspec|
767
+ # rspec.default_formatter = 'doc'
768
+ # end
769
+ def default_formatter=(value)
770
+ formatter_loader.default_formatter = value
771
+ end
772
+
773
+ # Returns a duplicate of the formatters currently loaded in
774
+ # the `FormatterLoader` for introspection.
775
+ #
776
+ # Note as this is a duplicate, any mutations will be disregarded.
777
+ #
778
+ # @return [Array] the formatters currently loaded
779
+ def formatters
780
+ formatter_loader.formatters.dup
781
+ end
782
+
783
+ # @private
784
+ def formatter_loader
785
+ @formatter_loader ||= Formatters::Loader.new(Reporter.new(self))
786
+ end
787
+
788
+ # @private
789
+ #
790
+ # This buffer is used to capture all messages sent to the reporter during
791
+ # reporter initialization. It can then replay those messages after the
792
+ # formatter is correctly initialized. Otherwise, deprecation warnings
793
+ # during formatter initialization can cause an infinite loop.
794
+ class DeprecationReporterBuffer
795
+ def initialize
796
+ @calls = []
797
+ end
798
+
799
+ def deprecation(*args)
800
+ @calls << args
801
+ end
802
+
803
+ def play_onto(reporter)
804
+ @calls.each do |args|
805
+ reporter.deprecation(*args)
806
+ end
807
+ end
808
+ end
809
+
810
+ # @private
811
+ def reporter
812
+ # @reporter_buffer should only ever be set in this method to cover
813
+ # initialization of @reporter.
814
+ @reporter_buffer || @reporter ||=
815
+ begin
816
+ @reporter_buffer = DeprecationReporterBuffer.new
817
+ formatter_loader.setup_default output_stream, deprecation_stream
818
+ @reporter_buffer.play_onto(formatter_loader.reporter)
819
+ @reporter_buffer = nil
820
+ formatter_loader.reporter
821
+ end
822
+ end
823
+
824
+ # @api private
825
+ #
826
+ # Defaults `profile_examples` to 10 examples when `@profile_examples` is
827
+ # `true`.
828
+ def profile_examples
829
+ profile = value_for(:profile_examples) { @profile_examples }
830
+ if profile && !profile.is_a?(Integer)
831
+ 10
832
+ else
833
+ profile
834
+ end
835
+ end
836
+
837
+ # @private
838
+ def files_or_directories_to_run=(*files)
839
+ files = files.flatten
840
+
841
+ if (command == 'rspec' || Runner.running_in_drb?) && default_path && files.empty?
842
+ files << default_path
843
+ end
844
+
845
+ @files_or_directories_to_run = files
846
+ @files_to_run = nil
847
+ end
848
+
849
+ # The spec files RSpec will run.
850
+ # @return [Array] specified files about to run
851
+ def files_to_run
852
+ @files_to_run ||= get_files_to_run(@files_or_directories_to_run)
853
+ end
854
+
855
+ # @private
856
+ def last_run_statuses
857
+ @last_run_statuses ||= Hash.new(UNKNOWN_STATUS).tap do |statuses|
858
+ if (path = example_status_persistence_file_path)
859
+ begin
860
+ ExampleStatusPersister.load_from(path).inject(statuses) do |hash, example|
861
+ hash[example.fetch(:example_id)] = example.fetch(:status)
862
+ hash
863
+ end
864
+ rescue SystemCallError => e
865
+ RSpec.warning "Could not read from #{path.inspect} (configured as " \
866
+ "`config.example_status_persistence_file_path`) due " \
867
+ "to a system error: #{e.inspect}. Please check that " \
868
+ "the config option is set to an accessible, valid " \
869
+ "file path", :call_site => nil
870
+ end
871
+ end
872
+ end
873
+ end
874
+
875
+ # @private
876
+ UNKNOWN_STATUS = "unknown".freeze
877
+
878
+ # @private
879
+ FAILED_STATUS = "failed".freeze
880
+
881
+ # @private
882
+ def spec_files_with_failures
883
+ @spec_files_with_failures ||= last_run_statuses.inject(Set.new) do |files, (id, status)|
884
+ files << id.split(ON_SQUARE_BRACKETS).first if status == FAILED_STATUS
885
+ files
886
+ end.to_a
887
+ end
888
+
889
+ # Creates a method that delegates to `example` including the submitted
890
+ # `args`. Used internally to add variants of `example` like `pending`:
891
+ # @param name [String] example name alias
892
+ # @param args [Array<Symbol>, Hash] metadata for the generated example
893
+ #
894
+ # @note The specific example alias below (`pending`) is already
895
+ # defined for you.
896
+ # @note Use with caution. This extends the language used in your
897
+ # specs, but does not add any additional documentation. We use this
898
+ # in RSpec to define methods like `focus` and `xit`, but we also add
899
+ # docs for those methods.
900
+ #
901
+ # @example
902
+ # RSpec.configure do |config|
903
+ # config.alias_example_to :pending, :pending => true
904
+ # end
905
+ #
906
+ # # This lets you do this:
907
+ #
908
+ # describe Thing do
909
+ # pending "does something" do
910
+ # thing = Thing.new
911
+ # end
912
+ # end
913
+ #
914
+ # # ... which is the equivalent of
915
+ #
916
+ # describe Thing do
917
+ # it "does something", :pending => true do
918
+ # thing = Thing.new
919
+ # end
920
+ # end
921
+ def alias_example_to(name, *args)
922
+ extra_options = Metadata.build_hash_from(args)
923
+ RSpec::Core::ExampleGroup.define_example_method(name, extra_options)
924
+ end
925
+
926
+ # Creates a method that defines an example group with the provided
927
+ # metadata. Can be used to define example group/metadata shortcuts.
928
+ #
929
+ # @example
930
+ # RSpec.configure do |config|
931
+ # config.alias_example_group_to :describe_model, :type => :model
932
+ # end
933
+ #
934
+ # shared_context_for "model tests", :type => :model do
935
+ # # define common model test helper methods, `let` declarations, etc
936
+ # end
937
+ #
938
+ # # This lets you do this:
939
+ #
940
+ # RSpec.describe_model User do
941
+ # end
942
+ #
943
+ # # ... which is the equivalent of
944
+ #
945
+ # RSpec.describe User, :type => :model do
946
+ # end
947
+ #
948
+ # @note The defined aliased will also be added to the top level
949
+ # (e.g. `main` and from within modules) if
950
+ # `expose_dsl_globally` is set to true.
951
+ # @see #alias_example_to
952
+ # @see #expose_dsl_globally=
953
+ def alias_example_group_to(new_name, *args)
954
+ extra_options = Metadata.build_hash_from(args)
955
+ RSpec::Core::ExampleGroup.define_example_group_method(new_name, extra_options)
956
+ end
957
+
958
+ # Define an alias for it_should_behave_like that allows different
959
+ # language (like "it_has_behavior" or "it_behaves_like") to be
960
+ # employed when including shared examples.
961
+ #
962
+ # @example
963
+ # RSpec.configure do |config|
964
+ # config.alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
965
+ # end
966
+ #
967
+ # # allows the user to include a shared example group like:
968
+ #
969
+ # describe Entity do
970
+ # it_has_behavior 'sortability' do
971
+ # let(:sortable) { Entity.new }
972
+ # end
973
+ # end
974
+ #
975
+ # # which is reported in the output as:
976
+ # # Entity
977
+ # # has behavior: sortability
978
+ # # ...sortability examples here
979
+ #
980
+ # @note Use with caution. This extends the language used in your
981
+ # specs, but does not add any additional documentation. We use this
982
+ # in RSpec to define `it_should_behave_like` (for backward
983
+ # compatibility), but we also add docs for that method.
984
+ def alias_it_behaves_like_to(new_name, report_label='')
985
+ RSpec::Core::ExampleGroup.define_nested_shared_group_method(new_name, report_label)
986
+ end
987
+ alias_method :alias_it_should_behave_like_to, :alias_it_behaves_like_to
988
+
989
+ # Adds key/value pairs to the `inclusion_filter`. If `args`
990
+ # includes any symbols that are not part of the hash, each symbol
991
+ # is treated as a key in the hash with the value `true`.
992
+ #
993
+ # ### Note
994
+ #
995
+ # Filters set using this method can be overridden from the command line
996
+ # or config files (e.g. `.rspec`).
997
+ #
998
+ # @example
999
+ # # Given this declaration.
1000
+ # describe "something", :foo => 'bar' do
1001
+ # # ...
1002
+ # end
1003
+ #
1004
+ # # Any of the following will include that group.
1005
+ # config.filter_run_including :foo => 'bar'
1006
+ # config.filter_run_including :foo => /^ba/
1007
+ # config.filter_run_including :foo => lambda {|v| v == 'bar'}
1008
+ # config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
1009
+ #
1010
+ # # Given a proc with an arity of 1, the lambda is passed the value
1011
+ # # related to the key, e.g.
1012
+ # config.filter_run_including :foo => lambda {|v| v == 'bar'}
1013
+ #
1014
+ # # Given a proc with an arity of 2, the lambda is passed the value
1015
+ # # related to the key, and the metadata itself e.g.
1016
+ # config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
1017
+ #
1018
+ # filter_run_including :foo # same as filter_run_including :foo => true
1019
+ def filter_run_including(*args)
1020
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
1021
+ filter_manager.include_with_low_priority meta
1022
+ static_config_filter_manager.include_with_low_priority Metadata.deep_hash_dup(meta)
1023
+ end
1024
+
1025
+ alias_method :filter_run, :filter_run_including
1026
+
1027
+ # Clears and reassigns the `inclusion_filter`. Set to `nil` if you don't
1028
+ # want any inclusion filter at all.
1029
+ #
1030
+ # ### Warning
1031
+ #
1032
+ # This overrides any inclusion filters/tags set on the command line or in
1033
+ # configuration files.
1034
+ def inclusion_filter=(filter)
1035
+ meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
1036
+ filter_manager.include_only meta
1037
+ end
1038
+
1039
+ alias_method :filter=, :inclusion_filter=
1040
+
1041
+ # Returns the `inclusion_filter`. If none has been set, returns an empty
1042
+ # hash.
1043
+ def inclusion_filter
1044
+ filter_manager.inclusions
1045
+ end
1046
+
1047
+ alias_method :filter, :inclusion_filter
1048
+
1049
+ # Adds key/value pairs to the `exclusion_filter`. If `args`
1050
+ # includes any symbols that are not part of the hash, each symbol
1051
+ # is treated as a key in the hash with the value `true`.
1052
+ #
1053
+ # ### Note
1054
+ #
1055
+ # Filters set using this method can be overridden from the command line
1056
+ # or config files (e.g. `.rspec`).
1057
+ #
1058
+ # @example
1059
+ # # Given this declaration.
1060
+ # describe "something", :foo => 'bar' do
1061
+ # # ...
1062
+ # end
1063
+ #
1064
+ # # Any of the following will exclude that group.
1065
+ # config.filter_run_excluding :foo => 'bar'
1066
+ # config.filter_run_excluding :foo => /^ba/
1067
+ # config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
1068
+ # config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
1069
+ #
1070
+ # # Given a proc with an arity of 1, the lambda is passed the value
1071
+ # # related to the key, e.g.
1072
+ # config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
1073
+ #
1074
+ # # Given a proc with an arity of 2, the lambda is passed the value
1075
+ # # related to the key, and the metadata itself e.g.
1076
+ # config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
1077
+ #
1078
+ # filter_run_excluding :foo # same as filter_run_excluding :foo => true
1079
+ def filter_run_excluding(*args)
1080
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
1081
+ filter_manager.exclude_with_low_priority meta
1082
+ static_config_filter_manager.exclude_with_low_priority Metadata.deep_hash_dup(meta)
1083
+ end
1084
+
1085
+ # Clears and reassigns the `exclusion_filter`. Set to `nil` if you don't
1086
+ # want any exclusion filter at all.
1087
+ #
1088
+ # ### Warning
1089
+ #
1090
+ # This overrides any exclusion filters/tags set on the command line or in
1091
+ # configuration files.
1092
+ def exclusion_filter=(filter)
1093
+ meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
1094
+ filter_manager.exclude_only meta
1095
+ end
1096
+
1097
+ # Returns the `exclusion_filter`. If none has been set, returns an empty
1098
+ # hash.
1099
+ def exclusion_filter
1100
+ filter_manager.exclusions
1101
+ end
1102
+
1103
+ # Tells RSpec to include `mod` in example groups. Methods defined in
1104
+ # `mod` are exposed to examples (not example groups). Use `filters` to
1105
+ # constrain the groups or examples in which to include the module.
1106
+ #
1107
+ # @example
1108
+ #
1109
+ # module AuthenticationHelpers
1110
+ # def login_as(user)
1111
+ # # ...
1112
+ # end
1113
+ # end
1114
+ #
1115
+ # module UserHelpers
1116
+ # def users(username)
1117
+ # # ...
1118
+ # end
1119
+ # end
1120
+ #
1121
+ # RSpec.configure do |config|
1122
+ # config.include(UserHelpers) # included in all modules
1123
+ # config.include(AuthenticationHelpers, :type => :request)
1124
+ # end
1125
+ #
1126
+ # describe "edit profile", :type => :request do
1127
+ # it "can be viewed by owning user" do
1128
+ # login_as users(:jdoe)
1129
+ # get "/profiles/jdoe"
1130
+ # assert_select ".username", :text => 'jdoe'
1131
+ # end
1132
+ # end
1133
+ #
1134
+ # @note Filtered module inclusions can also be applied to
1135
+ # individual examples that have matching metadata. Just like
1136
+ # Ruby's object model is that every object has a singleton class
1137
+ # which has only a single instance, RSpec's model is that every
1138
+ # example has a singleton example group containing just the one
1139
+ # example.
1140
+ #
1141
+ # @see #extend
1142
+ # @see #prepend
1143
+ def include(mod, *filters)
1144
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1145
+ @include_modules.append(mod, meta)
1146
+ configure_existing_groups(mod, meta, :safe_include)
1147
+ end
1148
+
1149
+ # Tells RSpec to extend example groups with `mod`. Methods defined in
1150
+ # `mod` are exposed to example groups (not examples). Use `filters` to
1151
+ # constrain the groups to extend.
1152
+ #
1153
+ # Similar to `include`, but behavior is added to example groups, which
1154
+ # are classes, rather than the examples, which are instances of those
1155
+ # classes.
1156
+ #
1157
+ # @example
1158
+ #
1159
+ # module UiHelpers
1160
+ # def run_in_browser
1161
+ # # ...
1162
+ # end
1163
+ # end
1164
+ #
1165
+ # RSpec.configure do |config|
1166
+ # config.extend(UiHelpers, :type => :request)
1167
+ # end
1168
+ #
1169
+ # describe "edit profile", :type => :request do
1170
+ # run_in_browser
1171
+ #
1172
+ # it "does stuff in the client" do
1173
+ # # ...
1174
+ # end
1175
+ # end
1176
+ #
1177
+ # @see #include
1178
+ # @see #prepend
1179
+ def extend(mod, *filters)
1180
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1181
+ @extend_modules.append(mod, meta)
1182
+ configure_existing_groups(mod, meta, :safe_extend)
1183
+ end
1184
+
1185
+ if RSpec::Support::RubyFeatures.module_prepends_supported?
1186
+ # Tells RSpec to prepend example groups with `mod`. Methods defined in
1187
+ # `mod` are exposed to examples (not example groups). Use `filters` to
1188
+ # constrain the groups in which to prepend the module.
1189
+ #
1190
+ # Similar to `include`, but module is included before the example group's class
1191
+ # in the ancestor chain.
1192
+ #
1193
+ # @example
1194
+ #
1195
+ # module OverrideMod
1196
+ # def override_me
1197
+ # "overridden"
1198
+ # end
1199
+ # end
1200
+ #
1201
+ # RSpec.configure do |config|
1202
+ # config.prepend(OverrideMod, :method => :prepend)
1203
+ # end
1204
+ #
1205
+ # describe "overriding example's class", :method => :prepend do
1206
+ # it "finds the user" do
1207
+ # self.class.class_eval do
1208
+ # def override_me
1209
+ # end
1210
+ # end
1211
+ # override_me # => "overridden"
1212
+ # # ...
1213
+ # end
1214
+ # end
1215
+ #
1216
+ # @see #include
1217
+ # @see #extend
1218
+ def prepend(mod, *filters)
1219
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1220
+ @prepend_modules.append(mod, meta)
1221
+ configure_existing_groups(mod, meta, :safe_prepend)
1222
+ end
1223
+ end
1224
+
1225
+ # @private
1226
+ #
1227
+ # Used internally to extend a group with modules using `include`, `prepend` and/or
1228
+ # `extend`.
1229
+ def configure_group(group)
1230
+ configure_group_with group, @include_modules, :safe_include
1231
+ configure_group_with group, @extend_modules, :safe_extend
1232
+ configure_group_with group, @prepend_modules, :safe_prepend
1233
+ end
1234
+
1235
+ # @private
1236
+ def configure_group_with(group, module_list, application_method)
1237
+ module_list.items_for(group.metadata).each do |mod|
1238
+ __send__(application_method, mod, group)
1239
+ end
1240
+ end
1241
+
1242
+ # @private
1243
+ def configure_existing_groups(mod, meta, application_method)
1244
+ RSpec.world.all_example_groups.each do |group|
1245
+ next unless meta.empty? || MetadataFilter.apply?(:any?, meta, group.metadata)
1246
+ __send__(application_method, mod, group)
1247
+ end
1248
+ end
1249
+
1250
+ # @private
1251
+ #
1252
+ # Used internally to extend the singleton class of a single example's
1253
+ # example group instance with modules using `include` and/or `extend`.
1254
+ def configure_example(example)
1255
+ singleton_group = example.example_group_instance.singleton_class
1256
+
1257
+ # We replace the metadata so that SharedExampleGroupModule#included
1258
+ # has access to the example's metadata[:location].
1259
+ singleton_group.with_replaced_metadata(example.metadata) do
1260
+ modules = @include_modules.items_for(example.metadata)
1261
+ modules.each do |mod|
1262
+ safe_include(mod, example.example_group_instance.singleton_class)
1263
+ end
1264
+
1265
+ MemoizedHelpers.define_helpers_on(singleton_group) unless modules.empty?
1266
+ end
1267
+ end
1268
+
1269
+ if RSpec::Support::RubyFeatures.module_prepends_supported?
1270
+ # @private
1271
+ def safe_prepend(mod, host)
1272
+ host.__send__(:prepend, mod) unless host < mod
1273
+ end
1274
+ end
1275
+
1276
+ # @private
1277
+ def requires=(paths)
1278
+ directories = ['lib', default_path].select { |p| File.directory? p }
1279
+ RSpec::Core::RubyProject.add_to_load_path(*directories)
1280
+ paths.each { |path| require path }
1281
+ @requires += paths
1282
+ end
1283
+
1284
+ # @private
1285
+ if RUBY_VERSION.to_f >= 1.9
1286
+ # @private
1287
+ def safe_include(mod, host)
1288
+ host.__send__(:include, mod) unless host < mod
1289
+ end
1290
+
1291
+ # @private
1292
+ def safe_extend(mod, host)
1293
+ host.extend(mod) unless host.singleton_class < mod
1294
+ end
1295
+ else # for 1.8.7
1296
+ # :nocov:
1297
+ # @private
1298
+ def safe_include(mod, host)
1299
+ host.__send__(:include, mod) unless host.included_modules.include?(mod)
1300
+ end
1301
+
1302
+ # @private
1303
+ def safe_extend(mod, host)
1304
+ host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
1305
+ end
1306
+ # :nocov:
1307
+ end
1308
+
1309
+ # @private
1310
+ def configure_mock_framework
1311
+ RSpec::Core::ExampleGroup.__send__(:include, mock_framework)
1312
+ conditionally_disable_mocks_monkey_patching
1313
+ end
1314
+
1315
+ # @private
1316
+ def configure_expectation_framework
1317
+ expectation_frameworks.each do |framework|
1318
+ RSpec::Core::ExampleGroup.__send__(:include, framework)
1319
+ end
1320
+ conditionally_disable_expectations_monkey_patching
1321
+ end
1322
+
1323
+ # @private
1324
+ def load_spec_files
1325
+ files_to_run.uniq.each do |f|
1326
+ file = File.expand_path(f)
1327
+ load file
1328
+ loaded_spec_files << file
1329
+ end
1330
+
1331
+ @spec_files_loaded = true
1332
+ end
1333
+
1334
+ # @private
1335
+ DEFAULT_FORMATTER = lambda { |string| string }
1336
+
1337
+ # Formats the docstring output using the block provided.
1338
+ #
1339
+ # @example
1340
+ # # This will strip the descriptions of both examples and example
1341
+ # # groups.
1342
+ # RSpec.configure do |config|
1343
+ # config.format_docstrings { |s| s.strip }
1344
+ # end
1345
+ def format_docstrings(&block)
1346
+ @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
1347
+ end
1348
+
1349
+ # @private
1350
+ def format_docstrings_block
1351
+ @format_docstrings_block ||= DEFAULT_FORMATTER
1352
+ end
1353
+
1354
+ # @private
1355
+ # @macro [attach] delegate_to_ordering_manager
1356
+ # @!method $1
1357
+ def self.delegate_to_ordering_manager(*methods)
1358
+ methods.each do |method|
1359
+ define_method method do |*args, &block|
1360
+ ordering_manager.__send__(method, *args, &block)
1361
+ end
1362
+ end
1363
+ end
1364
+
1365
+ # @macro delegate_to_ordering_manager
1366
+ #
1367
+ # Sets the seed value and sets the default global ordering to random.
1368
+ delegate_to_ordering_manager :seed=
1369
+
1370
+ # @macro delegate_to_ordering_manager
1371
+ # Seed for random ordering (default: generated randomly each run).
1372
+ #
1373
+ # When you run specs with `--order random`, RSpec generates a random seed
1374
+ # for the randomization and prints it to the `output_stream` (assuming
1375
+ # you're using RSpec's built-in formatters). If you discover an ordering
1376
+ # dependency (i.e. examples fail intermittently depending on order), set
1377
+ # this (on Configuration or on the command line with `--seed`) to run
1378
+ # using the same seed while you debug the issue.
1379
+ #
1380
+ # We recommend, actually, that you use the command line approach so you
1381
+ # don't accidentally leave the seed encoded.
1382
+ delegate_to_ordering_manager :seed
1383
+
1384
+ # @macro delegate_to_ordering_manager
1385
+ #
1386
+ # Sets the default global order and, if order is `'rand:<seed>'`, also
1387
+ # sets the seed.
1388
+ delegate_to_ordering_manager :order=
1389
+
1390
+ # @macro delegate_to_ordering_manager
1391
+ # Registers a named ordering strategy that can later be
1392
+ # used to order an example group's subgroups by adding
1393
+ # `:order => <name>` metadata to the example group.
1394
+ #
1395
+ # @param name [Symbol] The name of the ordering.
1396
+ # @yield Block that will order the given examples or example groups
1397
+ # @yieldparam list [Array<RSpec::Core::Example>,
1398
+ # Array<RSpec::Core::ExampleGroup>] The examples or groups to order
1399
+ # @yieldreturn [Array<RSpec::Core::Example>,
1400
+ # Array<RSpec::Core::ExampleGroup>] The re-ordered examples or groups
1401
+ #
1402
+ # @example
1403
+ # RSpec.configure do |rspec|
1404
+ # rspec.register_ordering :reverse do |list|
1405
+ # list.reverse
1406
+ # end
1407
+ # end
1408
+ #
1409
+ # describe MyClass, :order => :reverse do
1410
+ # # ...
1411
+ # end
1412
+ #
1413
+ # @note Pass the symbol `:global` to set the ordering strategy that
1414
+ # will be used to order the top-level example groups and any example
1415
+ # groups that do not have declared `:order` metadata.
1416
+ delegate_to_ordering_manager :register_ordering
1417
+
1418
+ # @private
1419
+ delegate_to_ordering_manager :seed_used?, :ordering_registry
1420
+
1421
+ # Set Ruby warnings on or off.
1422
+ def warnings=(value)
1423
+ $VERBOSE = !!value
1424
+ end
1425
+
1426
+ # @return [Boolean] Whether or not ruby warnings are enabled.
1427
+ def warnings?
1428
+ $VERBOSE
1429
+ end
1430
+
1431
+ # Exposes the current running example via the named
1432
+ # helper method. RSpec 2.x exposed this via `example`,
1433
+ # but in RSpec 3.0, the example is instead exposed via
1434
+ # an arg yielded to `it`, `before`, `let`, etc. However,
1435
+ # some extension gems (such as Capybara) depend on the
1436
+ # RSpec 2.x's `example` method, so this config option
1437
+ # can be used to maintain compatibility.
1438
+ #
1439
+ # @param method_name [Symbol] the name of the helper method
1440
+ #
1441
+ # @example
1442
+ #
1443
+ # RSpec.configure do |rspec|
1444
+ # rspec.expose_current_running_example_as :example
1445
+ # end
1446
+ #
1447
+ # describe MyClass do
1448
+ # before do
1449
+ # # `example` can be used here because of the above config.
1450
+ # do_something if example.metadata[:type] == "foo"
1451
+ # end
1452
+ # end
1453
+ def expose_current_running_example_as(method_name)
1454
+ ExposeCurrentExample.module_exec do
1455
+ extend RSpec::SharedContext
1456
+ let(method_name) { |ex| ex }
1457
+ end
1458
+
1459
+ include ExposeCurrentExample
1460
+ end
1461
+
1462
+ # @private
1463
+ module ExposeCurrentExample; end
1464
+
1465
+ # Turns deprecation warnings into errors, in order to surface
1466
+ # the full backtrace of the call site. This can be useful when
1467
+ # you need more context to address a deprecation than the
1468
+ # single-line call site normally provided.
1469
+ #
1470
+ # @example
1471
+ #
1472
+ # RSpec.configure do |rspec|
1473
+ # rspec.raise_errors_for_deprecations!
1474
+ # end
1475
+ def raise_errors_for_deprecations!
1476
+ self.deprecation_stream = Formatters::DeprecationFormatter::RaiseErrorStream.new
1477
+ end
1478
+
1479
+ # Enables zero monkey patching mode for RSpec. It removes monkey
1480
+ # patching of the top-level DSL methods (`describe`,
1481
+ # `shared_examples_for`, etc) onto `main` and `Module`, instead
1482
+ # requiring you to prefix these methods with `RSpec.`. It enables
1483
+ # expect-only syntax for rspec-mocks and rspec-expectations. It
1484
+ # simply disables monkey patching on whatever pieces of RSpec
1485
+ # the user is using.
1486
+ #
1487
+ # @note It configures rspec-mocks and rspec-expectations only
1488
+ # if the user is using those (either explicitly or implicitly
1489
+ # by not setting `mock_with` or `expect_with` to anything else).
1490
+ #
1491
+ # @note If the user uses this options with `mock_with :mocha`
1492
+ # (or similiar) they will still have monkey patching active
1493
+ # in their test environment from mocha.
1494
+ #
1495
+ # @example
1496
+ #
1497
+ # # It disables all monkey patching.
1498
+ # RSpec.configure do |config|
1499
+ # config.disable_monkey_patching!
1500
+ # end
1501
+ #
1502
+ # # Is an equivalent to
1503
+ # RSpec.configure do |config|
1504
+ # config.expose_dsl_globally = false
1505
+ #
1506
+ # config.mock_with :rspec do |mocks|
1507
+ # mocks.syntax = :expect
1508
+ # mocks.patch_marshal_to_support_partial_doubles = false
1509
+ # end
1510
+ #
1511
+ # config.mock_with :rspec do |expectations|
1512
+ # expectations.syntax = :expect
1513
+ # end
1514
+ # end
1515
+ def disable_monkey_patching!
1516
+ self.expose_dsl_globally = false
1517
+ self.disable_monkey_patching = true
1518
+ conditionally_disable_mocks_monkey_patching
1519
+ conditionally_disable_expectations_monkey_patching
1520
+ end
1521
+
1522
+ # @private
1523
+ attr_accessor :disable_monkey_patching
1524
+
1525
+ # Defines a callback that can assign derived metadata values.
1526
+ #
1527
+ # @param filters [Array<Symbol>, Hash] metadata filters that determine
1528
+ # which example or group metadata hashes the callback will be triggered
1529
+ # for. If none are given, the callback will be run against the metadata
1530
+ # hashes of all groups and examples.
1531
+ # @yieldparam metadata [Hash] original metadata hash from an example or
1532
+ # group. Mutate this in your block as needed.
1533
+ #
1534
+ # @example
1535
+ # RSpec.configure do |config|
1536
+ # # Tag all groups and examples in the spec/unit directory with
1537
+ # # :type => :unit
1538
+ # config.define_derived_metadata(:file_path => %r{/spec/unit/}) do |metadata|
1539
+ # metadata[:type] = :unit
1540
+ # end
1541
+ # end
1542
+ def define_derived_metadata(*filters, &block)
1543
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1544
+ @derived_metadata_blocks.append(block, meta)
1545
+ end
1546
+
1547
+ # @private
1548
+ def apply_derived_metadata_to(metadata)
1549
+ @derived_metadata_blocks.items_for(metadata).each do |block|
1550
+ block.call(metadata)
1551
+ end
1552
+ end
1553
+
1554
+ # Defines a `before` hook. See {Hooks#before} for full docs.
1555
+ #
1556
+ # This method differs from {Hooks#before} in only one way: it supports
1557
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once before
1558
+ # the first example of the entire suite is executed.
1559
+ #
1560
+ # @see #prepend_before
1561
+ # @see #after
1562
+ # @see #append_after
1563
+ def before(*args, &block)
1564
+ handle_suite_hook(args, @before_suite_hooks, :push,
1565
+ Hooks::BeforeHook, block) || super(*args, &block)
1566
+ end
1567
+ alias_method :append_before, :before
1568
+
1569
+ # Adds `block` to the start of the list of `before` blocks in the same
1570
+ # scope (`:example`, `:context`, or `:suite`), in contrast to {#before},
1571
+ # which adds the hook to the end of the list.
1572
+ #
1573
+ # See {Hooks#before} for full `before` hook docs.
1574
+ #
1575
+ # This method differs from {Hooks#prepend_before} in only one way: it supports
1576
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once before
1577
+ # the first example of the entire suite is executed.
1578
+ #
1579
+ # @see #before
1580
+ # @see #after
1581
+ # @see #append_after
1582
+ def prepend_before(*args, &block)
1583
+ handle_suite_hook(args, @before_suite_hooks, :unshift,
1584
+ Hooks::BeforeHook, block) || super(*args, &block)
1585
+ end
1586
+
1587
+ # Defines a `after` hook. See {Hooks#after} for full docs.
1588
+ #
1589
+ # This method differs from {Hooks#after} in only one way: it supports
1590
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once after
1591
+ # the last example of the entire suite is executed.
1592
+ #
1593
+ # @see #append_after
1594
+ # @see #before
1595
+ # @see #prepend_before
1596
+ def after(*args, &block)
1597
+ handle_suite_hook(args, @after_suite_hooks, :unshift,
1598
+ Hooks::AfterHook, block) || super(*args, &block)
1599
+ end
1600
+ alias_method :prepend_after, :after
1601
+
1602
+ # Adds `block` to the end of the list of `after` blocks in the same
1603
+ # scope (`:example`, `:context`, or `:suite`), in contrast to {#after},
1604
+ # which adds the hook to the start of the list.
1605
+ #
1606
+ # See {Hooks#after} for full `after` hook docs.
1607
+ #
1608
+ # This method differs from {Hooks#append_after} in only one way: it supports
1609
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once after
1610
+ # the last example of the entire suite is executed.
1611
+ #
1612
+ # @see #append_after
1613
+ # @see #before
1614
+ # @see #prepend_before
1615
+ def append_after(*args, &block)
1616
+ handle_suite_hook(args, @after_suite_hooks, :push,
1617
+ Hooks::AfterHook, block) || super(*args, &block)
1618
+ end
1619
+
1620
+ # @private
1621
+ def with_suite_hooks
1622
+ return yield if dry_run?
1623
+
1624
+ hook_context = SuiteHookContext.new
1625
+ begin
1626
+ run_hooks_with(@before_suite_hooks, hook_context)
1627
+ yield
1628
+ ensure
1629
+ run_hooks_with(@after_suite_hooks, hook_context)
1630
+ end
1631
+ end
1632
+
1633
+ # @private
1634
+ # Holds the various registered hooks. Here we use a FilterableItemRepository
1635
+ # implementation that is specifically optimized for the read/write patterns
1636
+ # of the config object.
1637
+ def hooks
1638
+ @hooks ||= HookCollections.new(self, FilterableItemRepository::QueryOptimized)
1639
+ end
1640
+
1641
+ private
1642
+
1643
+ def handle_suite_hook(args, collection, append_or_prepend, hook_type, block)
1644
+ scope, meta = *args
1645
+ return nil unless scope == :suite
1646
+
1647
+ if meta
1648
+ # TODO: in RSpec 4, consider raising an error here.
1649
+ # We warn only for backwards compatibility.
1650
+ RSpec.warn_with "WARNING: `:suite` hooks do not support metadata since " \
1651
+ "they apply to the suite as a whole rather than " \
1652
+ "any individual example or example group that has metadata. " \
1653
+ "The metadata you have provided (#{meta.inspect}) will be ignored."
1654
+ end
1655
+
1656
+ collection.__send__(append_or_prepend, hook_type.new(block, {}))
1657
+ end
1658
+
1659
+ def run_hooks_with(hooks, hook_context)
1660
+ hooks.each { |h| h.run(hook_context) }
1661
+ end
1662
+
1663
+ def get_files_to_run(paths)
1664
+ files = FlatMap.flat_map(paths_to_check(paths)) do |path|
1665
+ path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
1666
+ File.directory?(path) ? gather_directories(path) : extract_location(path)
1667
+ end.sort.uniq
1668
+
1669
+ return files unless only_failures?
1670
+ relative_files = files.map { |f| Metadata.relative_path(File.expand_path f) }
1671
+ intersection = (relative_files & spec_files_with_failures.to_a)
1672
+ intersection.empty? ? files : intersection
1673
+ end
1674
+
1675
+ def paths_to_check(paths)
1676
+ return paths if pattern_might_load_specs_from_vendored_dirs?
1677
+ paths + [Dir.getwd]
1678
+ end
1679
+
1680
+ def pattern_might_load_specs_from_vendored_dirs?
1681
+ pattern.split(File::SEPARATOR).first.include?('**')
1682
+ end
1683
+
1684
+ def gather_directories(path)
1685
+ include_files = get_matching_files(path, pattern)
1686
+ exclude_files = get_matching_files(path, exclude_pattern)
1687
+ (include_files - exclude_files).sort.uniq
1688
+ end
1689
+
1690
+ def get_matching_files(path, pattern)
1691
+ Dir[file_glob_from(path, pattern)].map { |file| File.expand_path(file) }
1692
+ end
1693
+
1694
+ def file_glob_from(path, pattern)
1695
+ stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}"
1696
+ return stripped if pattern =~ /^(\.\/)?#{Regexp.escape path}/ || absolute_pattern?(pattern)
1697
+ File.join(path, stripped)
1698
+ end
1699
+
1700
+ if RSpec::Support::OS.windows?
1701
+ # :nocov:
1702
+ def absolute_pattern?(pattern)
1703
+ pattern =~ /\A[A-Z]:\\/ || windows_absolute_network_path?(pattern)
1704
+ end
1705
+
1706
+ def windows_absolute_network_path?(pattern)
1707
+ return false unless ::File::ALT_SEPARATOR
1708
+ pattern.start_with?(::File::ALT_SEPARATOR + ::File::ALT_SEPARATOR)
1709
+ end
1710
+ # :nocov:
1711
+ else
1712
+ def absolute_pattern?(pattern)
1713
+ pattern.start_with?(File::Separator)
1714
+ end
1715
+ end
1716
+
1717
+ # @private
1718
+ ON_SQUARE_BRACKETS = /[\[\]]/
1719
+
1720
+ def extract_location(path)
1721
+ match = /^(.*?)((?:\:\d+)+)$/.match(path)
1722
+
1723
+ if match
1724
+ captures = match.captures
1725
+ path, lines = captures[0], captures[1][1..-1].split(":").map { |n| n.to_i }
1726
+ filter_manager.add_location path, lines
1727
+ else
1728
+ path, scoped_ids = path.split(ON_SQUARE_BRACKETS)
1729
+ filter_manager.add_ids(path, scoped_ids.split(/\s*,\s*/)) if scoped_ids
1730
+ end
1731
+
1732
+ return [] if path == default_path
1733
+ path
1734
+ end
1735
+
1736
+ def command
1737
+ $0.split(File::SEPARATOR).last
1738
+ end
1739
+
1740
+ def value_for(key)
1741
+ @preferred_options.fetch(key) { yield }
1742
+ end
1743
+
1744
+ def define_built_in_hooks
1745
+ around(:example, :aggregate_failures => true) do |procsy|
1746
+ begin
1747
+ aggregate_failures(nil, :hide_backtrace => true, &procsy)
1748
+ rescue Exception => exception
1749
+ procsy.example.set_aggregate_failures_exception(exception)
1750
+ end
1751
+ end
1752
+ end
1753
+
1754
+ def assert_no_example_groups_defined(config_option)
1755
+ return unless RSpec.world.example_groups.any?
1756
+
1757
+ raise MustBeConfiguredBeforeExampleGroupsError.new(
1758
+ "RSpec's #{config_option} configuration option must be configured before " \
1759
+ "any example groups are defined, but you have already defined a group."
1760
+ )
1761
+ end
1762
+
1763
+ def output_to_tty?(output=output_stream)
1764
+ tty? || (output.respond_to?(:tty?) && output.tty?)
1765
+ end
1766
+
1767
+ def conditionally_disable_mocks_monkey_patching
1768
+ return unless disable_monkey_patching && rspec_mocks_loaded?
1769
+
1770
+ RSpec::Mocks.configuration.tap do |config|
1771
+ config.syntax = :expect
1772
+ config.patch_marshal_to_support_partial_doubles = false
1773
+ end
1774
+ end
1775
+
1776
+ def conditionally_disable_expectations_monkey_patching
1777
+ return unless disable_monkey_patching && rspec_expectations_loaded?
1778
+
1779
+ RSpec::Expectations.configuration.syntax = :expect
1780
+ end
1781
+
1782
+ def rspec_mocks_loaded?
1783
+ defined?(RSpec::Mocks.configuration)
1784
+ end
1785
+
1786
+ def rspec_expectations_loaded?
1787
+ defined?(RSpec::Expectations.configuration)
1788
+ end
1789
+
1790
+ def update_pattern_attr(name, value)
1791
+ if @spec_files_loaded
1792
+ RSpec.warning "Configuring `#{name}` to #{value} has no effect since " \
1793
+ "RSpec has already loaded the spec files."
1794
+ end
1795
+
1796
+ instance_variable_set(:"@#{name}", value)
1797
+ @files_to_run = nil
1798
+ end
1799
+
1800
+ def clear_values_derived_from_example_status_persistence_file_path
1801
+ @last_run_statuses = nil
1802
+ @spec_files_with_failures = nil
1803
+ end
1804
+ end
1805
+ # rubocop:enable Style/ClassLength
1806
+ end
1807
+ end