takuya-lvm-snapshot 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (380) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +4 -0
  4. data/Gemfile +10 -0
  5. data/LICENSE +674 -0
  6. data/README.md +80 -0
  7. data/Rakefile +4 -0
  8. data/bin/console +15 -0
  9. data/bin/setup +8 -0
  10. data/bundle/ruby/2.7.0/bin/htmldiff +29 -0
  11. data/bundle/ruby/2.7.0/bin/ldiff +29 -0
  12. data/bundle/ruby/2.7.0/bin/rake +27 -0
  13. data/bundle/ruby/2.7.0/bin/rspec +27 -0
  14. data/bundle/ruby/2.7.0/cache/diff-lcs-1.5.0.gem +0 -0
  15. data/bundle/ruby/2.7.0/cache/rake-13.0.3.gem +0 -0
  16. data/bundle/ruby/2.7.0/cache/rspec-3.12.0.gem +0 -0
  17. data/bundle/ruby/2.7.0/cache/rspec-core-3.12.0.gem +0 -0
  18. data/bundle/ruby/2.7.0/cache/rspec-expectations-3.12.1.gem +0 -0
  19. data/bundle/ruby/2.7.0/cache/rspec-mocks-3.12.1.gem +0 -0
  20. data/bundle/ruby/2.7.0/cache/rspec-support-3.12.0.gem +0 -0
  21. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/.rspec +1 -0
  22. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/Code-of-Conduct.md +74 -0
  23. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/Contributing.md +119 -0
  24. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/History.md +400 -0
  25. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/License.md +39 -0
  26. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/Manifest.txt +59 -0
  27. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/README.rdoc +84 -0
  28. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/Rakefile +121 -0
  29. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/bin/htmldiff +35 -0
  30. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/bin/ldiff +9 -0
  31. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/docs/COPYING.txt +339 -0
  32. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/docs/artistic.txt +127 -0
  33. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/array.rb +7 -0
  34. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/backports.rb +9 -0
  35. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/block.rb +37 -0
  36. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/callbacks.rb +325 -0
  37. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/change.rb +174 -0
  38. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/htmldiff.rb +150 -0
  39. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/hunk.rb +358 -0
  40. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/internals.rb +308 -0
  41. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/ldiff.rb +171 -0
  42. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs/string.rb +5 -0
  43. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff/lcs.rb +739 -0
  44. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/lib/diff-lcs.rb +3 -0
  45. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/change_spec.rb +89 -0
  46. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/diff_spec.rb +51 -0
  47. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/aX +1 -0
  48. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/bXaX +1 -0
  49. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ds1.csv +50 -0
  50. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ds2.csv +51 -0
  51. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff +4 -0
  52. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff-c +7 -0
  53. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff-e +3 -0
  54. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff-f +3 -0
  55. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff-u +5 -0
  56. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef +4 -0
  57. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef-c +15 -0
  58. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef-e +3 -0
  59. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef-f +3 -0
  60. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef-u +9 -0
  61. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef2 +7 -0
  62. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef2-c +20 -0
  63. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef2-d +7 -0
  64. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef2-e +7 -0
  65. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef2-f +7 -0
  66. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/ldiff/output.diff.chef2-u +16 -0
  67. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/new-chef +4 -0
  68. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/new-chef2 +17 -0
  69. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/old-chef +4 -0
  70. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/fixtures/old-chef2 +14 -0
  71. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/hunk_spec.rb +83 -0
  72. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/issues_spec.rb +154 -0
  73. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/lcs_spec.rb +56 -0
  74. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/ldiff_spec.rb +87 -0
  75. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/patch_spec.rb +416 -0
  76. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/sdiff_spec.rb +214 -0
  77. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/spec_helper.rb +374 -0
  78. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/traverse_balanced_spec.rb +310 -0
  79. data/bundle/ruby/2.7.0/gems/diff-lcs-1.5.0/spec/traverse_sequences_spec.rb +137 -0
  80. data/bundle/ruby/2.7.0/gems/rake-13.0.3/CONTRIBUTING.rdoc +43 -0
  81. data/bundle/ruby/2.7.0/gems/rake-13.0.3/Gemfile +10 -0
  82. data/bundle/ruby/2.7.0/gems/rake-13.0.3/History.rdoc +2386 -0
  83. data/bundle/ruby/2.7.0/gems/rake-13.0.3/MIT-LICENSE +21 -0
  84. data/bundle/ruby/2.7.0/gems/rake-13.0.3/README.rdoc +155 -0
  85. data/bundle/ruby/2.7.0/gems/rake-13.0.3/Rakefile +41 -0
  86. data/bundle/ruby/2.7.0/gems/rake-13.0.3/bin/bundle +105 -0
  87. data/bundle/ruby/2.7.0/gems/rake-13.0.3/bin/console +7 -0
  88. data/bundle/ruby/2.7.0/gems/rake-13.0.3/bin/rake +29 -0
  89. data/bundle/ruby/2.7.0/gems/rake-13.0.3/bin/rdoc +29 -0
  90. data/bundle/ruby/2.7.0/gems/rake-13.0.3/bin/rubocop +29 -0
  91. data/bundle/ruby/2.7.0/gems/rake-13.0.3/bin/setup +6 -0
  92. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/command_line_usage.rdoc +158 -0
  93. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/example/Rakefile1 +38 -0
  94. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/example/Rakefile2 +35 -0
  95. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/example/a.c +6 -0
  96. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/example/b.c +6 -0
  97. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/example/main.c +11 -0
  98. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/glossary.rdoc +42 -0
  99. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/jamis.rb +592 -0
  100. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/proto_rake.rdoc +127 -0
  101. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/rake.1 +156 -0
  102. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/rakefile.rdoc +622 -0
  103. data/bundle/ruby/2.7.0/gems/rake-13.0.3/doc/rational.rdoc +151 -0
  104. data/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake +27 -0
  105. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/application.rb +824 -0
  106. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/backtrace.rb +24 -0
  107. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/clean.rb +78 -0
  108. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/cloneable.rb +17 -0
  109. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/cpu_counter.rb +107 -0
  110. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/default_loader.rb +15 -0
  111. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/dsl_definition.rb +195 -0
  112. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/early_time.rb +22 -0
  113. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/ext/core.rb +26 -0
  114. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/ext/string.rb +176 -0
  115. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/file_creation_task.rb +25 -0
  116. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/file_list.rb +435 -0
  117. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/file_task.rb +54 -0
  118. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/file_utils.rb +134 -0
  119. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/file_utils_ext.rb +134 -0
  120. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/invocation_chain.rb +57 -0
  121. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/invocation_exception_mixin.rb +17 -0
  122. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/late_time.rb +18 -0
  123. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/linked_list.rb +112 -0
  124. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/loaders/makefile.rb +54 -0
  125. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/multi_task.rb +14 -0
  126. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/name_space.rb +38 -0
  127. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/packagetask.rb +222 -0
  128. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/phony.rb +16 -0
  129. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/private_reader.rb +21 -0
  130. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/promise.rb +100 -0
  131. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/pseudo_status.rb +30 -0
  132. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rake_module.rb +67 -0
  133. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb +27 -0
  134. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rule_recursion_overflow_error.rb +20 -0
  135. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/scope.rb +43 -0
  136. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/task.rb +434 -0
  137. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/task_argument_error.rb +8 -0
  138. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/task_arguments.rb +109 -0
  139. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/task_manager.rb +331 -0
  140. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/tasklib.rb +12 -0
  141. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/testtask.rb +189 -0
  142. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/thread_history_display.rb +49 -0
  143. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/thread_pool.rb +163 -0
  144. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/trace_output.rb +23 -0
  145. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/version.rb +10 -0
  146. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/win32.rb +51 -0
  147. data/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake.rb +71 -0
  148. data/bundle/ruby/2.7.0/gems/rake-13.0.3/rake.gemspec +43 -0
  149. data/bundle/ruby/2.7.0/gems/rspec-3.12.0/LICENSE.md +27 -0
  150. data/bundle/ruby/2.7.0/gems/rspec-3.12.0/README.md +47 -0
  151. data/bundle/ruby/2.7.0/gems/rspec-3.12.0/lib/rspec/version.rb +5 -0
  152. data/bundle/ruby/2.7.0/gems/rspec-3.12.0/lib/rspec.rb +3 -0
  153. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/.document +5 -0
  154. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/.yardopts +8 -0
  155. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/Changelog.md +2360 -0
  156. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/LICENSE.md +26 -0
  157. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/README.md +384 -0
  158. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/exe/rspec +4 -0
  159. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/autorun.rb +3 -0
  160. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/backtrace_formatter.rb +65 -0
  161. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/coordinator.rb +62 -0
  162. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/example_minimizer.rb +173 -0
  163. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/fork_runner.rb +138 -0
  164. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/server.rb +61 -0
  165. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/shell_command.rb +126 -0
  166. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/shell_runner.rb +73 -0
  167. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/bisect/utilities.rb +69 -0
  168. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb +2385 -0
  169. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/configuration_options.rb +233 -0
  170. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/did_you_mean.rb +46 -0
  171. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/drb.rb +120 -0
  172. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/dsl.rb +98 -0
  173. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb +666 -0
  174. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb +905 -0
  175. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/example_status_persister.rb +235 -0
  176. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/filter_manager.rb +231 -0
  177. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/flat_map.rb +20 -0
  178. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
  179. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/base_formatter.rb +70 -0
  180. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/base_text_formatter.rb +75 -0
  181. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
  182. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/bisect_progress_formatter.rb +157 -0
  183. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/console_codes.rb +76 -0
  184. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
  185. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/documentation_formatter.rb +102 -0
  186. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/exception_presenter.rb +525 -0
  187. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
  188. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
  189. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/helpers.rb +118 -0
  190. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_formatter.rb +153 -0
  191. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_printer.rb +412 -0
  192. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/html_snippet_extractor.rb +120 -0
  193. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/json_formatter.rb +102 -0
  194. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/profile_formatter.rb +68 -0
  195. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/progress_formatter.rb +29 -0
  196. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/protocol.rb +182 -0
  197. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/snippet_extractor.rb +134 -0
  198. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters/syntax_highlighter.rb +91 -0
  199. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/formatters.rb +279 -0
  200. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb +646 -0
  201. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/invocations.rb +87 -0
  202. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/memoized_helpers.rb +580 -0
  203. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata.rb +498 -0
  204. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/metadata_filter.rb +255 -0
  205. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
  206. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
  207. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
  208. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/mocking_adapters/null.rb +14 -0
  209. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/mocking_adapters/rr.rb +31 -0
  210. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
  211. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/notifications.rb +521 -0
  212. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/option_parser.rb +323 -0
  213. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/ordering.rb +169 -0
  214. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/output_wrapper.rb +29 -0
  215. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/pending.rb +157 -0
  216. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/profiler.rb +34 -0
  217. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer/.rspec +1 -0
  218. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer/spec/spec_helper.rb +98 -0
  219. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/project_initializer.rb +48 -0
  220. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/rake_task.rb +188 -0
  221. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/reporter.rb +265 -0
  222. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/ruby_project.rb +53 -0
  223. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb +212 -0
  224. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/sandbox.rb +37 -0
  225. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/set.rb +54 -0
  226. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_context.rb +55 -0
  227. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/shared_example_group.rb +271 -0
  228. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/shell_escape.rb +49 -0
  229. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
  230. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/version.rb +9 -0
  231. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/warnings.rb +40 -0
  232. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core/world.rb +287 -0
  233. data/bundle/ruby/2.7.0/gems/rspec-core-3.12.0/lib/rspec/core.rb +212 -0
  234. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/.document +5 -0
  235. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/.yardopts +6 -0
  236. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/Changelog.md +1294 -0
  237. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/LICENSE.md +25 -0
  238. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/README.md +320 -0
  239. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
  240. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/configuration.rb +230 -0
  241. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/expectation_target.rb +163 -0
  242. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/fail_with.rb +39 -0
  243. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/failure_aggregator.rb +229 -0
  244. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/handler.rb +182 -0
  245. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/minitest_integration.rb +58 -0
  246. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/syntax.rb +132 -0
  247. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations/version.rb +8 -0
  248. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/expectations.rb +82 -0
  249. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/aliased_matcher.rb +116 -0
  250. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/all.rb +86 -0
  251. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/base_matcher.rb +198 -0
  252. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/be.rb +191 -0
  253. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/be_between.rb +77 -0
  254. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/be_instance_of.rb +26 -0
  255. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/be_kind_of.rb +20 -0
  256. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/be_within.rb +72 -0
  257. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/change.rb +450 -0
  258. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/compound.rb +290 -0
  259. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/contain_exactly.rb +310 -0
  260. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/count_expectation.rb +169 -0
  261. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/cover.rb +24 -0
  262. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/eq.rb +40 -0
  263. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/eql.rb +34 -0
  264. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/equal.rb +81 -0
  265. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/exist.rb +90 -0
  266. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/has.rb +167 -0
  267. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
  268. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/include.rb +206 -0
  269. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/match.rb +106 -0
  270. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/operators.rb +128 -0
  271. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/output.rb +207 -0
  272. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/raise_error.rb +271 -0
  273. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/respond_to.rb +200 -0
  274. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/satisfy.rb +60 -0
  275. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
  276. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/throw_symbol.rb +138 -0
  277. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in/yield.rb +375 -0
  278. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/built_in.rb +53 -0
  279. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/composable.rb +171 -0
  280. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/dsl.rb +545 -0
  281. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/english_phrasing.rb +58 -0
  282. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +82 -0
  283. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/fail_matchers.rb +42 -0
  284. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/generated_descriptions.rb +41 -0
  285. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/matcher_delegator.rb +35 -0
  286. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers/matcher_protocol.rb +105 -0
  287. data/bundle/ruby/2.7.0/gems/rspec-expectations-3.12.1/lib/rspec/matchers.rb +1044 -0
  288. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/.document +5 -0
  289. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/.yardopts +6 -0
  290. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/Changelog.md +1227 -0
  291. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/LICENSE.md +25 -0
  292. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/README.md +463 -0
  293. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/chain.rb +111 -0
  294. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
  295. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/expect_chain_chain.rb +31 -0
  296. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/expectation_chain.rb +50 -0
  297. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
  298. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/proxy.rb +116 -0
  299. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/recorder.rb +295 -0
  300. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/stub_chain.rb +51 -0
  301. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance/stub_chain_chain.rb +23 -0
  302. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/any_instance.rb +11 -0
  303. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/argument_list_matcher.rb +115 -0
  304. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/argument_matchers.rb +322 -0
  305. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/configuration.rb +212 -0
  306. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/error_generator.rb +390 -0
  307. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/example_methods.rb +434 -0
  308. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/instance_method_stasher.rb +146 -0
  309. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/marshal_extension.rb +41 -0
  310. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
  311. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/matchers/have_received.rb +134 -0
  312. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/matchers/receive.rb +133 -0
  313. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/matchers/receive_message_chain.rb +82 -0
  314. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/matchers/receive_messages.rb +77 -0
  315. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/message_chain.rb +87 -0
  316. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/message_expectation.rb +820 -0
  317. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/method_double.rb +309 -0
  318. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/method_reference.rb +214 -0
  319. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/minitest_integration.rb +68 -0
  320. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/mutate_const.rb +339 -0
  321. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/object_reference.rb +149 -0
  322. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/order_group.rb +81 -0
  323. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/proxy.rb +519 -0
  324. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/space.rb +238 -0
  325. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/standalone.rb +3 -0
  326. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/syntax.rb +325 -0
  327. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/targets.rb +124 -0
  328. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/test_double.rb +171 -0
  329. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/verifying_double.rb +121 -0
  330. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/verifying_message_expectation.rb +55 -0
  331. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/verifying_proxy.rb +220 -0
  332. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks/version.rb +9 -0
  333. data/bundle/ruby/2.7.0/gems/rspec-mocks-3.12.1/lib/rspec/mocks.rb +133 -0
  334. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/Changelog.md +364 -0
  335. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/LICENSE.md +23 -0
  336. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/README.md +40 -0
  337. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/caller_filter.rb +83 -0
  338. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/comparable_version.rb +46 -0
  339. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/differ.rb +215 -0
  340. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/directory_maker.rb +63 -0
  341. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/encoded_string.rb +161 -0
  342. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
  343. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/hunk_generator.rb +47 -0
  344. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/matcher_definition.rb +42 -0
  345. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/method_signature_verifier.rb +438 -0
  346. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/mutex.rb +73 -0
  347. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/object_formatter.rb +275 -0
  348. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/recursive_const_methods.rb +76 -0
  349. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/reentrant_mutex.rb +78 -0
  350. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/ruby_features.rb +198 -0
  351. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/source/location.rb +21 -0
  352. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/source/node.rb +110 -0
  353. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/source/token.rb +94 -0
  354. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/source.rb +85 -0
  355. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/deprecation_helpers.rb +48 -0
  356. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/diff_helpers.rb +31 -0
  357. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/formatting_support.rb +9 -0
  358. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/in_sub_process.rb +67 -0
  359. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/library_wide_checks.rb +150 -0
  360. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/shell_out.rb +105 -0
  361. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/stderr_splitter.rb +75 -0
  362. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/string_matcher.rb +45 -0
  363. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/with_isolated_directory.rb +13 -0
  364. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
  365. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/spec.rb +82 -0
  366. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/version.rb +7 -0
  367. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/warnings.rb +39 -0
  368. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support/with_keywords_when_needed.rb +33 -0
  369. data/bundle/ruby/2.7.0/gems/rspec-support-3.12.0/lib/rspec/support.rb +154 -0
  370. data/bundle/ruby/2.7.0/specifications/diff-lcs-1.5.0.gemspec +50 -0
  371. data/bundle/ruby/2.7.0/specifications/rake-13.0.3.gemspec +26 -0
  372. data/bundle/ruby/2.7.0/specifications/rspec-3.12.0.gemspec +39 -0
  373. data/bundle/ruby/2.7.0/specifications/rspec-core-3.12.0.gemspec +53 -0
  374. data/bundle/ruby/2.7.0/specifications/rspec-expectations-3.12.1.gemspec +44 -0
  375. data/bundle/ruby/2.7.0/specifications/rspec-mocks-3.12.1.gemspec +44 -0
  376. data/bundle/ruby/2.7.0/specifications/rspec-support-3.12.0.gemspec +36 -0
  377. data/lib/takuya/lvm_snapshot/version.rb +7 -0
  378. data/lib/takuya/lvm_snapshot.rb +111 -0
  379. data/takuya-lvm-snapshot.gemspec +34 -0
  380. metadata +424 -0
@@ -0,0 +1,820 @@
1
+ RSpec::Support.require_rspec_support 'mutex'
2
+
3
+ module RSpec
4
+ module Mocks
5
+ # A message expectation that only allows concrete return values to be set
6
+ # for a message. While this same effect can be achieved using a standard
7
+ # MessageExpectation, this version is much faster and so can be used as an
8
+ # optimization.
9
+ #
10
+ # @private
11
+ class SimpleMessageExpectation
12
+ def initialize(message, response, error_generator, backtrace_line=nil)
13
+ @message, @response, @error_generator, @backtrace_line = message.to_sym, response, error_generator, backtrace_line
14
+ @received = false
15
+ end
16
+
17
+ def invoke(*_)
18
+ @received = true
19
+ @response
20
+ end
21
+
22
+ def matches?(message, *_)
23
+ @message == message.to_sym
24
+ end
25
+
26
+ def called_max_times?
27
+ false
28
+ end
29
+
30
+ def verify_messages_received
31
+ return if @received
32
+ @error_generator.raise_expectation_error(
33
+ @message, 1, ArgumentListMatcher::MATCH_ALL, 0, nil, [], @backtrace_line
34
+ )
35
+ end
36
+
37
+ def unadvise(_)
38
+ end
39
+ end
40
+
41
+ # Represents an individual method stub or message expectation. The methods
42
+ # defined here can be used to configure how it behaves. The methods return
43
+ # `self` so that they can be chained together to form a fluent interface.
44
+ class MessageExpectation
45
+ # @!group Configuring Responses
46
+
47
+ # @overload and_return(value)
48
+ # @overload and_return(first_value, second_value)
49
+ #
50
+ # Tells the object to return a value when it receives the message. Given
51
+ # more than one value, the first value is returned the first time the
52
+ # message is received, the second value is returned the next time, etc,
53
+ # etc.
54
+ #
55
+ # If the message is received more times than there are values, the last
56
+ # value is returned for every subsequent call.
57
+ #
58
+ # @return [nil] No further chaining is supported after this.
59
+ # @example
60
+ # allow(counter).to receive(:count).and_return(1)
61
+ # counter.count # => 1
62
+ # counter.count # => 1
63
+ #
64
+ # allow(counter).to receive(:count).and_return(1,2,3)
65
+ # counter.count # => 1
66
+ # counter.count # => 2
67
+ # counter.count # => 3
68
+ # counter.count # => 3
69
+ # counter.count # => 3
70
+ # # etc
71
+ def and_return(first_value, *values)
72
+ raise_already_invoked_error_if_necessary(__method__)
73
+ if negative?
74
+ raise "`and_return` is not supported with negative message expectations"
75
+ end
76
+
77
+ if block_given?
78
+ raise ArgumentError, "Implementation blocks aren't supported with `and_return`"
79
+ end
80
+
81
+ values.unshift(first_value)
82
+ @expected_received_count = [@expected_received_count, values.size].max unless ignoring_args? || (@expected_received_count == 0 && @at_least)
83
+ self.terminal_implementation_action = AndReturnImplementation.new(values)
84
+
85
+ nil
86
+ end
87
+
88
+ # Tells the object to invoke a Proc when it receives the message. Given
89
+ # more than one value, the result of the first Proc is returned the first
90
+ # time the message is received, the result of the second Proc is returned
91
+ # the next time, etc, etc.
92
+ #
93
+ # If the message is received more times than there are Procs, the result of
94
+ # the last Proc is returned for every subsequent call.
95
+ #
96
+ # @return [nil] No further chaining is supported after this.
97
+ # @example
98
+ # allow(api).to receive(:get_foo).and_invoke(-> { raise ApiTimeout })
99
+ # api.get_foo # => raises ApiTimeout
100
+ # api.get_foo # => raises ApiTimeout
101
+ #
102
+ # allow(api).to receive(:get_foo).and_invoke(-> { raise ApiTimeout }, -> { raise ApiTimeout }, -> { :a_foo })
103
+ # api.get_foo # => raises ApiTimeout
104
+ # api.get_foo # => rasies ApiTimeout
105
+ # api.get_foo # => :a_foo
106
+ # api.get_foo # => :a_foo
107
+ # api.get_foo # => :a_foo
108
+ # # etc
109
+ def and_invoke(first_proc, *procs)
110
+ raise_already_invoked_error_if_necessary(__method__)
111
+ if negative?
112
+ raise "`and_invoke` is not supported with negative message expectations"
113
+ end
114
+
115
+ if block_given?
116
+ raise ArgumentError, "Implementation blocks aren't supported with `and_invoke`"
117
+ end
118
+
119
+ procs.unshift(first_proc)
120
+ if procs.any? { |p| !p.respond_to?(:call) }
121
+ raise ArgumentError, "Arguments to `and_invoke` must be callable."
122
+ end
123
+
124
+ @expected_received_count = [@expected_received_count, procs.size].max unless ignoring_args? || (@expected_received_count == 0 && @at_least)
125
+ self.terminal_implementation_action = AndInvokeImplementation.new(procs)
126
+
127
+ nil
128
+ end
129
+
130
+ # Tells the object to delegate to the original unmodified method
131
+ # when it receives the message.
132
+ #
133
+ # @note This is only available on partial doubles.
134
+ #
135
+ # @return [nil] No further chaining is supported after this.
136
+ # @example
137
+ # expect(counter).to receive(:increment).and_call_original
138
+ # original_count = counter.count
139
+ # counter.increment
140
+ # expect(counter.count).to eq(original_count + 1)
141
+ def and_call_original
142
+ block = lambda do |original, *args, &b|
143
+ original.call(*args, &b)
144
+ end
145
+ block = block.ruby2_keywords if block.respond_to?(:ruby2_keywords)
146
+
147
+ wrap_original(__method__, &block)
148
+ end
149
+
150
+ # Decorates the stubbed method with the supplied block. The original
151
+ # unmodified method is passed to the block along with any method call
152
+ # arguments so you can delegate to it, whilst still being able to
153
+ # change what args are passed to it and/or change the return value.
154
+ #
155
+ # @note This is only available on partial doubles.
156
+ #
157
+ # @return [nil] No further chaining is supported after this.
158
+ # @example
159
+ # expect(api).to receive(:large_list).and_wrap_original do |original_method, *args, &block|
160
+ # original_method.call(*args, &block).first(10)
161
+ # end
162
+ def and_wrap_original(&block)
163
+ wrap_original(__method__, &block)
164
+ end
165
+
166
+ # @overload and_raise
167
+ # @overload and_raise(ExceptionClass)
168
+ # @overload and_raise(ExceptionClass, message)
169
+ # @overload and_raise(exception_instance)
170
+ #
171
+ # Tells the object to raise an exception when the message is received.
172
+ #
173
+ # @return [nil] No further chaining is supported after this.
174
+ # @note
175
+ # When you pass an exception class, the MessageExpectation will raise
176
+ # an instance of it, creating it with `exception` and passing `message`
177
+ # if specified. If the exception class initializer requires more than
178
+ # one parameters, you must pass in an instance and not the class,
179
+ # otherwise this method will raise an ArgumentError exception.
180
+ #
181
+ # @example
182
+ # allow(car).to receive(:go).and_raise
183
+ # allow(car).to receive(:go).and_raise(OutOfGas)
184
+ # allow(car).to receive(:go).and_raise(OutOfGas, "At least 2 oz of gas needed to drive")
185
+ # allow(car).to receive(:go).and_raise(OutOfGas.new(2, :oz))
186
+ def and_raise(*args)
187
+ raise_already_invoked_error_if_necessary(__method__)
188
+ self.terminal_implementation_action = Proc.new { raise(*args) }
189
+ nil
190
+ end
191
+
192
+ # @overload and_throw(symbol)
193
+ # @overload and_throw(symbol, object)
194
+ #
195
+ # Tells the object to throw a symbol (with the object if that form is
196
+ # used) when the message is received.
197
+ #
198
+ # @return [nil] No further chaining is supported after this.
199
+ # @example
200
+ # allow(car).to receive(:go).and_throw(:out_of_gas)
201
+ # allow(car).to receive(:go).and_throw(:out_of_gas, :level => 0.1)
202
+ def and_throw(*args)
203
+ raise_already_invoked_error_if_necessary(__method__)
204
+ self.terminal_implementation_action = Proc.new { throw(*args) }
205
+ nil
206
+ end
207
+
208
+ # Tells the object to yield one or more args to a block when the message
209
+ # is received.
210
+ #
211
+ # @return [MessageExpectation] self, to support further chaining.
212
+ # @example
213
+ # stream.stub(:open).and_yield(StringIO.new)
214
+ def and_yield(*args, &block)
215
+ raise_already_invoked_error_if_necessary(__method__)
216
+ yield @eval_context = Object.new if block
217
+
218
+ # Initialize args to yield now that it's being used, see also: comment
219
+ # in constructor.
220
+ @args_to_yield ||= []
221
+
222
+ @args_to_yield << args
223
+ self.initial_implementation_action = AndYieldImplementation.new(@args_to_yield, @eval_context, @error_generator)
224
+ self
225
+ end
226
+ # @!endgroup
227
+
228
+ # @!group Constraining Receive Counts
229
+
230
+ # Constrain a message expectation to be received a specific number of
231
+ # times.
232
+ #
233
+ # @return [MessageExpectation] self, to support further chaining.
234
+ # @example
235
+ # expect(dealer).to receive(:deal_card).exactly(10).times
236
+ def exactly(n, &block)
237
+ raise_already_invoked_error_if_necessary(__method__)
238
+ self.inner_implementation_action = block
239
+ set_expected_received_count :exactly, n
240
+ self
241
+ end
242
+
243
+ # Constrain a message expectation to be received at least a specific
244
+ # number of times.
245
+ #
246
+ # @return [MessageExpectation] self, to support further chaining.
247
+ # @example
248
+ # expect(dealer).to receive(:deal_card).at_least(9).times
249
+ def at_least(n, &block)
250
+ raise_already_invoked_error_if_necessary(__method__)
251
+ set_expected_received_count :at_least, n
252
+
253
+ if n == 0
254
+ raise "at_least(0) has been removed, use allow(...).to receive(:message) instead"
255
+ end
256
+
257
+ self.inner_implementation_action = block
258
+
259
+ self
260
+ end
261
+
262
+ # Constrain a message expectation to be received at most a specific
263
+ # number of times.
264
+ #
265
+ # @return [MessageExpectation] self, to support further chaining.
266
+ # @example
267
+ # expect(dealer).to receive(:deal_card).at_most(10).times
268
+ def at_most(n, &block)
269
+ raise_already_invoked_error_if_necessary(__method__)
270
+ self.inner_implementation_action = block
271
+ set_expected_received_count :at_most, n
272
+ self
273
+ end
274
+
275
+ # Syntactic sugar for `exactly`, `at_least` and `at_most`
276
+ #
277
+ # @return [MessageExpectation] self, to support further chaining.
278
+ # @example
279
+ # expect(dealer).to receive(:deal_card).exactly(10).times
280
+ # expect(dealer).to receive(:deal_card).at_least(10).times
281
+ # expect(dealer).to receive(:deal_card).at_most(10).times
282
+ def times(&block)
283
+ self.inner_implementation_action = block
284
+ self
285
+ end
286
+ alias time times
287
+
288
+ # Expect a message not to be received at all.
289
+ #
290
+ # @return [MessageExpectation] self, to support further chaining.
291
+ # @example
292
+ # expect(car).to receive(:stop).never
293
+ def never
294
+ error_generator.raise_double_negation_error("expect(obj)") if negative?
295
+ @expected_received_count = 0
296
+ self
297
+ end
298
+
299
+ # Expect a message to be received exactly one time.
300
+ #
301
+ # @return [MessageExpectation] self, to support further chaining.
302
+ # @example
303
+ # expect(car).to receive(:go).once
304
+ def once(&block)
305
+ self.inner_implementation_action = block
306
+ set_expected_received_count :exactly, 1
307
+ self
308
+ end
309
+
310
+ # Expect a message to be received exactly two times.
311
+ #
312
+ # @return [MessageExpectation] self, to support further chaining.
313
+ # @example
314
+ # expect(car).to receive(:go).twice
315
+ def twice(&block)
316
+ self.inner_implementation_action = block
317
+ set_expected_received_count :exactly, 2
318
+ self
319
+ end
320
+
321
+ # Expect a message to be received exactly three times.
322
+ #
323
+ # @return [MessageExpectation] self, to support further chaining.
324
+ # @example
325
+ # expect(car).to receive(:go).thrice
326
+ def thrice(&block)
327
+ self.inner_implementation_action = block
328
+ set_expected_received_count :exactly, 3
329
+ self
330
+ end
331
+ # @!endgroup
332
+
333
+ # @!group Other Constraints
334
+
335
+ # Constrains a stub or message expectation to invocations with specific
336
+ # arguments.
337
+ #
338
+ # With a stub, if the message might be received with other args as well,
339
+ # you should stub a default value first, and then stub or mock the same
340
+ # message using `with` to constrain to specific arguments.
341
+ #
342
+ # A message expectation will fail if the message is received with different
343
+ # arguments.
344
+ #
345
+ # @return [MessageExpectation] self, to support further chaining.
346
+ # @example
347
+ # allow(cart).to receive(:add) { :failure }
348
+ # allow(cart).to receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
349
+ # cart.add(Book.new(:isbn => 1234567890))
350
+ # # => :failure
351
+ # cart.add(Book.new(:isbn => 1934356379))
352
+ # # => :success
353
+ #
354
+ # expect(cart).to receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
355
+ # cart.add(Book.new(:isbn => 1234567890))
356
+ # # => failed expectation
357
+ # cart.add(Book.new(:isbn => 1934356379))
358
+ # # => passes
359
+ def with(*args, &block)
360
+ raise_already_invoked_error_if_necessary(__method__)
361
+ if args.empty?
362
+ raise ArgumentError,
363
+ "`with` must have at least one argument. Use `no_args` matcher to set the expectation of receiving no arguments."
364
+ end
365
+
366
+ self.inner_implementation_action = block
367
+ @argument_list_matcher = ArgumentListMatcher.new(*args)
368
+ self
369
+ end
370
+ ruby2_keywords(:with) if respond_to?(:ruby2_keywords, true)
371
+
372
+ # Expect messages to be received in a specific order.
373
+ #
374
+ # @return [MessageExpectation] self, to support further chaining.
375
+ # @example
376
+ # expect(api).to receive(:prepare).ordered
377
+ # expect(api).to receive(:run).ordered
378
+ # expect(api).to receive(:finish).ordered
379
+ def ordered(&block)
380
+ if type == :stub
381
+ RSpec.warning(
382
+ "`allow(...).to receive(..).ordered` is not supported and will " \
383
+ "have no effect, use `and_return(*ordered_values)` instead."
384
+ )
385
+ end
386
+
387
+ self.inner_implementation_action = block
388
+ additional_expected_calls.times do
389
+ @order_group.register(self)
390
+ end
391
+ @ordered = true
392
+ self
393
+ end
394
+
395
+ # @return [String] a nice representation of the message expectation
396
+ def to_s
397
+ args_description = error_generator.method_call_args_description(@argument_list_matcher.expected_args, "", "") { true }
398
+ args_description = "(#{args_description})" unless args_description.start_with?("(")
399
+ "#<#{self.class} #{error_generator.intro}.#{message}#{args_description}>"
400
+ end
401
+ alias inspect to_s
402
+
403
+ # @private
404
+ # Contains the parts of `MessageExpectation` that aren't part of
405
+ # rspec-mocks' public API. The class is very big and could really use
406
+ # some collaborators it delegates to for this stuff but for now this was
407
+ # the simplest way to split the public from private stuff to make it
408
+ # easier to publish the docs for the APIs we want published.
409
+ module ImplementationDetails
410
+ attr_accessor :error_generator, :implementation
411
+ attr_reader :message
412
+ attr_reader :orig_object
413
+ attr_writer :expected_received_count, :expected_from, :argument_list_matcher
414
+ protected :expected_received_count=, :expected_from=, :error_generator=, :implementation=
415
+
416
+ # @private
417
+ attr_reader :type
418
+
419
+ # rubocop:disable Metrics/ParameterLists
420
+ def initialize(error_generator, expectation_ordering, expected_from, method_double,
421
+ type=:expectation, opts={}, &implementation_block)
422
+ @type = type
423
+ @error_generator = error_generator
424
+ @error_generator.opts = error_generator.opts.merge(opts)
425
+ @expected_from = expected_from
426
+ @method_double = method_double
427
+ @orig_object = @method_double.object
428
+ @message = @method_double.method_name
429
+ @actual_received_count = 0
430
+ @actual_received_count_write_mutex = Support::Mutex.new
431
+ @expected_received_count = type == :expectation ? 1 : :any
432
+ @argument_list_matcher = ArgumentListMatcher::MATCH_ALL
433
+ @order_group = expectation_ordering
434
+ @order_group.register(self) unless type == :stub
435
+ @expectation_type = type
436
+ @ordered = false
437
+ @at_least = @at_most = @exactly = nil
438
+
439
+ # Initialized to nil so that we don't allocate an array for every
440
+ # mock or stub. See also comment in `and_yield`.
441
+ @args_to_yield = nil
442
+ @eval_context = nil
443
+ @yield_receiver_to_implementation_block = false
444
+
445
+ @implementation = Implementation.new
446
+ self.inner_implementation_action = implementation_block
447
+ end
448
+ # rubocop:enable Metrics/ParameterLists
449
+
450
+ def expected_args
451
+ @argument_list_matcher.expected_args
452
+ end
453
+
454
+ def and_yield_receiver_to_implementation
455
+ @yield_receiver_to_implementation_block = true
456
+ self
457
+ end
458
+
459
+ def yield_receiver_to_implementation_block?
460
+ @yield_receiver_to_implementation_block
461
+ end
462
+
463
+ def matches?(message, *args)
464
+ @message == message && @argument_list_matcher.args_match?(*args)
465
+ end
466
+ ruby2_keywords :matches? if respond_to?(:ruby2_keywords, true)
467
+
468
+ def safe_invoke(parent_stub, *args, &block)
469
+ invoke_incrementing_actual_calls_by(1, false, parent_stub, *args, &block)
470
+ end
471
+ ruby2_keywords :safe_invoke if respond_to?(:ruby2_keywords, true)
472
+
473
+ def invoke(parent_stub, *args, &block)
474
+ invoke_incrementing_actual_calls_by(1, true, parent_stub, *args, &block)
475
+ end
476
+ ruby2_keywords :invoke if respond_to?(:ruby2_keywords, true)
477
+
478
+ def invoke_without_incrementing_received_count(parent_stub, *args, &block)
479
+ invoke_incrementing_actual_calls_by(0, true, parent_stub, *args, &block)
480
+ end
481
+ ruby2_keywords :invoke_without_incrementing_received_count if respond_to?(:ruby2_keywords, true)
482
+
483
+ def negative?
484
+ @expected_received_count == 0 && !@at_least
485
+ end
486
+
487
+ def called_max_times?
488
+ @expected_received_count != :any &&
489
+ !@at_least &&
490
+ @expected_received_count > 0 &&
491
+ @actual_received_count >= @expected_received_count
492
+ end
493
+
494
+ def matches_name_but_not_args(message, *args)
495
+ @message == message && !@argument_list_matcher.args_match?(*args)
496
+ end
497
+
498
+ def verify_messages_received
499
+ return if expected_messages_received?
500
+ generate_error
501
+ end
502
+
503
+ def expected_messages_received?
504
+ ignoring_args? || matches_exact_count? || matches_at_least_count? || matches_at_most_count?
505
+ end
506
+
507
+ def ensure_expected_ordering_received!
508
+ @order_group.verify_invocation_order(self) if @ordered
509
+ true
510
+ end
511
+
512
+ def ignoring_args?
513
+ @expected_received_count == :any
514
+ end
515
+
516
+ def matches_at_least_count?
517
+ @at_least && @actual_received_count >= @expected_received_count
518
+ end
519
+
520
+ def matches_at_most_count?
521
+ @at_most && @actual_received_count <= @expected_received_count
522
+ end
523
+
524
+ def matches_exact_count?
525
+ @expected_received_count == @actual_received_count
526
+ end
527
+
528
+ def similar_messages
529
+ @similar_messages ||= []
530
+ end
531
+
532
+ def advise(*args)
533
+ similar_messages << args
534
+ end
535
+
536
+ def unadvise(args)
537
+ similar_messages.delete_if { |message| args.include?(message) }
538
+ end
539
+
540
+ def generate_error
541
+ if similar_messages.empty?
542
+ @error_generator.raise_expectation_error(
543
+ @message, @expected_received_count, @argument_list_matcher,
544
+ @actual_received_count, expectation_count_type, expected_args,
545
+ @expected_from, exception_source_id
546
+ )
547
+ else
548
+ @error_generator.raise_similar_message_args_error(
549
+ self, @similar_messages, @expected_from
550
+ )
551
+ end
552
+ end
553
+
554
+ def raise_unexpected_message_args_error(args_for_multiple_calls)
555
+ @error_generator.raise_unexpected_message_args_error(self, args_for_multiple_calls, exception_source_id)
556
+ end
557
+
558
+ def expectation_count_type
559
+ return :at_least if @at_least
560
+ return :at_most if @at_most
561
+ nil
562
+ end
563
+
564
+ def description_for(verb)
565
+ @error_generator.describe_expectation(
566
+ verb, @message, @expected_received_count,
567
+ @actual_received_count, expected_args
568
+ )
569
+ end
570
+
571
+ def raise_out_of_order_error
572
+ @error_generator.raise_out_of_order_error @message
573
+ end
574
+
575
+ def additional_expected_calls
576
+ return 0 if @expectation_type == :stub || !@exactly
577
+ @expected_received_count - 1
578
+ end
579
+
580
+ def ordered?
581
+ @ordered
582
+ end
583
+
584
+ def negative_expectation_for?(message)
585
+ @message == message && negative?
586
+ end
587
+
588
+ def actual_received_count_matters?
589
+ @at_least || @at_most || @exactly
590
+ end
591
+
592
+ def increase_actual_received_count!
593
+ @actual_received_count_write_mutex.synchronize do
594
+ @actual_received_count += 1
595
+ end
596
+ end
597
+
598
+ private
599
+
600
+ def exception_source_id
601
+ @exception_source_id ||= "#{self.class.name} #{__id__}"
602
+ end
603
+
604
+ def invoke_incrementing_actual_calls_by(increment, allowed_to_fail, parent_stub, *args, &block)
605
+ args.unshift(orig_object) if yield_receiver_to_implementation_block?
606
+
607
+ if negative? || (allowed_to_fail && (@exactly || @at_most) && (@actual_received_count == @expected_received_count))
608
+ # args are the args we actually received, @argument_list_matcher is the
609
+ # list of args we were expecting
610
+ @error_generator.raise_expectation_error(
611
+ @message, @expected_received_count,
612
+ @argument_list_matcher,
613
+ @actual_received_count + increment,
614
+ expectation_count_type, args, nil, exception_source_id
615
+ )
616
+ end
617
+
618
+ @order_group.handle_order_constraint self
619
+
620
+ if implementation.present?
621
+ implementation.call(*args, &block)
622
+ elsif parent_stub
623
+ parent_stub.invoke(nil, *args, &block)
624
+ end
625
+ ensure
626
+ @actual_received_count_write_mutex.synchronize do
627
+ @actual_received_count += increment
628
+ end
629
+ end
630
+ ruby2_keywords :invoke_incrementing_actual_calls_by if respond_to?(:ruby2_keywords, true)
631
+
632
+ def has_been_invoked?
633
+ @actual_received_count > 0
634
+ end
635
+
636
+ def raise_already_invoked_error_if_necessary(calling_customization)
637
+ return unless has_been_invoked?
638
+
639
+ error_generator.raise_already_invoked_error(message, calling_customization)
640
+ end
641
+
642
+ def set_expected_received_count(relativity, n)
643
+ raise "`count` is not supported with negative message expectations" if negative?
644
+ @at_least = (relativity == :at_least)
645
+ @at_most = (relativity == :at_most)
646
+ @exactly = (relativity == :exactly)
647
+ @expected_received_count = case n
648
+ when Numeric then n
649
+ when :once then 1
650
+ when :twice then 2
651
+ when :thrice then 3
652
+ end
653
+ end
654
+
655
+ def initial_implementation_action=(action)
656
+ implementation.initial_action = action
657
+ end
658
+
659
+ def inner_implementation_action=(action)
660
+ return unless action
661
+ warn_about_stub_override if implementation.inner_action
662
+ implementation.inner_action = action
663
+ end
664
+
665
+ def terminal_implementation_action=(action)
666
+ implementation.terminal_action = action
667
+ end
668
+
669
+ def warn_about_stub_override
670
+ RSpec.warning(
671
+ "You're overriding a previous stub implementation of `#{@message}`. " \
672
+ "Called from #{CallerFilter.first_non_rspec_line}."
673
+ )
674
+ end
675
+
676
+ def wrap_original(method_name, &block)
677
+ if RSpec::Mocks::TestDouble === @method_double.object
678
+ @error_generator.raise_only_valid_on_a_partial_double(method_name)
679
+ else
680
+ warn_about_stub_override if implementation.inner_action
681
+ @implementation = AndWrapOriginalImplementation.new(@method_double.original_implementation_callable, block)
682
+ @yield_receiver_to_implementation_block = false
683
+ end
684
+
685
+ nil
686
+ end
687
+ end
688
+
689
+ include ImplementationDetails
690
+ end
691
+
692
+ # Handles the implementation of an `and_yield` declaration.
693
+ # @private
694
+ class AndYieldImplementation
695
+ def initialize(args_to_yield, eval_context, error_generator)
696
+ @args_to_yield = args_to_yield
697
+ @eval_context = eval_context
698
+ @error_generator = error_generator
699
+ end
700
+
701
+ def call(*_args_to_ignore, &block)
702
+ return if @args_to_yield.empty? && @eval_context.nil?
703
+
704
+ @error_generator.raise_missing_block_error @args_to_yield unless block
705
+ value = nil
706
+ block_signature = Support::BlockSignature.new(block)
707
+
708
+ @args_to_yield.each do |args|
709
+ unless Support::StrictSignatureVerifier.new(block_signature, args).valid?
710
+ @error_generator.raise_wrong_arity_error(args, block_signature)
711
+ end
712
+
713
+ value = @eval_context ? @eval_context.instance_exec(*args, &block) : yield(*args)
714
+ end
715
+ value
716
+ end
717
+ end
718
+
719
+ # Handles the implementation of an `and_return` implementation.
720
+ # @private
721
+ class AndReturnImplementation
722
+ def initialize(values_to_return)
723
+ @values_to_return = values_to_return
724
+ end
725
+
726
+ def call(*_args_to_ignore, &_block)
727
+ if @values_to_return.size > 1
728
+ @values_to_return.shift
729
+ else
730
+ @values_to_return.first
731
+ end
732
+ end
733
+ end
734
+
735
+ # Handles the implementation of an `and_invoke` implementation.
736
+ # @private
737
+ class AndInvokeImplementation
738
+ def initialize(procs_to_invoke)
739
+ @procs_to_invoke = procs_to_invoke
740
+ end
741
+
742
+ def call(*args, &block)
743
+ proc = if @procs_to_invoke.size > 1
744
+ @procs_to_invoke.shift
745
+ else
746
+ @procs_to_invoke.first
747
+ end
748
+
749
+ proc.call(*args, &block)
750
+ end
751
+ end
752
+
753
+ # Represents a configured implementation. Takes into account
754
+ # any number of sub-implementations.
755
+ # @private
756
+ class Implementation
757
+ attr_accessor :initial_action, :inner_action, :terminal_action
758
+
759
+ def call(*args, &block)
760
+ actions.map do |action|
761
+ action.call(*args, &block)
762
+ end.last
763
+ end
764
+ ruby2_keywords :call if respond_to?(:ruby2_keywords, true)
765
+
766
+ def present?
767
+ actions.any?
768
+ end
769
+
770
+ private
771
+
772
+ def actions
773
+ [initial_action, inner_action, terminal_action].compact
774
+ end
775
+ end
776
+
777
+ # Represents an `and_call_original` implementation.
778
+ # @private
779
+ class AndWrapOriginalImplementation
780
+ def initialize(method, block)
781
+ @method = method
782
+ @block = block
783
+ end
784
+
785
+ CannotModifyFurtherError = Class.new(StandardError)
786
+
787
+ def initial_action=(_value)
788
+ raise cannot_modify_further_error
789
+ end
790
+
791
+ def inner_action=(_value)
792
+ raise cannot_modify_further_error
793
+ end
794
+
795
+ def terminal_action=(_value)
796
+ raise cannot_modify_further_error
797
+ end
798
+
799
+ def present?
800
+ true
801
+ end
802
+
803
+ def inner_action
804
+ true
805
+ end
806
+
807
+ def call(*args, &block)
808
+ @block.call(@method, *args, &block)
809
+ end
810
+ ruby2_keywords :call if respond_to?(:ruby2_keywords, true)
811
+
812
+ private
813
+
814
+ def cannot_modify_further_error
815
+ CannotModifyFurtherError.new "This method has already been configured " \
816
+ "to call the original implementation, and cannot be modified further."
817
+ end
818
+ end
819
+ end
820
+ end