rr 1.1.2.rc1 → 3.0.1

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 +98 -6
  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 +67 -19
  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 +28 -8
  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 +113 -58
  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: fcd365900d797d064358a2e5971e188181dcac4f
4
- data.tar.gz: 76b4b3f175b477d1ef4978d3c6c29dfec6240eb2
2
+ SHA256:
3
+ metadata.gz: 4e2a905bf3c98b578d3101fc481f77bfc04fe12f66ddbeaaf5c199203400b039
4
+ data.tar.gz: e8f43656c3148894baa0b947838e094ebd2c08bb821ccc325b6a7b43c2e4479d
5
5
  SHA512:
6
- metadata.gz: 7f961d11097a46ec5be81dd0c06081a599e974523da84129d095a40ce255d21d2b24390919ee02070f75a429f0febbe9380648839d8f39355f12dc1542271adf
7
- data.tar.gz: a694d5160568ac9878482257f22f42493bc62db670feb5b20ca7ec15669072519916235cb5aa0b69a026e88de30c1479148918d73dc0572ad333e0777f224bc3
6
+ metadata.gz: 36c98f63746b65919ea471b3bf860edc647252e9eeaf1ffee4cc61be124dc82dc145de13fda8d4ff49efba4e7476b1c6a999d059a9ce1e6bc1d8eb1088f31079
7
+ data.tar.gz: 9c7a00c6899824ae9e807c62ccb81efb07a37b7ed78ab368551a24e36c98732539cd111090826995925543aa52c504f8abec2eadbcc9cc81cdfedac98cbb11f4
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,21 +1,113 @@
1
1
  # Changelog
2
2
 
3
- ## HEAD
3
+ ## 3.0.1 - 2021-06-18
4
4
 
5
- * Add back tests, appraisals, etc. to the published gem ([#32][i32]).
5
+ ### Improvements
6
+
7
+ * Suppressed keyword arguments related warnings on Ruby 2.7.
8
+ [GitHub#81][Reported by akira yamada]
9
+
10
+ ### Thanks
11
+
12
+ * akira yamada
13
+
14
+ ## 3.0.0 - 2021-03-31
15
+
16
+ ### Improvements
17
+
18
+ * Added support for Ruby 3.0's keyword arguments.
19
+ [GitHub#17][Reported by Takuro Ashie]
20
+
21
+ ### Fixes
22
+
23
+ * Fixed a bug that `any_instance_of` doesn't work with class
24
+ hierarchies. [GitHub#12][Reported by Étienne Barrié]
25
+
26
+ ### Thanks
27
+
28
+ * Étienne Barrié
29
+
30
+ * Takuro Ashie
31
+
32
+ ## 1.2.1 - 2017-06-22
33
+
34
+ ### Fixes
35
+
36
+ * Fixed a bug that `RR.reset` resets newly created methods.
37
+ [GitHub#8]
38
+
39
+ ## 1.2.0 - 2016-05-30
40
+
41
+ ### Improvements
42
+
43
+ * Renamed RR::Adapters::RRMethods to RR::DSL.
44
+
45
+ * Deprecated RRMethods.
46
+
47
+ * Updated document. [GitHub#57][Patch by Nikolay Shebanov]
48
+
49
+ * Dropped Ruby 1.8 support.
50
+
51
+ * Dropped Ruby 1.9 support.
52
+
53
+ * Dropped Rails 3 support.
54
+
55
+ * Dropped test-unit integration support. Use
56
+ [test-unit-rr](https://test-unit.github.io/#test-unit-rr).
57
+
58
+ * Supported OpenStruct in Ruby 2.3
59
+ [GitHub#64][Reported by soylent][Reported by Arthur Le Maitre]
60
+
61
+ ### Fixes
62
+
63
+ * Fixed using RSpec's RR adapter to not override our RSpec adapter.
64
+ If RR is required and then you use `mock_with :rr` you would not be able to
65
+ use `have_received`.
66
+
67
+ * Fixed a bug that `Hash` argument is too wild.
68
+ [GitHub#54][Reported by Yutaka HARA]
69
+
70
+ * Fixed a bug that `Array` argument is too wild.
71
+ [GitHub#54][Reported by Skye Shaw]
72
+
73
+ ### Thanks
74
+
75
+ * Nikolay Shebanov
76
+
77
+ * Yutaka HARA
78
+
79
+ * Skye Shaw
80
+
81
+ * soylent
82
+
83
+ * Arthur Le Maitre
84
+
85
+ ## 1.1.2 (August 17, 2013)
86
+
87
+ * Add tests, appraisals, etc. back to the published gem ([#32][i32]).
6
88
  This is necessary because Debian wraps rr in a package, and they depend on the
7
89
  tests to be present in order to run them prior to packaging.
8
90
  * Add back RR::Adapters::RSpec2 which was removed accidentally ([#34][i34]).
9
- This fixes failures when running tests against sham_rack.
91
+ This fixes failures when running tests against sham_rack (which is no longer
92
+ using RR, but, oh well).
10
93
  * Remove deprecation warning about
11
94
  RSpec.configuration.backtrace_clean_patterns under RSpec 2.14 ([#37][i37]).
12
- * Bump integration tests from Rails 4.0.0.rc1 to 4.0.0.
95
+ NOTE: This warning will continue to appear if you are configuring RSpec using
96
+ `mock_with :rr`. This is because the RR adapter bundled with RSpec still
97
+ refers to `backtrace_clean_patterns` instead of
98
+ `backtrace_exclusion_patterns`. You can either wait until the next release of
99
+ rspec-core, or remove `mock_with :rr` (which is recommended at this point as
100
+ we consider RSpec's adapter to be slightly out of date, and RR provides its
101
+ own adapter for RSpec).
102
+ * RR now officially supports Rails 4.0.0. (It worked before, but now we're
103
+ explicitly testing against it instead of 4.0.0.rc1.)
13
104
  * Fix Test::Unit 1 and 2 adapters to avoid a possible "undefined
14
105
  Test::Unit::TestCase" error.
106
+ * Prevent adapters from being double-loaded.
15
107
  * Including RR::Adapters::TestUnit, RR::Adapters::MiniTest, or
16
108
  RR::Adapters::RSpec2 now just re-runs the autohook mechanism instead of
17
- building a fake adapter.
18
- * Prevent adapters from being double-loaded.
109
+ building a fake adapter, as it was possible to include both a real and fake
110
+ adapter in the same space and they could conflict with each other.
19
111
 
20
112
  ## 1.1.1 (June 17, 2013)
21
113
 
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?)