sublimetheme 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +230 -0
  9. data/Rakefile +8 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +7 -0
  12. data/lib/sublimetheme.rb +6832 -0
  13. data/lib/sublimetheme/version.rb +3 -0
  14. data/path/bin/htmldiff +25 -0
  15. data/path/bin/htmldiff.bat +6 -0
  16. data/path/bin/ldiff +25 -0
  17. data/path/bin/ldiff.bat +6 -0
  18. data/path/bin/rspec +23 -0
  19. data/path/bin/rspec.bat +6 -0
  20. data/path/cache/diff-lcs-1.2.5.gem +0 -0
  21. data/path/cache/rspec-3.3.0.gem +0 -0
  22. data/path/cache/rspec-core-3.3.2.gem +0 -0
  23. data/path/cache/rspec-expectations-3.3.1.gem +0 -0
  24. data/path/cache/rspec-mocks-3.3.2.gem +0 -0
  25. data/path/cache/rspec-support-3.3.0.gem +0 -0
  26. data/path/gems/diff-lcs-1.2.5/.autotest +3 -0
  27. data/path/gems/diff-lcs-1.2.5/.gemtest +0 -0
  28. data/path/gems/diff-lcs-1.2.5/.hoerc +2 -0
  29. data/path/gems/diff-lcs-1.2.5/.rspec +2 -0
  30. data/path/gems/diff-lcs-1.2.5/.travis.yml +22 -0
  31. data/path/gems/diff-lcs-1.2.5/Contributing.rdoc +64 -0
  32. data/path/gems/diff-lcs-1.2.5/Gemfile +20 -0
  33. data/path/gems/diff-lcs-1.2.5/History.rdoc +152 -0
  34. data/path/gems/diff-lcs-1.2.5/License.rdoc +39 -0
  35. data/path/gems/diff-lcs-1.2.5/Manifest.txt +38 -0
  36. data/path/gems/diff-lcs-1.2.5/README.rdoc +85 -0
  37. data/path/gems/diff-lcs-1.2.5/Rakefile +41 -0
  38. data/path/gems/diff-lcs-1.2.5/autotest/discover.rb +1 -0
  39. data/path/gems/diff-lcs-1.2.5/bin/htmldiff +32 -0
  40. data/path/gems/diff-lcs-1.2.5/bin/ldiff +6 -0
  41. data/path/gems/diff-lcs-1.2.5/docs/COPYING.txt +339 -0
  42. data/path/gems/diff-lcs-1.2.5/docs/artistic.txt +127 -0
  43. data/path/gems/diff-lcs-1.2.5/lib/diff-lcs.rb +3 -0
  44. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs.rb +805 -0
  45. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/array.rb +7 -0
  46. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/block.rb +37 -0
  47. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/callbacks.rb +322 -0
  48. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/change.rb +177 -0
  49. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/htmldiff.rb +149 -0
  50. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/hunk.rb +276 -0
  51. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/internals.rb +301 -0
  52. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/ldiff.rb +195 -0
  53. data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/string.rb +5 -0
  54. data/path/gems/diff-lcs-1.2.5/spec/change_spec.rb +65 -0
  55. data/path/gems/diff-lcs-1.2.5/spec/diff_spec.rb +47 -0
  56. data/path/gems/diff-lcs-1.2.5/spec/hunk_spec.rb +72 -0
  57. data/path/gems/diff-lcs-1.2.5/spec/issues_spec.rb +24 -0
  58. data/path/gems/diff-lcs-1.2.5/spec/lcs_spec.rb +54 -0
  59. data/path/gems/diff-lcs-1.2.5/spec/patch_spec.rb +414 -0
  60. data/path/gems/diff-lcs-1.2.5/spec/sdiff_spec.rb +214 -0
  61. data/path/gems/diff-lcs-1.2.5/spec/spec_helper.rb +290 -0
  62. data/path/gems/diff-lcs-1.2.5/spec/traverse_balanced_spec.rb +310 -0
  63. data/path/gems/diff-lcs-1.2.5/spec/traverse_sequences_spec.rb +139 -0
  64. data/path/gems/rspec-3.3.0/License.txt +24 -0
  65. data/path/gems/rspec-3.3.0/README.md +34 -0
  66. data/path/gems/rspec-3.3.0/lib/rspec.rb +3 -0
  67. data/path/gems/rspec-3.3.0/lib/rspec/version.rb +5 -0
  68. data/path/gems/rspec-core-3.3.2/.document +5 -0
  69. data/path/gems/rspec-core-3.3.2/.yardopts +8 -0
  70. data/path/gems/rspec-core-3.3.2/Changelog.md +1856 -0
  71. data/path/gems/rspec-core-3.3.2/License.txt +25 -0
  72. data/path/gems/rspec-core-3.3.2/README.md +369 -0
  73. data/path/gems/rspec-core-3.3.2/exe/rspec +4 -0
  74. data/path/gems/rspec-core-3.3.2/lib/rspec/autorun.rb +3 -0
  75. data/path/gems/rspec-core-3.3.2/lib/rspec/core.rb +181 -0
  76. data/path/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb +64 -0
  77. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb +66 -0
  78. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb +130 -0
  79. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb +139 -0
  80. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb +61 -0
  81. data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb +39 -0
  82. data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb +1807 -0
  83. data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb +191 -0
  84. data/path/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb +111 -0
  85. data/path/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb +96 -0
  86. data/path/gems/rspec-core-3.3.2/lib/rspec/core/example.rb +573 -0
  87. data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb +796 -0
  88. data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb +235 -0
  89. data/path/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb +231 -0
  90. data/path/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb +20 -0
  91. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb +254 -0
  92. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb +70 -0
  93. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb +77 -0
  94. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb +68 -0
  95. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb +115 -0
  96. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb +65 -0
  97. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
  98. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb +70 -0
  99. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb +393 -0
  100. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
  101. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb +109 -0
  102. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb +151 -0
  103. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb +415 -0
  104. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/json_formatter.rb +96 -0
  105. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/profile_formatter.rb +68 -0
  106. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/progress_formatter.rb +28 -0
  107. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/protocol.rb +172 -0
  108. data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/snippet_extractor.rb +116 -0
  109. data/path/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb +638 -0
  110. data/path/gems/rspec-core-3.3.2/lib/rspec/core/memoized_helpers.rb +532 -0
  111. data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata.rb +490 -0
  112. data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata_filter.rb +235 -0
  113. data/path/gems/rspec-core-3.3.2/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
  114. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
  115. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
  116. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/null.rb +14 -0
  117. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rr.rb +31 -0
  118. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
  119. data/path/gems/rspec-core-3.3.2/lib/rspec/core/mutex.rb +63 -0
  120. data/path/gems/rspec-core-3.3.2/lib/rspec/core/notifications.rb +498 -0
  121. data/path/gems/rspec-core-3.3.2/lib/rspec/core/option_parser.rb +301 -0
  122. data/path/gems/rspec-core-3.3.2/lib/rspec/core/ordering.rb +158 -0
  123. data/path/gems/rspec-core-3.3.2/lib/rspec/core/pending.rb +165 -0
  124. data/path/gems/rspec-core-3.3.2/lib/rspec/core/profiler.rb +32 -0
  125. data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer.rb +48 -0
  126. data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/.rspec +2 -0
  127. data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/spec/spec_helper.rb +96 -0
  128. data/path/gems/rspec-core-3.3.2/lib/rspec/core/rake_task.rb +158 -0
  129. data/path/gems/rspec-core-3.3.2/lib/rspec/core/reentrant_mutex.rb +52 -0
  130. data/path/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb +220 -0
  131. data/path/gems/rspec-core-3.3.2/lib/rspec/core/ruby_project.rb +53 -0
  132. data/path/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb +179 -0
  133. data/path/gems/rspec-core-3.3.2/lib/rspec/core/sandbox.rb +37 -0
  134. data/path/gems/rspec-core-3.3.2/lib/rspec/core/set.rb +49 -0
  135. data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_context.rb +55 -0
  136. data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb +210 -0
  137. data/path/gems/rspec-core-3.3.2/lib/rspec/core/shell_escape.rb +49 -0
  138. data/path/gems/rspec-core-3.3.2/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
  139. data/path/gems/rspec-core-3.3.2/lib/rspec/core/version.rb +9 -0
  140. data/path/gems/rspec-core-3.3.2/lib/rspec/core/warnings.rb +40 -0
  141. data/path/gems/rspec-core-3.3.2/lib/rspec/core/world.rb +178 -0
  142. data/path/gems/rspec-expectations-3.3.1/.document +5 -0
  143. data/path/gems/rspec-expectations-3.3.1/.yardopts +6 -0
  144. data/path/gems/rspec-expectations-3.3.1/Changelog.md +953 -0
  145. data/path/gems/rspec-expectations-3.3.1/License.txt +24 -0
  146. data/path/gems/rspec-expectations-3.3.1/README.md +289 -0
  147. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations.rb +81 -0
  148. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/configuration.rb +164 -0
  149. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb +113 -0
  150. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/fail_with.rb +31 -0
  151. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/failure_aggregator.rb +194 -0
  152. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb +170 -0
  153. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/minitest_integration.rb +31 -0
  154. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/syntax.rb +132 -0
  155. data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/version.rb +8 -0
  156. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers.rb +1009 -0
  157. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/aliased_matcher.rb +116 -0
  158. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in.rb +52 -0
  159. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/all.rb +85 -0
  160. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/base_matcher.rb +181 -0
  161. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be.rb +285 -0
  162. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_between.rb +77 -0
  163. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_instance_of.rb +22 -0
  164. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_kind_of.rb +16 -0
  165. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_within.rb +72 -0
  166. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/change.rb +337 -0
  167. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/compound.rb +293 -0
  168. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/contain_exactly.rb +253 -0
  169. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/cover.rb +24 -0
  170. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eq.rb +40 -0
  171. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eql.rb +34 -0
  172. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/equal.rb +81 -0
  173. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/exist.rb +86 -0
  174. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/has.rb +103 -0
  175. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  176. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/include.rb +130 -0
  177. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/match.rb +37 -0
  178. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/operators.rb +128 -0
  179. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/output.rb +200 -0
  180. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/raise_error.rb +216 -0
  181. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/respond_to.rb +90 -0
  182. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/satisfy.rb +37 -0
  183. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  184. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
  185. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/yield.rb +418 -0
  186. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/composable.rb +184 -0
  187. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/dsl.rb +453 -0
  188. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/english_phrasing.rb +42 -0
  189. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +73 -0
  190. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/fail_matchers.rb +42 -0
  191. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/generated_descriptions.rb +42 -0
  192. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_delegator.rb +35 -0
  193. data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_protocol.rb +99 -0
  194. data/path/gems/rspec-mocks-3.3.2/.document +5 -0
  195. data/path/gems/rspec-mocks-3.3.2/.yardopts +6 -0
  196. data/path/gems/rspec-mocks-3.3.2/Changelog.md +965 -0
  197. data/path/gems/rspec-mocks-3.3.2/License.txt +24 -0
  198. data/path/gems/rspec-mocks-3.3.2/README.md +430 -0
  199. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks.rb +126 -0
  200. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance.rb +11 -0
  201. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/chain.rb +110 -0
  202. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
  203. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expect_chain_chain.rb +35 -0
  204. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expectation_chain.rb +48 -0
  205. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
  206. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/proxy.rb +116 -0
  207. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/recorder.rb +264 -0
  208. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain.rb +46 -0
  209. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain_chain.rb +27 -0
  210. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_list_matcher.rb +100 -0
  211. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_matchers.rb +320 -0
  212. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/configuration.rb +188 -0
  213. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/error_generator.rb +362 -0
  214. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/example_methods.rb +421 -0
  215. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/instance_method_stasher.rb +135 -0
  216. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/marshal_extension.rb +41 -0
  217. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
  218. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/have_received.rb +116 -0
  219. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive.rb +130 -0
  220. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_message_chain.rb +80 -0
  221. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_messages.rb +75 -0
  222. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_chain.rb +87 -0
  223. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_expectation.rb +717 -0
  224. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_double.rb +287 -0
  225. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_reference.rb +192 -0
  226. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutate_const.rb +335 -0
  227. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutex.rb +73 -0
  228. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/object_reference.rb +149 -0
  229. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/order_group.rb +81 -0
  230. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/proxy.rb +439 -0
  231. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/reentrant_mutex.rb +53 -0
  232. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/space.rb +238 -0
  233. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/standalone.rb +3 -0
  234. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/syntax.rb +325 -0
  235. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/targets.rb +97 -0
  236. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/test_double.rb +170 -0
  237. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_double.rb +129 -0
  238. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_message_expecation.rb +54 -0
  239. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_proxy.rb +213 -0
  240. data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/version.rb +9 -0
  241. data/path/gems/rspec-support-3.3.0/Changelog.md +125 -0
  242. data/path/gems/rspec-support-3.3.0/LICENSE.txt +22 -0
  243. data/path/gems/rspec-support-3.3.0/README.md +26 -0
  244. data/path/gems/rspec-support-3.3.0/lib/rspec/support.rb +111 -0
  245. data/path/gems/rspec-support-3.3.0/lib/rspec/support/caller_filter.rb +83 -0
  246. data/path/gems/rspec-support-3.3.0/lib/rspec/support/differ.rb +215 -0
  247. data/path/gems/rspec-support-3.3.0/lib/rspec/support/directory_maker.rb +63 -0
  248. data/path/gems/rspec-support-3.3.0/lib/rspec/support/encoded_string.rb +155 -0
  249. data/path/gems/rspec-support-3.3.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
  250. data/path/gems/rspec-support-3.3.0/lib/rspec/support/hunk_generator.rb +47 -0
  251. data/path/gems/rspec-support-3.3.0/lib/rspec/support/matcher_definition.rb +42 -0
  252. data/path/gems/rspec-support-3.3.0/lib/rspec/support/method_signature_verifier.rb +273 -0
  253. data/path/gems/rspec-support-3.3.0/lib/rspec/support/object_formatter.rb +93 -0
  254. data/path/gems/rspec-support-3.3.0/lib/rspec/support/recursive_const_methods.rb +76 -0
  255. data/path/gems/rspec-support-3.3.0/lib/rspec/support/ruby_features.rb +118 -0
  256. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec.rb +81 -0
  257. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
  258. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/formatting_support.rb +9 -0
  259. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/in_sub_process.rb +52 -0
  260. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/library_wide_checks.rb +145 -0
  261. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/shell_out.rb +71 -0
  262. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
  263. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/string_matcher.rb +46 -0
  264. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_directory.rb +9 -0
  265. data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
  266. data/path/gems/rspec-support-3.3.0/lib/rspec/support/version.rb +7 -0
  267. data/path/gems/rspec-support-3.3.0/lib/rspec/support/version_checker.rb +53 -0
  268. data/path/gems/rspec-support-3.3.0/lib/rspec/support/warnings.rb +39 -0
  269. data/path/specifications/diff-lcs-1.2.5.gemspec +68 -0
  270. data/path/specifications/rspec-3.3.0.gemspec +42 -0
  271. data/path/specifications/rspec-core-3.3.2.gemspec +68 -0
  272. data/path/specifications/rspec-expectations-3.3.1.gemspec +50 -0
  273. data/path/specifications/rspec-mocks-3.3.2.gemspec +53 -0
  274. data/path/specifications/rspec-support-3.3.0.gemspec +38 -0
  275. data/sublimetheme.gemspec +32 -0
  276. metadata +363 -0
@@ -0,0 +1,191 @@
1
+ require 'erb'
2
+ require 'shellwords'
3
+
4
+ module RSpec
5
+ module Core
6
+ # Responsible for utilizing externally provided configuration options,
7
+ # whether via the command line, `.rspec`, `~/.rspec`, `.rspec-local`
8
+ # or a custom options file.
9
+ class ConfigurationOptions
10
+ # @param args [Array<String>] command line arguments
11
+ def initialize(args)
12
+ @args = args.dup
13
+ organize_options
14
+ end
15
+
16
+ # Updates the provided {Configuration} instance based on the provided
17
+ # external configuration options.
18
+ #
19
+ # @param config [Configuration] the configuration instance to update
20
+ def configure(config)
21
+ process_options_into config
22
+ configure_filter_manager config.filter_manager
23
+ load_formatters_into config
24
+ end
25
+
26
+ # @api private
27
+ # Updates the provided {FilterManager} based on the filter options.
28
+ # @param filter_manager [FilterManager] instance to update
29
+ def configure_filter_manager(filter_manager)
30
+ @filter_manager_options.each do |command, value|
31
+ filter_manager.__send__ command, value
32
+ end
33
+ end
34
+
35
+ # @return [Hash] the final merged options, drawn from all external sources
36
+ attr_reader :options
37
+
38
+ private
39
+
40
+ def organize_options
41
+ @filter_manager_options = []
42
+
43
+ @options = (file_options << command_line_options << env_options).each do |opts|
44
+ @filter_manager_options << [:include, opts.delete(:inclusion_filter)] if opts.key?(:inclusion_filter)
45
+ @filter_manager_options << [:exclude, opts.delete(:exclusion_filter)] if opts.key?(:exclusion_filter)
46
+ end
47
+
48
+ @options = @options.inject(:libs => [], :requires => []) do |hash, opts|
49
+ hash.merge(opts) do |key, oldval, newval|
50
+ [:libs, :requires].include?(key) ? oldval + newval : newval
51
+ end
52
+ end
53
+ end
54
+
55
+ UNFORCED_OPTIONS = Set.new([
56
+ :requires, :profile, :drb, :libs, :files_or_directories_to_run,
57
+ :full_description, :full_backtrace, :tty
58
+ ])
59
+
60
+ UNPROCESSABLE_OPTIONS = Set.new([:formatters])
61
+
62
+ def force?(key)
63
+ !UNFORCED_OPTIONS.include?(key)
64
+ end
65
+
66
+ def order(keys)
67
+ OPTIONS_ORDER.reverse.each do |key|
68
+ keys.unshift(key) if keys.delete(key)
69
+ end
70
+ keys
71
+ end
72
+
73
+ OPTIONS_ORDER = [
74
+ # It's important to set this before anything that might issue a
75
+ # deprecation (or otherwise access the reporter).
76
+ :deprecation_stream,
77
+
78
+ # load paths depend on nothing, but must be set before `requires`
79
+ # to support load-path-relative requires.
80
+ :libs,
81
+
82
+ # `files_or_directories_to_run` uses `default_path` so it must be
83
+ # set before it.
84
+ :default_path, :only_failures,
85
+
86
+ # These must be set before `requires` to support checking
87
+ # `config.files_to_run` from within `spec_helper.rb` when a
88
+ # `-rspec_helper` option is used.
89
+ :files_or_directories_to_run, :pattern, :exclude_pattern,
90
+
91
+ # Necessary so that the `--seed` option is applied before requires,
92
+ # in case required files do something with the provided seed.
93
+ # (such as seed global randomization with it).
94
+ :order,
95
+
96
+ # In general, we want to require the specified files as early as
97
+ # possible. The `--require` option is specifically intended to allow
98
+ # early requires. For later requires, they can just put the require in
99
+ # their spec files, but `--require` provides a unique opportunity for
100
+ # users to instruct RSpec to load an extension file early for maximum
101
+ # flexibility.
102
+ :requires
103
+ ]
104
+
105
+ def process_options_into(config)
106
+ opts = options.reject { |k, _| UNPROCESSABLE_OPTIONS.include? k }
107
+
108
+ order(opts.keys).each do |key|
109
+ force?(key) ? config.force(key => opts[key]) : config.__send__("#{key}=", opts[key])
110
+ end
111
+ end
112
+
113
+ def load_formatters_into(config)
114
+ options[:formatters].each { |pair| config.add_formatter(*pair) } if options[:formatters]
115
+ end
116
+
117
+ def file_options
118
+ custom_options_file ? [custom_options] : [global_options, project_options, local_options]
119
+ end
120
+
121
+ def env_options
122
+ return {} unless ENV['SPEC_OPTS']
123
+
124
+ parse_args_ignoring_files_or_dirs_to_run(
125
+ Shellwords.split(ENV["SPEC_OPTS"]),
126
+ "ENV['SPEC_OPTS']"
127
+ )
128
+ end
129
+
130
+ def command_line_options
131
+ @command_line_options ||= Parser.parse(@args)
132
+ end
133
+
134
+ def custom_options
135
+ options_from(custom_options_file)
136
+ end
137
+
138
+ def local_options
139
+ @local_options ||= options_from(local_options_file)
140
+ end
141
+
142
+ def project_options
143
+ @project_options ||= options_from(project_options_file)
144
+ end
145
+
146
+ def global_options
147
+ @global_options ||= options_from(global_options_file)
148
+ end
149
+
150
+ def options_from(path)
151
+ args = args_from_options_file(path)
152
+ parse_args_ignoring_files_or_dirs_to_run(args, path)
153
+ end
154
+
155
+ def parse_args_ignoring_files_or_dirs_to_run(args, source)
156
+ options = Parser.parse(args, source)
157
+ options.delete(:files_or_directories_to_run)
158
+ options
159
+ end
160
+
161
+ def args_from_options_file(path)
162
+ return [] unless path && File.exist?(path)
163
+ config_string = options_file_as_erb_string(path)
164
+ FlatMap.flat_map(config_string.split(/\n+/), &:shellsplit)
165
+ end
166
+
167
+ def options_file_as_erb_string(path)
168
+ ERB.new(File.read(path), nil, '-').result(binding)
169
+ end
170
+
171
+ def custom_options_file
172
+ command_line_options[:custom_options_file]
173
+ end
174
+
175
+ def project_options_file
176
+ "./.rspec"
177
+ end
178
+
179
+ def local_options_file
180
+ "./.rspec-local"
181
+ end
182
+
183
+ def global_options_file
184
+ File.join(File.expand_path("~"), ".rspec")
185
+ rescue ArgumentError
186
+ RSpec.warning "Unable to find ~/.rspec because the HOME environment variable is not set"
187
+ nil
188
+ end
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,111 @@
1
+ require 'drb/drb'
2
+
3
+ module RSpec
4
+ module Core
5
+ # @private
6
+ class DRbRunner
7
+ def initialize(options, configuration=RSpec.configuration)
8
+ @options = options
9
+ @configuration = configuration
10
+ end
11
+
12
+ def drb_port
13
+ @options.options[:drb_port] || ENV['RSPEC_DRB'] || 8989
14
+ end
15
+
16
+ def run(err, out)
17
+ begin
18
+ DRb.start_service("druby://localhost:0")
19
+ rescue SocketError, Errno::EADDRNOTAVAIL
20
+ DRb.start_service("druby://:0")
21
+ end
22
+ spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}")
23
+ spec_server.run(drb_argv, err, out)
24
+ end
25
+
26
+ def drb_argv
27
+ @drb_argv ||= begin
28
+ @options.configure_filter_manager(@configuration.filter_manager)
29
+ DRbOptions.new(@options.options, @configuration.filter_manager).options
30
+ end
31
+ end
32
+ end
33
+
34
+ # @private
35
+ class DRbOptions
36
+ def initialize(submitted_options, filter_manager)
37
+ @submitted_options = submitted_options
38
+ @filter_manager = filter_manager
39
+ end
40
+
41
+ def options
42
+ argv = []
43
+ argv << "--color" if @submitted_options[:color]
44
+ argv << "--profile" if @submitted_options[:profile_examples]
45
+ argv << "--backtrace" if @submitted_options[:full_backtrace]
46
+ argv << "--tty" if @submitted_options[:tty]
47
+ argv << "--fail-fast" if @submitted_options[:fail_fast]
48
+ argv << "--options" << @submitted_options[:custom_options_file] if @submitted_options[:custom_options_file]
49
+ argv << "--order" << @submitted_options[:order] if @submitted_options[:order]
50
+
51
+ add_failure_exit_code(argv)
52
+ add_full_description(argv)
53
+ add_filter(argv, :inclusion, @filter_manager.inclusions)
54
+ add_filter(argv, :exclusion, @filter_manager.exclusions)
55
+ add_formatters(argv)
56
+ add_libs(argv)
57
+ add_requires(argv)
58
+
59
+ argv + @submitted_options[:files_or_directories_to_run]
60
+ end
61
+
62
+ def add_failure_exit_code(argv)
63
+ return unless @submitted_options[:failure_exit_code]
64
+
65
+ argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
66
+ end
67
+
68
+ def add_full_description(argv)
69
+ return unless @submitted_options[:full_description]
70
+
71
+ # The argument to --example is regexp-escaped before being stuffed
72
+ # into a regexp when received for the first time (see OptionParser).
73
+ # Hence, merely grabbing the source of this regexp will retain the
74
+ # backslashes, so we must remove them.
75
+ @submitted_options[:full_description].each do |description|
76
+ argv << "--example" << description.source.delete('\\')
77
+ end
78
+ end
79
+
80
+ CONDITIONAL_FILTERS = [:if, :unless]
81
+
82
+ def add_filter(argv, name, hash)
83
+ hash.each_pair do |k, v|
84
+ next if CONDITIONAL_FILTERS.include?(k)
85
+ tag = name == :inclusion ? k.to_s : "~#{k}"
86
+ tag << ":#{v}" if v.is_a?(String)
87
+ argv << "--tag" << tag
88
+ end unless hash.empty?
89
+ end
90
+
91
+ def add_formatters(argv)
92
+ @submitted_options[:formatters].each do |pair|
93
+ argv << "--format" << pair[0]
94
+ argv << "--out" << pair[1] if pair[1]
95
+ end if @submitted_options[:formatters]
96
+ end
97
+
98
+ def add_libs(argv)
99
+ @submitted_options[:libs].each do |path|
100
+ argv << "-I" << path
101
+ end if @submitted_options[:libs]
102
+ end
103
+
104
+ def add_requires(argv)
105
+ @submitted_options[:requires].each do |path|
106
+ argv << "--require" << path
107
+ end if @submitted_options[:requires]
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,96 @@
1
+ module RSpec
2
+ module Core
3
+ # DSL defines methods to group examples, most notably `describe`,
4
+ # and exposes them as class methods of {RSpec}. They can also be
5
+ # exposed globally (on `main` and instances of `Module`) through
6
+ # the {Configuration} option `expose_dsl_globally`.
7
+ #
8
+ # By default the methods `describe`, `context` and `example_group`
9
+ # are exposed. These methods define a named context for one or
10
+ # more examples. The given block is evaluated in the context of
11
+ # a generated subclass of {RSpec::Core::ExampleGroup}.
12
+ #
13
+ # ## Examples:
14
+ #
15
+ # RSpec.describe "something" do
16
+ # context "when something is a certain way" do
17
+ # it "does something" do
18
+ # # example code goes here
19
+ # end
20
+ # end
21
+ # end
22
+ #
23
+ # @see ExampleGroup
24
+ # @see ExampleGroup.example_group
25
+ module DSL
26
+ # @private
27
+ def self.example_group_aliases
28
+ @example_group_aliases ||= []
29
+ end
30
+
31
+ # @private
32
+ def self.exposed_globally?
33
+ @exposed_globally ||= false
34
+ end
35
+
36
+ # @private
37
+ def self.expose_example_group_alias(name)
38
+ return if example_group_aliases.include?(name)
39
+
40
+ example_group_aliases << name
41
+
42
+ (class << RSpec; self; end).__send__(:define_method, name) do |*args, &example_group_block|
43
+ RSpec.world.register RSpec::Core::ExampleGroup.__send__(name, *args, &example_group_block)
44
+ end
45
+
46
+ expose_example_group_alias_globally(name) if exposed_globally?
47
+ end
48
+
49
+ class << self
50
+ # @private
51
+ attr_accessor :top_level
52
+ end
53
+
54
+ # Adds the describe method to Module and the top level binding.
55
+ # @api private
56
+ def self.expose_globally!
57
+ return if exposed_globally?
58
+
59
+ example_group_aliases.each do |method_name|
60
+ expose_example_group_alias_globally(method_name)
61
+ end
62
+
63
+ @exposed_globally = true
64
+ end
65
+
66
+ # Removes the describe method from Module and the top level binding.
67
+ # @api private
68
+ def self.remove_globally!
69
+ return unless exposed_globally?
70
+
71
+ example_group_aliases.each do |method_name|
72
+ change_global_dsl { undef_method method_name }
73
+ end
74
+
75
+ @exposed_globally = false
76
+ end
77
+
78
+ # @private
79
+ def self.expose_example_group_alias_globally(method_name)
80
+ change_global_dsl do
81
+ remove_method(method_name) if method_defined?(method_name)
82
+ define_method(method_name) { |*a, &b| ::RSpec.__send__(method_name, *a, &b) }
83
+ end
84
+ end
85
+
86
+ # @private
87
+ def self.change_global_dsl(&changes)
88
+ (class << top_level; self; end).class_exec(&changes)
89
+ Module.class_exec(&changes)
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ # Capture main without an eval.
96
+ ::RSpec::Core::DSL.top_level = self
@@ -0,0 +1,573 @@
1
+ module RSpec
2
+ module Core
3
+ # Wrapper for an instance of a subclass of {ExampleGroup}. An instance of
4
+ # `RSpec::Core::Example` is returned by example definition methods
5
+ # such as {ExampleGroup.it it} and is yielded to the {ExampleGroup.it it},
6
+ # {Hooks#before before}, {Hooks#after after}, {Hooks#around around},
7
+ # {MemoizedHelpers::ClassMethods#let let} and
8
+ # {MemoizedHelpers::ClassMethods#subject subject} blocks.
9
+ #
10
+ # This allows us to provide rich metadata about each individual
11
+ # example without adding tons of methods directly to the ExampleGroup
12
+ # that users may inadvertantly redefine.
13
+ #
14
+ # Useful for configuring logging and/or taking some action based
15
+ # on the state of an example's metadata.
16
+ #
17
+ # @example
18
+ #
19
+ # RSpec.configure do |config|
20
+ # config.before do |example|
21
+ # log example.description
22
+ # end
23
+ #
24
+ # config.after do |example|
25
+ # log example.description
26
+ # end
27
+ #
28
+ # config.around do |example|
29
+ # log example.description
30
+ # example.run
31
+ # end
32
+ # end
33
+ #
34
+ # shared_examples "auditable" do
35
+ # it "does something" do
36
+ # log "#{example.full_description}: #{auditable.inspect}"
37
+ # auditable.should do_something
38
+ # end
39
+ # end
40
+ #
41
+ # @see ExampleGroup
42
+ # @note Example blocks are evaluated in the context of an instance
43
+ # of an `ExampleGroup`, not in the context of an instance of `Example`.
44
+ class Example
45
+ # @private
46
+ #
47
+ # Used to define methods that delegate to this example's metadata.
48
+ def self.delegate_to_metadata(key)
49
+ define_method(key) { @metadata[key] }
50
+ end
51
+
52
+ # @return [ExecutionResult] represents the result of running this example.
53
+ delegate_to_metadata :execution_result
54
+ # @return [String] the relative path to the file where this example was
55
+ # defined.
56
+ delegate_to_metadata :file_path
57
+ # @return [String] the full description (including the docstrings of
58
+ # all parent example groups).
59
+ delegate_to_metadata :full_description
60
+ # @return [String] the exact source location of this example in a form
61
+ # like `./path/to/spec.rb:17`
62
+ delegate_to_metadata :location
63
+ # @return [Boolean] flag that indicates that the example is not expected
64
+ # to pass. It will be run and will either have a pending result (if a
65
+ # failure occurs) or a failed result (if no failure occurs).
66
+ delegate_to_metadata :pending
67
+ # @return [Boolean] flag that will cause the example to not run.
68
+ # The {ExecutionResult} status will be `:pending`.
69
+ delegate_to_metadata :skip
70
+
71
+ # Returns the string submitted to `example` or its aliases (e.g.
72
+ # `specify`, `it`, etc). If no string is submitted (e.g.
73
+ # `it { is_expected.to do_something }`) it returns the message generated
74
+ # by the matcher if there is one, otherwise returns a message including
75
+ # the location of the example.
76
+ def description
77
+ description = if metadata[:description].to_s.empty?
78
+ location_description
79
+ else
80
+ metadata[:description]
81
+ end
82
+
83
+ RSpec.configuration.format_docstrings_block.call(description)
84
+ end
85
+
86
+ # Returns a description of the example that always includes the location.
87
+ def inspect_output
88
+ inspect_output = "\"#{description}\""
89
+ unless metadata[:description].to_s.empty?
90
+ inspect_output << " (#{location})"
91
+ end
92
+ inspect_output
93
+ end
94
+
95
+ # Returns the location-based argument that can be passed to the `rspec` command to rerun this example.
96
+ def location_rerun_argument
97
+ @location_rerun_argument ||= begin
98
+ loaded_spec_files = RSpec.configuration.loaded_spec_files
99
+
100
+ Metadata.ascending(metadata) do |meta|
101
+ return meta[:location] if loaded_spec_files.include?(meta[:absolute_file_path])
102
+ end
103
+ end
104
+ end
105
+
106
+ # Returns the location-based argument that can be passed to the `rspec` command to rerun this example.
107
+ #
108
+ # @deprecated Use {#location_rerun_argument} instead.
109
+ # @note If there are multiple examples identified by this location, they will use {#id}
110
+ # to rerun instead, but this method will still return the location (that's why it is deprecated!).
111
+ def rerun_argument
112
+ location_rerun_argument
113
+ end
114
+
115
+ # @return [String] the unique id of this example. Pass
116
+ # this at the command line to re-run this exact example.
117
+ def id
118
+ @id ||= Metadata.id_from(metadata)
119
+ end
120
+
121
+ # @attr_reader
122
+ #
123
+ # Returns the first exception raised in the context of running this
124
+ # example (nil if no exception is raised).
125
+ attr_reader :exception
126
+
127
+ # @attr_reader
128
+ #
129
+ # Returns the metadata object associated with this example.
130
+ attr_reader :metadata
131
+
132
+ # @attr_reader
133
+ # @private
134
+ #
135
+ # Returns the example_group_instance that provides the context for
136
+ # running this example.
137
+ attr_reader :example_group_instance
138
+
139
+ # @attr
140
+ # @private
141
+ attr_accessor :clock
142
+
143
+ # Creates a new instance of Example.
144
+ # @param example_group_class [Class] the subclass of ExampleGroup in which
145
+ # this Example is declared
146
+ # @param description [String] the String passed to the `it` method (or
147
+ # alias)
148
+ # @param user_metadata [Hash] additional args passed to `it` to be used as
149
+ # metadata
150
+ # @param example_block [Proc] the block of code that represents the
151
+ # example
152
+ # @api private
153
+ def initialize(example_group_class, description, user_metadata, example_block=nil)
154
+ @example_group_class = example_group_class
155
+ @example_block = example_block
156
+
157
+ @metadata = Metadata::ExampleHash.create(
158
+ @example_group_class.metadata, user_metadata,
159
+ example_group_class.method(:next_runnable_index_for),
160
+ description, example_block
161
+ )
162
+
163
+ # This should perhaps be done in `Metadata::ExampleHash.create`,
164
+ # but the logic there has no knowledge of `RSpec.world` and we
165
+ # want to keep it that way. It's easier to just assign it here.
166
+ @metadata[:last_run_status] = RSpec.configuration.last_run_statuses[id]
167
+
168
+ @example_group_instance = @exception = nil
169
+ @clock = RSpec::Core::Time
170
+ @reporter = RSpec::Core::NullReporter
171
+ end
172
+
173
+ # @return [RSpec::Core::Reporter] the current reporter for the example
174
+ attr_reader :reporter
175
+
176
+ # Returns the example group class that provides the context for running
177
+ # this example.
178
+ def example_group
179
+ @example_group_class
180
+ end
181
+
182
+ alias_method :pending?, :pending
183
+ alias_method :skipped?, :skip
184
+
185
+ # @api private
186
+ # instance_execs the block passed to the constructor in the context of
187
+ # the instance of {ExampleGroup}.
188
+ # @param example_group_instance the instance of an ExampleGroup subclass
189
+ def run(example_group_instance, reporter)
190
+ @example_group_instance = example_group_instance
191
+ @reporter = reporter
192
+ hooks.register_global_singleton_context_hooks(self, RSpec.configuration.hooks)
193
+ RSpec.configuration.configure_example(self)
194
+ RSpec.current_example = self
195
+
196
+ start(reporter)
197
+ Pending.mark_pending!(self, pending) if pending?
198
+
199
+ begin
200
+ if skipped?
201
+ Pending.mark_pending! self, skip
202
+ elsif !RSpec.configuration.dry_run?
203
+ with_around_and_singleton_context_hooks do
204
+ begin
205
+ run_before_example
206
+ @example_group_instance.instance_exec(self, &@example_block)
207
+
208
+ if pending?
209
+ Pending.mark_fixed! self
210
+
211
+ raise Pending::PendingExampleFixedError,
212
+ 'Expected example to fail since it is pending, but it passed.',
213
+ [location]
214
+ end
215
+ rescue Pending::SkipDeclaredInExample
216
+ # no-op, required metadata has already been set by the `skip`
217
+ # method.
218
+ rescue Exception => e
219
+ set_exception(e)
220
+ ensure
221
+ run_after_example
222
+ end
223
+ end
224
+ end
225
+ rescue Exception => e
226
+ set_exception(e)
227
+ ensure
228
+ @example_group_instance = nil # if you love something... let it go
229
+ end
230
+
231
+ finish(reporter)
232
+ ensure
233
+ RSpec.current_example = nil
234
+ end
235
+
236
+ # Wraps both a `Proc` and an {Example} for use in {Hooks#around
237
+ # around} hooks. In around hooks we need to yield this special
238
+ # kind of object (rather than the raw {Example}) because when
239
+ # there are multiple `around` hooks we have to wrap them recursively.
240
+ #
241
+ # @example
242
+ #
243
+ # RSpec.configure do |c|
244
+ # c.around do |ex| # Procsy which wraps the example
245
+ # if ex.metadata[:key] == :some_value && some_global_condition
246
+ # raise "some message"
247
+ # end
248
+ # ex.run # run delegates to ex.call.
249
+ # end
250
+ # end
251
+ #
252
+ # @note This class also exposes the instance methods of {Example},
253
+ # proxying them through to the wrapped {Example} instance.
254
+ class Procsy
255
+ # The {Example} instance.
256
+ attr_reader :example
257
+
258
+ Example.public_instance_methods(false).each do |name|
259
+ next if name.to_sym == :run || name.to_sym == :inspect
260
+
261
+ define_method(name) { |*a, &b| @example.__send__(name, *a, &b) }
262
+ end
263
+
264
+ Proc.public_instance_methods(false).each do |name|
265
+ next if name.to_sym == :call || name.to_sym == :inspect || name.to_sym == :to_proc
266
+
267
+ define_method(name) { |*a, &b| @proc.__send__(name, *a, &b) }
268
+ end
269
+
270
+ # Calls the proc and notes that the example has been executed.
271
+ def call(*args, &block)
272
+ @executed = true
273
+ @proc.call(*args, &block)
274
+ end
275
+ alias run call
276
+
277
+ # Provides a wrapped proc that will update our `executed?` state when
278
+ # executed.
279
+ def to_proc
280
+ method(:call).to_proc
281
+ end
282
+
283
+ def initialize(example, &block)
284
+ @example = example
285
+ @proc = block
286
+ @executed = false
287
+ end
288
+
289
+ # @private
290
+ def wrap(&block)
291
+ self.class.new(example, &block)
292
+ end
293
+
294
+ # Indicates whether or not the around hook has executed the example.
295
+ def executed?
296
+ @executed
297
+ end
298
+
299
+ # @private
300
+ def inspect
301
+ @example.inspect.gsub('Example', 'ExampleProcsy')
302
+ end
303
+ end
304
+
305
+ # @private
306
+ #
307
+ # The exception that will be displayed to the user -- either the failure of
308
+ # the example or the `pending_exception` if the example is pending.
309
+ def display_exception
310
+ @exception || execution_result.pending_exception
311
+ end
312
+
313
+ # @private
314
+ #
315
+ # Assigns the exception that will be displayed to the user -- either the failure of
316
+ # the example or the `pending_exception` if the example is pending.
317
+ def display_exception=(ex)
318
+ if pending? && !(Pending::PendingExampleFixedError === ex)
319
+ @exception = nil
320
+ execution_result.pending_fixed = false
321
+ execution_result.pending_exception = ex
322
+ else
323
+ @exception = ex
324
+ end
325
+ end
326
+
327
+ # rubocop:disable Style/AccessorMethodName
328
+
329
+ # @private
330
+ #
331
+ # Used internally to set an exception in an after hook, which
332
+ # captures the exception but doesn't raise it.
333
+ def set_exception(exception)
334
+ return self.display_exception = exception unless display_exception
335
+
336
+ unless RSpec::Core::MultipleExceptionError === display_exception
337
+ self.display_exception = RSpec::Core::MultipleExceptionError.new(display_exception)
338
+ end
339
+
340
+ display_exception.add exception
341
+ end
342
+
343
+ # @private
344
+ #
345
+ # Used to set the exception when `aggregate_failures` fails.
346
+ def set_aggregate_failures_exception(exception)
347
+ return set_exception(exception) unless display_exception
348
+
349
+ exception = RSpec::Core::MultipleExceptionError::InterfaceTag.for(exception)
350
+ exception.add display_exception
351
+ self.display_exception = exception
352
+ end
353
+
354
+ # rubocop:enable Style/AccessorMethodName
355
+
356
+ # @private
357
+ #
358
+ # Used internally to set an exception and fail without actually executing
359
+ # the example when an exception is raised in before(:context).
360
+ def fail_with_exception(reporter, exception)
361
+ start(reporter)
362
+ set_exception(exception)
363
+ finish(reporter)
364
+ end
365
+
366
+ # @private
367
+ #
368
+ # Used internally to skip without actually executing the example when
369
+ # skip is used in before(:context).
370
+ def skip_with_exception(reporter, exception)
371
+ start(reporter)
372
+ Pending.mark_skipped! self, exception.argument
373
+ finish(reporter)
374
+ end
375
+
376
+ # @private
377
+ def instance_exec(*args, &block)
378
+ @example_group_instance.instance_exec(*args, &block)
379
+ end
380
+
381
+ private
382
+
383
+ def hooks
384
+ example_group_instance.singleton_class.hooks
385
+ end
386
+
387
+ def with_around_example_hooks
388
+ hooks.run(:around, :example, self) { yield }
389
+ rescue Exception => e
390
+ set_exception(e)
391
+ end
392
+
393
+ def start(reporter)
394
+ reporter.example_started(self)
395
+ execution_result.started_at = clock.now
396
+ end
397
+
398
+ def finish(reporter)
399
+ pending_message = execution_result.pending_message
400
+
401
+ if @exception
402
+ record_finished :failed
403
+ execution_result.exception = @exception
404
+ reporter.example_failed self
405
+ false
406
+ elsif pending_message
407
+ record_finished :pending
408
+ execution_result.pending_message = pending_message
409
+ reporter.example_pending self
410
+ true
411
+ else
412
+ record_finished :passed
413
+ reporter.example_passed self
414
+ true
415
+ end
416
+ end
417
+
418
+ def record_finished(status)
419
+ execution_result.record_finished(status, clock.now)
420
+ end
421
+
422
+ def run_before_example
423
+ @example_group_instance.setup_mocks_for_rspec
424
+ hooks.run(:before, :example, self)
425
+ end
426
+
427
+ def with_around_and_singleton_context_hooks
428
+ singleton_context_hooks_host = example_group_instance.singleton_class
429
+ singleton_context_hooks_host.run_before_context_hooks(example_group_instance)
430
+ with_around_example_hooks { yield }
431
+ ensure
432
+ singleton_context_hooks_host.run_after_context_hooks(example_group_instance)
433
+ end
434
+
435
+ def run_after_example
436
+ assign_generated_description if defined?(::RSpec::Matchers)
437
+ hooks.run(:after, :example, self)
438
+ verify_mocks
439
+ ensure
440
+ @example_group_instance.teardown_mocks_for_rspec
441
+ end
442
+
443
+ def verify_mocks
444
+ @example_group_instance.verify_mocks_for_rspec if mocks_need_verification?
445
+ rescue Exception => e
446
+ set_exception(e)
447
+ end
448
+
449
+ def mocks_need_verification?
450
+ exception.nil? || execution_result.pending_fixed?
451
+ end
452
+
453
+ def assign_generated_description
454
+ if metadata[:description].empty? && (description = generate_description)
455
+ metadata[:description] = description
456
+ metadata[:full_description] << description
457
+ end
458
+ ensure
459
+ RSpec::Matchers.clear_generated_description
460
+ end
461
+
462
+ def generate_description
463
+ RSpec::Matchers.generated_description
464
+ rescue Exception => e
465
+ location_description + " (Got an error when generating description " \
466
+ "from matcher: #{e.class}: #{e.message} -- #{e.backtrace.first})"
467
+ end
468
+
469
+ def location_description
470
+ "example at #{location}"
471
+ end
472
+
473
+ # Represents the result of executing an example.
474
+ # Behaves like a hash for backwards compatibility.
475
+ class ExecutionResult
476
+ include HashImitatable
477
+
478
+ # @return [Symbol] `:passed`, `:failed` or `:pending`.
479
+ attr_accessor :status
480
+
481
+ # @return [Exception, nil] The failure, if there was one.
482
+ attr_accessor :exception
483
+
484
+ # @return [Time] When the example started.
485
+ attr_accessor :started_at
486
+
487
+ # @return [Time] When the example finished.
488
+ attr_accessor :finished_at
489
+
490
+ # @return [Float] How long the example took in seconds.
491
+ attr_accessor :run_time
492
+
493
+ # @return [String, nil] The reason the example was pending,
494
+ # or nil if the example was not pending.
495
+ attr_accessor :pending_message
496
+
497
+ # @return [Exception, nil] The exception triggered while
498
+ # executing the pending example. If no exception was triggered
499
+ # it would no longer get a status of `:pending` unless it was
500
+ # tagged with `:skip`.
501
+ attr_accessor :pending_exception
502
+
503
+ # @return [Boolean] For examples tagged with `:pending`,
504
+ # this indicates whether or not it now passes.
505
+ attr_accessor :pending_fixed
506
+
507
+ alias pending_fixed? pending_fixed
508
+
509
+ # @return [Boolean] Indicates if the example was completely skipped
510
+ # (typically done via `:skip` metadata or the `skip` method). Skipped examples
511
+ # will have a `:pending` result. A `:pending` result can also come from examples
512
+ # that were marked as `:pending`, which causes them to be run, and produces a
513
+ # `:failed` result if the example passes.
514
+ def example_skipped?
515
+ status == :pending && !pending_exception
516
+ end
517
+
518
+ # @api private
519
+ # Records the finished status of the example.
520
+ def record_finished(status, finished_at)
521
+ self.status = status
522
+ self.finished_at = finished_at
523
+ self.run_time = (finished_at - started_at).to_f
524
+ end
525
+
526
+ private
527
+
528
+ # For backwards compatibility we present `status` as a string
529
+ # when presenting the legacy hash interface.
530
+ def hash_for_delegation
531
+ super.tap do |hash|
532
+ hash[:status] &&= status.to_s
533
+ end
534
+ end
535
+
536
+ def set_value(name, value)
537
+ value &&= value.to_sym if name == :status
538
+ super(name, value)
539
+ end
540
+
541
+ def get_value(name)
542
+ if name == :status
543
+ status.to_s if status
544
+ else
545
+ super
546
+ end
547
+ end
548
+
549
+ def issue_deprecation(_method_name, *_args)
550
+ RSpec.deprecate("Treating `metadata[:execution_result]` as a hash",
551
+ :replacement => "the attributes methods to access the data")
552
+ end
553
+ end
554
+ end
555
+
556
+ # @private
557
+ # Provides an execution context for before/after :suite hooks.
558
+ class SuiteHookContext < Example
559
+ def initialize
560
+ super(AnonymousExampleGroup, "", {})
561
+ @example_group_instance = AnonymousExampleGroup.new
562
+ end
563
+
564
+ # rubocop:disable Style/AccessorMethodName
565
+
566
+ # To ensure we don't silence errors.
567
+ def set_exception(exception)
568
+ raise exception
569
+ end
570
+ # rubocop:enable Style/AccessorMethodName
571
+ end
572
+ end
573
+ end