rr 1.1.2 → 3.0.2

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 (157) hide show
  1. checksums.yaml +5 -5
  2. data/Appraisals +3 -43
  3. data/CHANGES.md +93 -0
  4. data/CREDITS.md +5 -0
  5. data/Gemfile +1 -17
  6. data/README.md +29 -32
  7. data/Rakefile +42 -40
  8. data/doc/02_syntax_comparison.md +1 -0
  9. data/lib/rr/class_instance_method_defined.rb +1 -1
  10. data/lib/rr/core_ext/array.rb +2 -0
  11. data/lib/rr/core_ext/hash.rb +2 -0
  12. data/lib/rr/deprecations.rb +97 -0
  13. data/lib/rr/double.rb +28 -10
  14. data/lib/rr/double_definitions/double_definition.rb +39 -16
  15. data/lib/rr/double_definitions/double_definition_create.rb +5 -5
  16. data/lib/rr/double_definitions/double_definition_create_blank_slate.rb +10 -4
  17. data/lib/rr/double_definitions/double_injections/any_instance_of.rb +1 -1
  18. data/lib/rr/double_definitions/double_injections/instance.rb +2 -2
  19. data/lib/rr/double_definitions/strategies/strategy.rb +27 -8
  20. data/lib/rr/double_definitions/strategies/verification/mock.rb +8 -2
  21. data/lib/rr/double_matches.rb +4 -3
  22. data/lib/rr/dsl.rb +152 -0
  23. data/lib/rr/expectations/any_argument_expectation.rb +4 -4
  24. data/lib/rr/expectations/argument_equality_expectation.rb +43 -5
  25. data/lib/rr/injections/double_injection.rb +85 -26
  26. data/lib/rr/injections/method_missing_injection.rb +37 -6
  27. data/lib/rr/integrations/minitest_4.rb +1 -1
  28. data/lib/rr/integrations/minitest_4_active_support.rb +1 -1
  29. data/lib/rr/integrations/rspec/invocation_matcher.rb +0 -8
  30. data/lib/rr/integrations/rspec_2.rb +20 -2
  31. data/lib/rr/keyword_arguments.rb +15 -0
  32. data/lib/rr/method_dispatches/base_method_dispatch.rb +22 -5
  33. data/lib/rr/method_dispatches/method_dispatch.rb +21 -10
  34. data/lib/rr/method_dispatches/method_missing_dispatch.rb +14 -5
  35. data/lib/rr/recorded_call.rb +35 -0
  36. data/lib/rr/recorded_calls.rb +23 -9
  37. data/lib/rr/space.rb +15 -5
  38. data/lib/rr/spy_verification.rb +13 -5
  39. data/lib/rr/version.rb +1 -1
  40. data/lib/rr/wildcard_matchers.rb +10 -10
  41. data/lib/rr/without_autohook.rb +7 -14
  42. data/rr.gemspec +8 -3
  43. data/spec/defines_spec_suite_tasks.rb +12 -0
  44. data/spec/global_helper.rb +5 -0
  45. data/spec/spec_suite_configuration.rb +1 -7
  46. data/spec/suites.yml +0 -14
  47. data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +133 -33
  48. data/spec/suites/rspec_2/functional/dont_allow_spec.rb +13 -8
  49. data/spec/suites/rspec_2/functional/mock_bang_spec.rb +20 -0
  50. data/spec/suites/rspec_2/functional/mock_instance_of_spec.rb +14 -0
  51. data/spec/suites/rspec_2/functional/mock_instance_of_strong_spec.rb +15 -0
  52. data/spec/suites/rspec_2/functional/mock_proxy_instance_of_spec.rb +15 -0
  53. data/spec/suites/rspec_2/functional/mock_proxy_spec.rb +14 -0
  54. data/spec/suites/rspec_2/functional/mock_spec.rb +8 -232
  55. data/spec/suites/rspec_2/functional/mock_strong_spec.rb +14 -0
  56. data/spec/suites/rspec_2/functional/received_spec.rb +16 -0
  57. data/spec/suites/rspec_2/functional/spy_spec.rb +89 -28
  58. data/spec/suites/rspec_2/functional/stub_bang_spec.rb +20 -0
  59. data/spec/suites/rspec_2/functional/stub_instance_of_spec.rb +15 -0
  60. data/spec/suites/rspec_2/functional/stub_instance_of_strong_spec.rb +15 -0
  61. data/spec/suites/rspec_2/functional/stub_proxy_instance_of_spec.rb +16 -0
  62. data/spec/suites/rspec_2/functional/stub_proxy_spec.rb +45 -0
  63. data/spec/suites/rspec_2/functional/stub_spec.rb +42 -161
  64. data/spec/suites/rspec_2/functional/stub_strong_spec.rb +15 -0
  65. data/spec/suites/rspec_2/helper.rb +2 -2
  66. data/spec/suites/rspec_2/support/mixins/double_definition_creator_helpers.rb +173 -0
  67. data/spec/suites/rspec_2/support/mixins/mock_definition_creator_helpers.rb +45 -0
  68. data/spec/suites/rspec_2/support/mixins/proxy_definition_creator_helpers.rb +33 -0
  69. data/spec/suites/rspec_2/support/mixins/stub_creator_helpers.rb +43 -0
  70. data/spec/suites/rspec_2/support/mixins/stub_definition_creator_helpers.rb +45 -0
  71. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_with_never_called_qualifier.rb +39 -0
  72. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_with_times_called_qualifier.rb +50 -0
  73. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_without_qualifiers.rb +131 -0
  74. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/dont_allow.rb +148 -0
  75. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_instance_of.rb +26 -0
  76. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_instance_of_strong.rb +28 -0
  77. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_proxy.rb +11 -0
  78. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_strong.rb +37 -0
  79. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mocking.rb +107 -0
  80. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_instance_of.rb +32 -0
  81. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_instance_of_strong.rb +39 -0
  82. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_proxy.rb +11 -0
  83. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_strong.rb +37 -0
  84. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stubbing.rb +57 -0
  85. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/array_flatten_bug.rb +35 -0
  86. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/block_form.rb +31 -0
  87. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/comparing_arity.rb +63 -0
  88. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/object_is_proxy.rb +43 -0
  89. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/sequential_invocations.rb +26 -0
  90. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/setting_implementation.rb +51 -0
  91. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/yields.rb +81 -0
  92. data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +0 -28
  93. data/spec/suites/rspec_2/unit/deprecations_spec.rb +27 -0
  94. data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_spec.rb +18 -18
  95. data/spec/suites/rspec_2/unit/dsl/double_creators_spec.rb +133 -0
  96. data/spec/suites/rspec_2/unit/dsl/space_spec.rb +99 -0
  97. data/spec/suites/rspec_2/unit/dsl/wildcard_matchers_spec.rb +67 -0
  98. data/spec/suites/rspec_2/unit/expectations/any_argument_expectation_spec.rb +9 -9
  99. data/spec/suites/rspec_2/unit/expectations/argument_equality_expectation_spec.rb +21 -21
  100. data/spec/suites/rspec_2/unit/expectations/boolean_argument_equality_expectation_spec.rb +4 -4
  101. data/spec/suites/rspec_2/unit/expectations/hash_including_argument_equality_expectation_spec.rb +31 -21
  102. data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_spec.rb +0 -12
  103. data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +4 -19
  104. data/spec/suites/rspec_2/unit/space_spec.rb +7 -4
  105. data/spec/suites/rspec_2/unit/spy_verification_spec.rb +1 -1
  106. data/spec/support/adapter.rb +1 -1
  107. data/spec/support/adapter_tests/rspec.rb +19 -15
  108. data/spec/support/project/generator.rb +0 -4
  109. metadata +112 -57
  110. data/gemfiles/ruby_18_rspec_1.gemfile +0 -14
  111. data/gemfiles/ruby_18_rspec_1.gemfile.lock +0 -38
  112. data/gemfiles/ruby_18_rspec_1_rails_2.gemfile +0 -18
  113. data/gemfiles/ruby_18_rspec_1_rails_2.gemfile.lock +0 -64
  114. data/gemfiles/ruby_19_rspec_2_rails_3.gemfile +0 -15
  115. data/gemfiles/ruby_19_rspec_2_rails_3.gemfile.lock +0 -123
  116. data/lib/rr/adapters.rb +0 -34
  117. data/lib/rr/adapters/rr_methods.rb +0 -142
  118. data/lib/rr/integrations/rspec_1.rb +0 -46
  119. data/lib/rr/integrations/test_unit_1.rb +0 -63
  120. data/lib/rr/integrations/test_unit_2.rb +0 -17
  121. data/lib/rr/integrations/test_unit_200.rb +0 -27
  122. data/lib/rr/integrations/test_unit_200_active_support.rb +0 -25
  123. data/lib/rr/integrations/test_unit_2_active_support.rb +0 -38
  124. data/lib/rr/proc_from_block.rb +0 -11
  125. data/spec/suites/rspec_1/helper.rb +0 -24
  126. data/spec/suites/rspec_1/integration/rspec_1_spec.rb +0 -93
  127. data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +0 -102
  128. data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +0 -109
  129. data/spec/suites/rspec_1/spec_helper.rb +0 -3
  130. data/spec/suites/rspec_1_rails_2/integration/astc_rails_2_spec.rb +0 -141
  131. data/spec/suites/rspec_1_rails_2/integration/rspec_1_rails_2_spec.rb +0 -132
  132. data/spec/suites/rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb +0 -141
  133. data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +0 -148
  134. data/spec/suites/rspec_1_rails_2/spec_helper.rb +0 -3
  135. data/spec/suites/rspec_2/functional/dsl_spec.rb +0 -13
  136. data/spec/suites/rspec_2/functional/instance_of_spec.rb +0 -14
  137. data/spec/suites/rspec_2/functional/proxy_spec.rb +0 -136
  138. data/spec/suites/rspec_2/functional/strong_spec.rb +0 -79
  139. data/spec/suites/rspec_2/integration/rspec_2_spec.rb +0 -133
  140. data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +0 -102
  141. data/spec/suites/rspec_2/integration/test_unit_2_spec.rb +0 -109
  142. data/spec/suites/rspec_2/unit/adapters/rr_methods/double_creators_spec.rb +0 -135
  143. data/spec/suites/rspec_2/unit/adapters/rr_methods/space_spec.rb +0 -101
  144. data/spec/suites/rspec_2/unit/adapters/rr_methods/wildcard_matchers_spec.rb +0 -69
  145. data/spec/suites/rspec_2/unit/proc_from_block_spec.rb +0 -14
  146. data/spec/suites/rspec_2_rails_3/integration/astc_rails_3_spec.rb +0 -141
  147. data/spec/suites/rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb +0 -148
  148. data/spec/suites/rspec_2_rails_3/integration/rspec_2_rails_3_spec.rb +0 -172
  149. data/spec/suites/rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb +0 -141
  150. data/spec/suites/rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb +0 -148
  151. data/spec/suites/rspec_2_rails_3/spec_helper.rb +0 -3
  152. data/spec/suites/rspec_2_rails_4/integration/astc_rails_4_spec.rb +0 -142
  153. data/spec/suites/rspec_2_rails_4/integration/minitest_4_rails_4_spec.rb +0 -149
  154. data/spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb +0 -173
  155. data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +0 -142
  156. data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +0 -149
  157. data/spec/suites/rspec_2_rails_4/spec_helper.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8b16f1f300c83ac27387ef72db6fc1514b27a1e9
4
- data.tar.gz: 7c082dad820121cb7c9c44cb0f0f1400085b4442
2
+ SHA256:
3
+ metadata.gz: 2b7ca60f4fec0c9f87e1710f6b7faf5ed8a1d52d6c8dd7a8ba82667c1ba920d7
4
+ data.tar.gz: 8c80f469725cc6875ea30384439dc6347e2c998f042c9522eb2c8964a9f7f316
5
5
  SHA512:
6
- metadata.gz: ab2c7e8209606ee44e8cd7ae29eaee652090dc4cfd81d802475fd84c73058cc3e0de9ad36915a8c39111ecc5c0565c6145f886b248610ff078f70d896c88f012
7
- data.tar.gz: 46d2b0399555904b5d6b2d81bc7875cc204fe1875f90e6b8069e75970eaac4a7129ebc45b79b7c45d3388664f94c81d635ea4b5abf1bf04fbe9963fbe92cec13
6
+ metadata.gz: '07490a4037a941546b5b8c2139520d3c0d91d752a73e59cc52ef1bdae2ba2b0579deb57cd202db69eb96b67f89a5c5533699a0f6d439a787f8c999cf10f5bf7d'
7
+ data.tar.gz: '094e48f18e353e818ed21492f95fdc9fb15c23d01ae17689e0c044f86e6282736a73622451633daf88b04602f31b2848a84996cdd62965be717187dcc1f36b08'
data/Appraisals CHANGED
@@ -1,46 +1,6 @@
1
- ruby_18_stuff = proc do
2
- ruby_18_rails_2 = proc do
3
- gem 'rails', '~> 2.3'
4
- gem 'mocha', '~> 0.12.0'
5
- gem 'sqlite3', '~> 1.3', :platforms => :ruby
6
- gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
7
- end
8
-
9
- #---
10
-
11
- appraise 'ruby_18_rspec_1' do
12
- end
13
-
14
- appraise 'ruby_18_rspec_1_rails_2' do
15
- instance_eval &ruby_18_rails_2
16
- end
17
- end
18
-
19
- ruby_19_stuff = proc do
20
- ruby_19_rails_3 = proc do
21
- gem 'rails', '~> 3.0'
22
- end
23
-
24
- ruby_19_rails_4 = proc do
25
- gem 'rails', '4.0.0'
26
- end
27
-
28
- #---
29
-
30
- appraise 'ruby_19_rspec_2' do
31
- end
32
-
33
- appraise 'ruby_19_rspec_2_rails_3' do
34
- instance_eval &ruby_19_rails_3
35
- end
36
-
37
- appraise 'ruby_19_rspec_2_rails_4' do
38
- instance_eval &ruby_19_rails_4
39
- end
1
+ appraise 'ruby_19_rspec_2' do
40
2
  end
41
3
 
42
- if RUBY_VERSION =~ /^1\.8/
43
- instance_eval &ruby_18_stuff
44
- else
45
- instance_eval &ruby_19_stuff
4
+ appraise 'ruby_19_rspec_2_rails_4' do
5
+ gem 'rails', '4.0.0'
46
6
  end
data/CHANGES.md CHANGED
@@ -1,5 +1,98 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.2 - 2021-06-18
4
+
5
+ ### Improvements
6
+
7
+ * `stub`: Added support for Ruby 3.0's keyword arguments.
8
+ [GitHub#82][Reported by akira yamada]
9
+
10
+ ### Thanks
11
+
12
+ * akira yamada
13
+
14
+ ## 3.0.1 - 2021-06-18
15
+
16
+ ### Improvements
17
+
18
+ * Suppressed keyword arguments related warnings on Ruby 2.7.
19
+ [GitHub#81][Reported by akira yamada]
20
+
21
+ ### Thanks
22
+
23
+ * akira yamada
24
+
25
+ ## 3.0.0 - 2021-03-31
26
+
27
+ ### Improvements
28
+
29
+ * Added support for Ruby 3.0's keyword arguments.
30
+ [GitHub#17][Reported by Takuro Ashie]
31
+
32
+ ### Fixes
33
+
34
+ * Fixed a bug that `any_instance_of` doesn't work with class
35
+ hierarchies. [GitHub#12][Reported by Étienne Barrié]
36
+
37
+ ### Thanks
38
+
39
+ * Étienne Barrié
40
+
41
+ * Takuro Ashie
42
+
43
+ ## 1.2.1 - 2017-06-22
44
+
45
+ ### Fixes
46
+
47
+ * Fixed a bug that `RR.reset` resets newly created methods.
48
+ [GitHub#8]
49
+
50
+ ## 1.2.0 - 2016-05-30
51
+
52
+ ### Improvements
53
+
54
+ * Renamed RR::Adapters::RRMethods to RR::DSL.
55
+
56
+ * Deprecated RRMethods.
57
+
58
+ * Updated document. [GitHub#57][Patch by Nikolay Shebanov]
59
+
60
+ * Dropped Ruby 1.8 support.
61
+
62
+ * Dropped Ruby 1.9 support.
63
+
64
+ * Dropped Rails 3 support.
65
+
66
+ * Dropped test-unit integration support. Use
67
+ [test-unit-rr](https://test-unit.github.io/#test-unit-rr).
68
+
69
+ * Supported OpenStruct in Ruby 2.3
70
+ [GitHub#64][Reported by soylent][Reported by Arthur Le Maitre]
71
+
72
+ ### Fixes
73
+
74
+ * Fixed using RSpec's RR adapter to not override our RSpec adapter.
75
+ If RR is required and then you use `mock_with :rr` you would not be able to
76
+ use `have_received`.
77
+
78
+ * Fixed a bug that `Hash` argument is too wild.
79
+ [GitHub#54][Reported by Yutaka HARA]
80
+
81
+ * Fixed a bug that `Array` argument is too wild.
82
+ [GitHub#54][Reported by Skye Shaw]
83
+
84
+ ### Thanks
85
+
86
+ * Nikolay Shebanov
87
+
88
+ * Yutaka HARA
89
+
90
+ * Skye Shaw
91
+
92
+ * soylent
93
+
94
+ * Arthur Le Maitre
95
+
3
96
  ## 1.1.2 (August 17, 2013)
4
97
 
5
98
  * Add tests, appraisals, etc. back to the published gem ([#32][i32]).
data/CREDITS.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Credits
2
2
 
3
+ ## Maintainer
4
+
5
+ * Kouhei Sutou ([@kou](https://github.com/kou))
6
+
7
+
3
8
  ## Authors
4
9
 
5
10
  * Brian Takita ([@btakita](http://github.com/btakita))
data/Gemfile CHANGED
@@ -1,19 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake', '~> 10.0'
4
- gem 'aws-sdk', '~> 1.0'
5
- gem 'minitar', '~> 0.5'
6
- gem 'dotenv', '~> 0.7'
7
- gem 'simplecov', '~> 0.7'
8
- gem 'appraisal', '~> 0.5'
9
- gem 'posix-spawn', :platforms => :mri
10
- gem 'open4', :platforms => :mri
11
-
12
- # Put this here instead of in Appraisals so that when running a single test file
13
- # in development we can say `rspec ...` or `spec ...` instead of having to
14
- # prepend it with BUNDLE_GEMFILE=...
15
- if RUBY_VERSION =~ /^1\.8/
16
- gem 'rspec', '~> 1.3'
17
- else
18
- gem 'rspec', '~> 2.14'
19
- end
3
+ gemspec
data/README.md CHANGED
@@ -1,8 +1,17 @@
1
- # RR [![Gem Version](https://badge.fury.io/rb/rr.png)](http://badge.fury.io/rb/rr) [![Build Status](https://travis-ci.org/rr/rr.png?branch=master)](https://travis-ci.org/rr/rr) [![Code Climate GPA](https://codeclimate.com/github/rr/rr.png)](https://codeclimate.com/github/rr/rr)
1
+ # RR [![Gem Version](https://badge.fury.io/rb/rr.svg)](https://badge.fury.io/rb/rr) [![Build Status](https://travis-ci.org/rr/rr.svg?branch=master)](https://travis-ci.org/rr/rr) [![Code Climate GPA](https://codeclimate.com/github/rr/rr.svg)](https://codeclimate.com/github/rr/rr)
2
2
 
3
3
  RR is a test double framework for Ruby that features a rich selection of double
4
4
  techniques and a terse syntax.
5
5
 
6
+ ---
7
+
8
+ ## Learning more
9
+
10
+ 1. [A whirlwind tour of RR](#a-whirlwind-tour-of-rr)
11
+ 2. [What is a test double?](doc/01_test_double.md)
12
+ 3. [Syntax between RR and other double/mock frameworks](doc/02_syntax_comparison.md)
13
+ 4. [API overview - Full listing of DSL methods](doc/03_api_overview.md)
14
+
6
15
 
7
16
  ## A whirlwind tour of RR
8
17
 
@@ -87,6 +96,11 @@ end
87
96
 
88
97
  ## Installing RR into your project
89
98
 
99
+ NOTE: If you want to use RR with
100
+ [test-unit](https://test-unit.github.io/), use
101
+ [test-unit-rr](https://test-unit.github.io/#test-unit-rr). You don't
102
+ need to read the following subsections.
103
+
90
104
  For minimal setup, RR looks for an existing test framework and then hooks itself
91
105
  into it. Hence, RR works best when loaded *after* the test framework that you
92
106
  are using is loaded.
@@ -129,53 +143,35 @@ require 'your/test/framework' # if you are using something other than MiniTest
129
143
  require 'rr'
130
144
  ~~~
131
145
 
132
-
133
- ## Learning more
134
-
135
- 1. [What is a test double?](doc/01_test_double.md)
136
- 2. [Syntax between RR and other double/mock frameworks](doc/02_syntax_comparison.md)
137
- 3. [API overview](doc/03_api_overview.md)
138
-
139
-
140
146
  ## Compatibility
141
147
 
142
148
  RR is designed and tested to work against the following Ruby versions:
143
149
 
144
- * 1.8.7-p374
145
- * 1.9.3-p392
146
- * 2.0.0-p195
150
+ * 2.4
151
+ * 2.5
152
+ * 2.6
153
+ * 2.7
154
+ * 3.0
147
155
  * JRuby 1.7.4
148
156
 
149
157
  as well as the following test frameworks:
150
158
 
151
- * RSpec 1 (Ruby 1.8.7)
152
- * RSpec 2 (Ruby 1.9+)
153
- * Test::Unit 1 (Ruby 1.8.7)
154
- * Test::Unit 2.4.x (Ruby 1.8.7)
155
- * Test::Unit 2.0.0 (Ruby 1.9+)
156
- * Test::Unit 2.5.x (Ruby 1.9+)
157
- * MiniTest 4 (Ruby 1.9+)
158
- * Minitest 5 (Ruby 1.9+)
159
-
160
- and the following Rails versions:
161
-
162
- * Rails 2.3.x (Ruby 1.8.7)
163
- * Rails 3.2.x (Ruby 1.9+)
164
- * Rails 4.0.x (Ruby 1.9+)
165
-
159
+ * Test::Unit via [test-unit-rr](https://test-unit.github.io/#test-unit-rr)
160
+ * RSpec 2
161
+ * MiniTest 4
162
+ * Minitest 5
166
163
 
167
164
  ## Help!
168
165
 
169
166
  If you have a question or are having trouble, simply [post it as an
170
- issue](http://github.com/rr/rr/issues) and I'll respond as soon as I can.
167
+ issue](https://github.com/rr/rr/issues) and I'll respond as soon as I can.
171
168
 
172
169
 
173
170
  ## Contributing
174
171
 
175
172
  Want to contribute a bug fix or new feature to RR? Great! Follow these steps:
176
173
 
177
- 1. Make sure you have Ruby 2.0.0-p195 installed (this is the primary Ruby
178
- version that RR targets).
174
+ 1. Make sure you have a recent Ruby (check the compatibility table above).
179
175
  2. Clone the repo (you probably knew that already).
180
176
  3. Make a new branch off of `master` with a descriptive name.
181
177
  4. Work on your patch.
@@ -205,8 +201,9 @@ To run all the suites, simply say:
205
201
 
206
202
  ## Author/Contact
207
203
 
208
- RR was originally written by Brian Takita. It is currently maintained by Elliot
209
- Winkler (<elliot.winkler@gmail.com>).
204
+ RR was originally written by Brian Takita. And it was maintained by
205
+ Elliot Winkler (<elliot.winkler@gmail.com>). It is currently
206
+ maintained by Kouhei Sutou (<kou@cozmixng.org>).
210
207
 
211
208
 
212
209
  ## Credits
data/Rakefile CHANGED
@@ -4,52 +4,54 @@ require 'rake'
4
4
 
5
5
  require 'pp'
6
6
 
7
- # appraisal
8
- require 'appraisal'
9
-
10
7
  # build, install, release
11
8
  require 'bundler/gem_tasks'
12
9
 
13
- # appraisals
14
- Appraisal::File.each do |appraisal|
15
- desc "Resolve and install dependencies for the #{appraisal.name} appraisal"
16
- task "appraisal:#{appraisal.name}:install" do
17
- appraisal.install
10
+ require_relative "lib/rr/version"
11
+
12
+ default_tasks = []
13
+
14
+ begin
15
+ # appraisal
16
+ require 'appraisal'
17
+ rescue LoadError
18
+ else
19
+ # appraisals
20
+ Appraisal::File.each do |appraisal|
21
+ desc "Resolve and install dependencies for the #{appraisal.name} appraisal"
22
+ task "appraisal:#{appraisal.name}:install" do
23
+ appraisal.install
24
+ end
18
25
  end
26
+ default_tasks << 'appraisal:install'
19
27
  end
20
28
 
21
- # spec
22
- require File.expand_path('../spec/defines_spec_suite_tasks', __FILE__)
23
- DefinesSpecSuiteTasks.call
24
- task :default => ['appraisal:install', :spec]
25
-
26
- task :package_tests do
27
- require File.expand_path('../lib/rr/version', __FILE__)
28
- require 'aws/s3'
29
- require 'archive/tar/minitar'
30
- require 'dotenv'
31
-
32
- Dotenv.load
33
- AWS.config(
34
- :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
35
- :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
36
- )
37
-
38
- file_path = File.join(Dir.tmpdir, "rr-#{RR.version}-tests.tar")
39
- File.open(file_path, 'wb') do |fh|
40
- Zlib::GzipWriter.open(fh) do |zfh|
41
- Archive::Tar::Minitar.pack('spec', zfh)
29
+ begin
30
+ # spec
31
+ require 'rspec/core/rake_task'
32
+ rescue LoadError
33
+ else
34
+ require File.expand_path('../spec/defines_spec_suite_tasks', __FILE__)
35
+ DefinesSpecSuiteTasks.call
36
+ default_tasks << :spec
37
+ end
38
+
39
+ desc "Run tests"
40
+ task :test do
41
+ ruby("test/run-test.rb")
42
+ end
43
+ default_tasks << :test
44
+
45
+ namespace :"gh-pages" do
46
+ namespace :version do
47
+ desc "Update version"
48
+ task :update do
49
+ config_yml_path = "gh-pages/_config.yml"
50
+ config_yml = File.read(config_yml_path)
51
+ config_yml = config_yml.gsub(/^version: .*$/, "version: #{RR::VERSION}")
52
+ File.write(config_yml_path, config_yml)
42
53
  end
43
54
  end
44
- puts "Wrote to #{file_path}."
45
-
46
- remote_file_path = "v#{RR.version}.tar.gz"
47
- bucket_name = 'rubygem-rr/tests'
48
- puts "Uploading #{file_path} to s3.amazonaws.com/#{bucket_name}/#{remote_file_path} ..."
49
- s3 = AWS::S3.new
50
- bucket = s3.buckets[bucket_name]
51
- object = bucket.objects[remote_file_path]
52
- File.open(file_path, 'rb') {|f| object.write(f) }
53
- object.acl = :public_read
54
55
  end
55
- task :release => :package_tests
56
+
57
+ task :default => default_tasks
@@ -94,3 +94,4 @@ my_object.should_receive(:hello).with('bob', 'jane').and_return('Hello Bob and J
94
94
  # RR
95
95
  mock(my_object).hello('bob', 'jane') { 'Hello Bob and Jane' }
96
96
  mock(my_object).hello('bob', 'jane').returns('Hello Bob and Jane') # same thing, just more verbose
97
+ ~~~
@@ -6,4 +6,4 @@ module RR
6
6
  klass.private_instance_methods(include_super).detect {|method_name| method_name.to_sym == instance_method.to_sym}
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -1,6 +1,8 @@
1
1
  class Array
2
2
  def wildcard_match?(other)
3
3
  return false unless other.is_a?(Array)
4
+ return false unless size == other.size
5
+
4
6
  each_with_index do |value, i|
5
7
  if value.respond_to?(:wildcard_match?)
6
8
  return false unless value.wildcard_match?(other[i])
@@ -3,6 +3,8 @@ class Hash
3
3
  return false unless other.is_a?(Hash)
4
4
 
5
5
  other_keys = other.keys
6
+ return false if keys.size != other_keys.size
7
+
6
8
  other_values = other.values
7
9
  each_with_index do |(key, value), i|
8
10
  if key.respond_to?(:wildcard_match?)
@@ -0,0 +1,97 @@
1
+ module RR
2
+ module Adapters
3
+ # People who manually include RR into their test framework will use
4
+ # these constants
5
+
6
+ module MiniTest
7
+ def self.included(base)
8
+ RR::Deprecations.show_warning_for_deprecated_adapter
9
+ RR.autohook
10
+ end
11
+ end
12
+
13
+ module TestUnit
14
+ def self.included(base)
15
+ RR::Deprecations.show_warning_for_deprecated_adapter
16
+ RR.autohook
17
+ end
18
+ end
19
+
20
+ module RSpec2
21
+ def self.included(base)
22
+ RR::Deprecations.show_warning_for_deprecated_adapter
23
+ RR.autohook
24
+ end
25
+ end
26
+
27
+ module Rspec
28
+ def self.const_missing(name)
29
+ if name == :InvocationMatcher
30
+ # Old versions of the RSpec-2 adapter for RR floating out in the wild
31
+ # still refer to this constant
32
+ RR::Deprecations.constant_deprecated_in_favor_of(
33
+ 'RR::Adapters::Rspec::InvocationMatcher',
34
+ 'RR::Integrations::RSpec::InvocationMatcher'
35
+ )
36
+ RR::Integrations::RSpec::InvocationMatcher
37
+ else
38
+ super
39
+ end
40
+ end
41
+ end
42
+
43
+ module RRMethods
44
+ include RR::DSL
45
+
46
+ def self.included(base)
47
+ # This was once here but is now deprecated
48
+ RR::Deprecations.constant_deprecated_in_favor_of(
49
+ 'RR::Adapters::RRMethods',
50
+ 'RR::DSL'
51
+ )
52
+ end
53
+ end
54
+ end
55
+
56
+ # This is here because RSpec-2's RR adapters uses it
57
+ module Extensions
58
+ def self.const_missing(name)
59
+ if name == :InstanceMethods
60
+ RR.autohook
61
+ RR::Integrations::RSpec2::Mixin
62
+ else
63
+ super
64
+ end
65
+ end
66
+ end
67
+
68
+ module Deprecations
69
+ def self.show_warning(msg, options = {})
70
+ start_backtrace_at_frame = options.fetch(:start_backtrace_at_frame, 2)
71
+ backtrace = caller(start_backtrace_at_frame)
72
+
73
+ lines = []
74
+ lines << ('-' * 80)
75
+ lines << 'Warning from RR:'
76
+ lines.concat msg.split(/\n/).map {|l| " #{l}" }
77
+ lines << ""
78
+ lines << "Called from:"
79
+ lines.concat backtrace[0..2].map {|l| " - #{l}" }
80
+ lines << ('-' * 80)
81
+
82
+ Kernel.warn lines.join("\n")
83
+ end
84
+
85
+ def self.constant_deprecated_in_favor_of(old_name, new_name)
86
+ show_warning "#{old_name} is deprecated;\nplease use #{new_name} instead.",
87
+ :start_backtrace_at_frame => 3
88
+ end
89
+
90
+ def self.show_warning_for_deprecated_adapter
91
+ RR::Deprecations.show_warning(<<EOT.strip)
92
+ RR now has an autohook system. You don't need to `include RR::Adapters::*` in
93
+ your test framework's base class anymore.
94
+ EOT
95
+ end
96
+ end
97
+ end