guesswhat 0.1.0

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