rr 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +3 -43
- data/CHANGES.md +46 -0
- data/CREDITS.md +5 -0
- data/Gemfile +3 -12
- data/README.md +25 -24
- data/Rakefile +16 -38
- data/doc/02_syntax_comparison.md +1 -0
- data/lib/rr/core_ext/array.rb +2 -0
- data/lib/rr/core_ext/hash.rb +2 -0
- data/lib/rr/deprecations.rb +97 -0
- data/lib/rr/double_definitions/double_injections/any_instance_of.rb +1 -1
- data/lib/rr/double_definitions/double_injections/instance.rb +2 -2
- data/lib/rr/dsl.rb +152 -0
- data/lib/rr/injections/method_missing_injection.rb +6 -2
- data/lib/rr/integrations/minitest_4.rb +1 -1
- data/lib/rr/integrations/minitest_4_active_support.rb +1 -1
- data/lib/rr/integrations/rspec/invocation_matcher.rb +0 -8
- data/lib/rr/integrations/rspec_2.rb +20 -2
- data/lib/rr/recorded_call.rb +29 -0
- data/lib/rr/recorded_calls.rb +8 -4
- data/lib/rr/space.rb +1 -1
- data/lib/rr/spy_verification.rb +13 -5
- data/lib/rr/version.rb +1 -1
- data/lib/rr/wildcard_matchers.rb +10 -10
- data/lib/rr/without_autohook.rb +5 -13
- data/rr.gemspec +3 -3
- data/spec/defines_spec_suite_tasks.rb +12 -0
- data/spec/global_helper.rb +5 -0
- data/spec/spec_suite_configuration.rb +1 -7
- data/spec/suites.yml +1 -1
- data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +133 -33
- data/spec/suites/rspec_2/functional/dont_allow_spec.rb +13 -8
- data/spec/suites/rspec_2/functional/mock_bang_spec.rb +20 -0
- data/spec/suites/rspec_2/functional/mock_instance_of_spec.rb +14 -0
- data/spec/suites/rspec_2/functional/mock_instance_of_strong_spec.rb +15 -0
- data/spec/suites/rspec_2/functional/mock_proxy_instance_of_spec.rb +15 -0
- data/spec/suites/rspec_2/functional/mock_proxy_spec.rb +14 -0
- data/spec/suites/rspec_2/functional/mock_spec.rb +8 -232
- data/spec/suites/rspec_2/functional/mock_strong_spec.rb +14 -0
- data/spec/suites/rspec_2/functional/received_spec.rb +16 -0
- data/spec/suites/rspec_2/functional/spy_spec.rb +89 -28
- data/spec/suites/rspec_2/functional/stub_bang_spec.rb +20 -0
- data/spec/suites/rspec_2/functional/stub_instance_of_spec.rb +15 -0
- data/spec/suites/rspec_2/functional/stub_instance_of_strong_spec.rb +15 -0
- data/spec/suites/rspec_2/functional/stub_proxy_instance_of_spec.rb +16 -0
- data/spec/suites/rspec_2/functional/stub_proxy_spec.rb +45 -0
- data/spec/suites/rspec_2/functional/stub_spec.rb +42 -161
- data/spec/suites/rspec_2/functional/stub_strong_spec.rb +15 -0
- data/spec/suites/rspec_2/helper.rb +2 -2
- data/spec/suites/rspec_2/support/mixins/double_definition_creator_helpers.rb +173 -0
- data/spec/suites/rspec_2/support/mixins/mock_definition_creator_helpers.rb +45 -0
- data/spec/suites/rspec_2/support/mixins/proxy_definition_creator_helpers.rb +33 -0
- data/spec/suites/rspec_2/support/mixins/stub_creator_helpers.rb +43 -0
- data/spec/suites/rspec_2/support/mixins/stub_definition_creator_helpers.rb +45 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_with_never_called_qualifier.rb +39 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_with_times_called_qualifier.rb +50 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_without_qualifiers.rb +131 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/dont_allow.rb +148 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_instance_of.rb +26 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_instance_of_strong.rb +28 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_proxy.rb +11 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_strong.rb +37 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mocking.rb +107 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_instance_of.rb +32 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_instance_of_strong.rb +39 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_proxy.rb +11 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_strong.rb +37 -0
- data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stubbing.rb +57 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/array_flatten_bug.rb +35 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/block_form.rb +31 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/comparing_arity.rb +63 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/object_is_proxy.rb +43 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/sequential_invocations.rb +26 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/setting_implementation.rb +51 -0
- data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/yields.rb +81 -0
- data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +0 -28
- data/spec/suites/rspec_2/unit/deprecations_spec.rb +27 -0
- data/spec/suites/rspec_2/unit/dsl/double_creators_spec.rb +133 -0
- data/spec/suites/rspec_2/unit/dsl/space_spec.rb +99 -0
- data/spec/suites/rspec_2/unit/dsl/wildcard_matchers_spec.rb +67 -0
- data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +4 -19
- data/spec/suites/rspec_2/unit/space_spec.rb +5 -3
- data/spec/suites/rspec_2/unit/spy_verification_spec.rb +1 -1
- data/spec/support/adapter.rb +1 -1
- data/spec/support/adapter_tests/rspec.rb +19 -15
- data/spec/support/project/generator.rb +0 -4
- metadata +55 -48
- data/gemfiles/ruby_18_rspec_1.gemfile +0 -14
- data/gemfiles/ruby_18_rspec_1.gemfile.lock +0 -38
- data/gemfiles/ruby_18_rspec_1_rails_2.gemfile +0 -18
- data/gemfiles/ruby_18_rspec_1_rails_2.gemfile.lock +0 -64
- data/gemfiles/ruby_19_rspec_2_rails_3.gemfile +0 -15
- data/gemfiles/ruby_19_rspec_2_rails_3.gemfile.lock +0 -123
- data/lib/rr/adapters.rb +0 -34
- data/lib/rr/adapters/rr_methods.rb +0 -142
- data/lib/rr/integrations/rspec_1.rb +0 -46
- data/lib/rr/integrations/test_unit_1.rb +0 -63
- data/lib/rr/integrations/test_unit_2.rb +0 -17
- data/lib/rr/integrations/test_unit_200.rb +0 -27
- data/lib/rr/integrations/test_unit_200_active_support.rb +0 -25
- data/lib/rr/integrations/test_unit_2_active_support.rb +0 -38
- data/spec/suites/rspec_1/helper.rb +0 -24
- data/spec/suites/rspec_1/integration/rspec_1_spec.rb +0 -93
- data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +0 -102
- data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +0 -109
- data/spec/suites/rspec_1/spec_helper.rb +0 -3
- data/spec/suites/rspec_1_rails_2/integration/astc_rails_2_spec.rb +0 -141
- data/spec/suites/rspec_1_rails_2/integration/rspec_1_rails_2_spec.rb +0 -132
- data/spec/suites/rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb +0 -141
- data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +0 -148
- data/spec/suites/rspec_1_rails_2/spec_helper.rb +0 -3
- data/spec/suites/rspec_2/functional/dsl_spec.rb +0 -13
- data/spec/suites/rspec_2/functional/instance_of_spec.rb +0 -14
- data/spec/suites/rspec_2/functional/proxy_spec.rb +0 -136
- data/spec/suites/rspec_2/functional/strong_spec.rb +0 -79
- data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +0 -102
- data/spec/suites/rspec_2/integration/test_unit_2_spec.rb +0 -109
- data/spec/suites/rspec_2/unit/adapters/rr_methods/double_creators_spec.rb +0 -135
- data/spec/suites/rspec_2/unit/adapters/rr_methods/space_spec.rb +0 -101
- data/spec/suites/rspec_2/unit/adapters/rr_methods/wildcard_matchers_spec.rb +0 -69
- data/spec/suites/rspec_2_rails_3/integration/astc_rails_3_spec.rb +0 -141
- data/spec/suites/rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb +0 -148
- data/spec/suites/rspec_2_rails_3/integration/rspec_2_rails_3_spec.rb +0 -172
- data/spec/suites/rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb +0 -141
- data/spec/suites/rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb +0 -148
- data/spec/suites/rspec_2_rails_3/spec_helper.rb +0 -3
- data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +0 -142
- data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +0 -149
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2135e46b66d09100c220437bb40f2989ccff6afc
|
4
|
+
data.tar.gz: 6307d6b090c14938825eaa4c5c474ba97788c770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba91e27957d4ba1876e17f0a21480265b088234e3b5ad05638d33e2591bb8fe1df1373849c89c420d0a47f61a3f1091a117326ec91acd94c51de16b82e5b2fd3
|
7
|
+
data.tar.gz: d63946c4a0a43c25484d11b430831e306535e83600fc026834a02cc535417fa9b9ac2d5fb46ae61ed2b093e5930417c3f04d818b275bcc432f403d9d55271691
|
data/Appraisals
CHANGED
@@ -1,46 +1,6 @@
|
|
1
|
-
|
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
|
-
|
43
|
-
|
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,51 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.2.0 - 2016-05-30
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Renamed RR::Adapters::RRMethods to RR::DSL.
|
8
|
+
|
9
|
+
* Deprecated RRMethods.
|
10
|
+
|
11
|
+
* Updated document. [GitHub#57][Patch by Nikolay Shebanov]
|
12
|
+
|
13
|
+
* Dropped Ruby 1.8 support.
|
14
|
+
|
15
|
+
* Dropped Ruby 1.9 support.
|
16
|
+
|
17
|
+
* Dropped Rails 3 support.
|
18
|
+
|
19
|
+
* Dropped test-unit integration support. Use
|
20
|
+
[test-unit-rr](https://test-unit.github.io/#test-unit-rr).
|
21
|
+
|
22
|
+
* Supported OpenStruct in Ruby 2.3
|
23
|
+
[GitHub#64][Reported by soylent][Reported by Arthur Le Maitre]
|
24
|
+
|
25
|
+
### Fixes
|
26
|
+
|
27
|
+
* Fixed using RSpec's RR adapter to not override our RSpec adapter.
|
28
|
+
If RR is required and then you use `mock_with :rr` you would not be able to
|
29
|
+
use `have_received`.
|
30
|
+
|
31
|
+
* Fixed a bug that `Hash` argument is too wild.
|
32
|
+
[GitHub#54][Reported by Yutaka HARA]
|
33
|
+
|
34
|
+
* Fixed a bug that `Array` argument is too wild.
|
35
|
+
[GitHub#54][Reported by Skye Shaw]
|
36
|
+
|
37
|
+
### Thanks
|
38
|
+
|
39
|
+
* Nikolay Shebanov
|
40
|
+
|
41
|
+
* Yutaka HARA
|
42
|
+
|
43
|
+
* Skye Shaw
|
44
|
+
|
45
|
+
* soylent
|
46
|
+
|
47
|
+
* Arthur Le Maitre
|
48
|
+
|
3
49
|
## 1.1.2 (August 17, 2013)
|
4
50
|
|
5
51
|
* Add tests, appraisals, etc. back to the published gem ([#32][i32]).
|
data/CREDITS.md
CHANGED
data/Gemfile
CHANGED
@@ -1,19 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'rake', '~> 10.0'
|
4
|
-
gem 'aws-sdk', '~> 1.0'
|
5
|
-
gem 'minitar', '~> 0.5'
|
6
|
-
gem 'dotenv', '~> 0.7'
|
7
4
|
gem 'simplecov', '~> 0.7'
|
8
5
|
gem 'appraisal', '~> 0.5'
|
9
6
|
gem 'posix-spawn', :platforms => :mri
|
10
7
|
gem 'open4', :platforms => :mri
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
8
|
+
gem 'test-unit'
|
9
|
+
gem 'test-unit-rr'
|
10
|
+
gem 'rspec', '~> 2.14'
|
data/README.md
CHANGED
@@ -3,6 +3,15 @@
|
|
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,39 +143,25 @@ 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
|
145
|
-
*
|
146
|
-
* 2.
|
150
|
+
* 2.1
|
151
|
+
* 2.2
|
152
|
+
* 2.3
|
147
153
|
* JRuby 1.7.4
|
148
154
|
|
149
155
|
as well as the following test frameworks:
|
150
156
|
|
151
|
-
* RSpec
|
152
|
-
*
|
153
|
-
*
|
154
|
-
*
|
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+)
|
157
|
+
* RSpec 2
|
158
|
+
* Test::Unit via [test-unit-rr](https://test-unit.github.io/#test-unit-rr)
|
159
|
+
* MiniTest 4
|
160
|
+
* Minitest 5
|
159
161
|
|
160
162
|
and the following Rails versions:
|
161
163
|
|
162
|
-
* Rails
|
163
|
-
* Rails 3.2.x (Ruby 1.9+)
|
164
|
-
* Rails 4.0.x (Ruby 1.9+)
|
164
|
+
* Rails 4
|
165
165
|
|
166
166
|
|
167
167
|
## Help!
|
@@ -205,8 +205,9 @@ To run all the suites, simply say:
|
|
205
205
|
|
206
206
|
## Author/Contact
|
207
207
|
|
208
|
-
RR was originally written by Brian Takita.
|
209
|
-
Winkler (<elliot.winkler@gmail.com>).
|
208
|
+
RR was originally written by Brian Takita. And it was maintained by
|
209
|
+
Elliot Winkler (<elliot.winkler@gmail.com>). It is currently
|
210
|
+
maintained by Kouhei Sutou (<kou@cozmixng.org>).
|
210
211
|
|
211
212
|
|
212
213
|
## Credits
|
data/Rakefile
CHANGED
@@ -4,52 +4,30 @@ 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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
begin
|
11
|
+
# appraisal
|
12
|
+
require 'appraisal'
|
13
|
+
|
14
|
+
# appraisals
|
15
|
+
Appraisal::File.each do |appraisal|
|
16
|
+
desc "Resolve and install dependencies for the #{appraisal.name} appraisal"
|
17
|
+
task "appraisal:#{appraisal.name}:install" do
|
18
|
+
appraisal.install
|
19
|
+
end
|
18
20
|
end
|
21
|
+
rescue LoadError
|
19
22
|
end
|
20
23
|
|
21
24
|
# spec
|
22
25
|
require File.expand_path('../spec/defines_spec_suite_tasks', __FILE__)
|
23
26
|
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
27
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
Archive::Tar::Minitar.pack('spec', zfh)
|
42
|
-
end
|
43
|
-
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
|
28
|
+
desc "Run tests"
|
29
|
+
task :test do
|
30
|
+
ruby("test/run-test.rb")
|
54
31
|
end
|
55
|
-
|
32
|
+
|
33
|
+
task :default => ['appraisal:install', :spec, :test]
|
data/doc/02_syntax_comparison.md
CHANGED
data/lib/rr/core_ext/array.rb
CHANGED
data/lib/rr/core_ext/hash.rb
CHANGED
@@ -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
|
@@ -3,7 +3,7 @@ module RR
|
|
3
3
|
module DoubleInjections
|
4
4
|
class Instance
|
5
5
|
extend(Module.new do
|
6
|
-
include ::RR::
|
6
|
+
include ::RR::DSL
|
7
7
|
|
8
8
|
def call(double_method_name, *args, &definition_eval_block)
|
9
9
|
double_definition_create = DoubleDefinitions::DoubleDefinitionCreate.new
|
@@ -13,4 +13,4 @@ module RR
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|