rr 1.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Appraisals +6 -0
- data/CHANGES.md +102 -1
- data/CREDITS.md +5 -0
- data/Gemfile +3 -0
- data/README.md +91 -110
- data/Rakefile +43 -0
- data/doc/02_syntax_comparison.md +1 -0
- data/gemfiles/ruby_19_rspec_2.gemfile +14 -0
- data/gemfiles/ruby_19_rspec_2.gemfile.lock +49 -0
- data/gemfiles/ruby_19_rspec_2_rails_4.gemfile +15 -0
- data/gemfiles/ruby_19_rspec_2_rails_4.gemfile.lock +119 -0
- data/lib/rr/class_instance_method_defined.rb +1 -1
- 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.rb +28 -10
- data/lib/rr/double_definitions/double_definition.rb +39 -16
- data/lib/rr/double_definitions/double_definition_create.rb +5 -5
- data/lib/rr/double_definitions/double_definition_create_blank_slate.rb +10 -4
- 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/double_definitions/strategies/strategy.rb +27 -8
- data/lib/rr/double_definitions/strategies/verification/mock.rb +8 -2
- data/lib/rr/double_matches.rb +4 -3
- data/lib/rr/dsl.rb +152 -0
- data/lib/rr/expectations/any_argument_expectation.rb +4 -4
- data/lib/rr/expectations/argument_equality_expectation.rb +43 -5
- data/lib/rr/injections/double_injection.rb +67 -19
- data/lib/rr/injections/method_missing_injection.rb +37 -6
- data/lib/rr/integrations.rb +13 -12
- data/lib/rr/integrations/decorator.rb +4 -1
- 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 +28 -3
- data/lib/rr/keyword_arguments.rb +15 -0
- data/lib/rr/method_dispatches/base_method_dispatch.rb +22 -5
- data/lib/rr/method_dispatches/method_dispatch.rb +21 -10
- data/lib/rr/method_dispatches/method_missing_dispatch.rb +14 -5
- data/lib/rr/recorded_call.rb +35 -0
- data/lib/rr/recorded_calls.rb +23 -9
- data/lib/rr/space.rb +15 -5
- data/lib/rr/spy_verification.rb +13 -5
- data/lib/rr/version.rb +1 -2
- data/lib/rr/wildcard_matchers.rb +10 -10
- data/lib/rr/without_autohook.rb +7 -14
- data/rr.gemspec +14 -5
- data/spec/custom_formatter_for_rspec.rb +18 -0
- data/spec/custom_formatter_for_rspec_2.rb +40 -0
- data/spec/defines_spec_suite_tasks.rb +57 -0
- data/spec/fixtures/rubygems_patch_for_187.rb +598 -0
- data/spec/global_helper.rb +38 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_suite_configuration.rb +126 -0
- data/spec/spec_suite_runner.rb +47 -0
- data/spec/suites.yml +10 -0
- data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +147 -0
- data/spec/suites/rspec_2/functional/dont_allow_spec.rb +17 -0
- 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 +17 -0
- 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 +102 -0
- 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 +71 -0
- data/spec/suites/rspec_2/functional/stub_strong_spec.rb +15 -0
- data/spec/suites/rspec_2/functional/wildcard_matchers_spec.rb +128 -0
- data/spec/suites/rspec_2/helper.rb +28 -0
- data/spec/suites/rspec_2/integration/minitest_4_spec.rb +109 -0
- data/spec/suites/rspec_2/integration/minitest_spec.rb +109 -0
- data/spec/suites/rspec_2/spec_helper.rb +3 -0
- data/spec/suites/rspec_2/support/matchers/wildcard_matcher_matchers.rb +32 -0
- 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/support/shared_examples/space.rb +13 -0
- data/spec/suites/rspec_2/support/shared_examples/times_called_expectation.rb +9 -0
- data/spec/suites/rspec_2/unit/core_ext/array_spec.rb +39 -0
- data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +53 -0
- data/spec/suites/rspec_2/unit/core_ext/hash_spec.rb +55 -0
- data/spec/suites/rspec_2/unit/core_ext/range_spec.rb +41 -0
- data/spec/suites/rspec_2/unit/core_ext/regexp_spec.rb +41 -0
- data/spec/suites/rspec_2/unit/deprecations_spec.rb +27 -0
- data/spec/suites/rspec_2/unit/double_definitions/child_double_definition_create_spec.rb +114 -0
- data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_blank_slate_spec.rb +93 -0
- data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_spec.rb +446 -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/errors/rr_error_spec.rb +67 -0
- data/spec/suites/rspec_2/unit/expectations/any_argument_expectation_spec.rb +48 -0
- data/spec/suites/rspec_2/unit/expectations/anything_argument_equality_expectation_spec.rb +14 -0
- data/spec/suites/rspec_2/unit/expectations/argument_equality_expectation_spec.rb +135 -0
- data/spec/suites/rspec_2/unit/expectations/boolean_argument_equality_expectation_spec.rb +30 -0
- data/spec/suites/rspec_2/unit/expectations/hash_including_argument_equality_expectation_spec.rb +92 -0
- data/spec/suites/rspec_2/unit/expectations/satisfy_argument_equality_expectation_spec.rb +61 -0
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/any_times_matcher_spec.rb +22 -0
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_least_matcher_spec.rb +37 -0
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_most_matcher_spec.rb +43 -0
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/integer_matcher_spec.rb +58 -0
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/proc_matcher_spec.rb +35 -0
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/range_matcher_spec.rb +39 -0
- data/spec/suites/rspec_2/unit/hash_with_object_id_key_spec.rb +88 -0
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_spec.rb +533 -0
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb +32 -0
- data/spec/suites/rspec_2/unit/integrations/rspec/invocation_matcher_spec.rb +297 -0
- data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +70 -0
- data/spec/suites/rspec_2/unit/rr_spec.rb +28 -0
- data/spec/suites/rspec_2/unit/space_spec.rb +598 -0
- data/spec/suites/rspec_2/unit/spy_verification_spec.rb +133 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/any_times_matcher_spec.rb +46 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/at_least_matcher_spec.rb +54 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/at_most_matcher_spec.rb +69 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/integer_matcher_spec.rb +69 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/proc_matcher_spec.rb +54 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/range_matcher_spec.rb +75 -0
- data/spec/suites/rspec_2/unit/times_called_matchers/times_called_matcher_spec.rb +117 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/anything_spec.rb +33 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/boolean_spec.rb +45 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/duck_type_spec.rb +64 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/hash_including_spec.rb +64 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb +55 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/numeric_spec.rb +46 -0
- data/spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb +57 -0
- data/spec/support/adapter.rb +22 -0
- data/spec/support/adapter_tests/base.rb +45 -0
- data/spec/support/adapter_tests/minitest.rb +7 -0
- data/spec/support/adapter_tests/rspec.rb +70 -0
- data/spec/support/adapter_tests/test_unit.rb +47 -0
- data/spec/support/command_runner.rb +105 -0
- data/spec/support/generator.rb +56 -0
- data/spec/support/integration_tests/base.rb +64 -0
- data/spec/support/integration_tests/rails.rb +60 -0
- data/spec/support/integration_tests/rails_minitest.rb +13 -0
- data/spec/support/integration_tests/rails_rspec.rb +13 -0
- data/spec/support/integration_tests/rails_test_unit.rb +13 -0
- data/spec/support/integration_tests/rails_test_unit_like.rb +13 -0
- data/spec/support/integration_tests/ruby.rb +7 -0
- data/spec/support/integration_tests/ruby_minitest.rb +13 -0
- data/spec/support/integration_tests/ruby_rspec.rb +13 -0
- data/spec/support/integration_tests/ruby_test_unit.rb +13 -0
- data/spec/support/matchers/be_a_subset_of_matcher.rb +24 -0
- data/spec/support/project/cucumber.rb +50 -0
- data/spec/support/project/generator.rb +348 -0
- data/spec/support/project/minitest.rb +39 -0
- data/spec/support/project/rails.rb +199 -0
- data/spec/support/project/rails_minitest.rb +17 -0
- data/spec/support/project/rails_rspec.rb +50 -0
- data/spec/support/project/rails_test_unit.rb +17 -0
- data/spec/support/project/rails_test_unit_like.rb +17 -0
- data/spec/support/project/rspec.rb +69 -0
- data/spec/support/project/ruby.rb +34 -0
- data/spec/support/project/ruby_minitest.rb +11 -0
- data/spec/support/project/ruby_rspec.rb +29 -0
- data/spec/support/project/ruby_test_unit.rb +11 -0
- data/spec/support/project/ruby_test_unit_like.rb +21 -0
- data/spec/support/project/test_unit.rb +29 -0
- data/spec/support/project/test_unit_like.rb +7 -0
- data/spec/support/project/tests_runner.rb +22 -0
- data/spec/support/test.sqlite3 +0 -0
- data/spec/support/test_case/generator.rb +53 -0
- data/spec/support/test_case/minitest.rb +13 -0
- data/spec/support/test_case/rspec.rb +19 -0
- data/spec/support/test_case/test_unit.rb +21 -0
- data/spec/support/test_file/generator.rb +120 -0
- data/spec/support/test_file/minitest.rb +19 -0
- data/spec/support/test_file/rails_minitest.rb +7 -0
- data/spec/support/test_file/rails_rspec.rb +12 -0
- data/spec/support/test_file/rails_test_unit.rb +25 -0
- data/spec/support/test_file/rspec.rb +33 -0
- data/spec/support/test_file/test_unit.rb +36 -0
- data/spec/support/test_helper/generator.rb +27 -0
- data/spec/support/test_helper/minitest.rb +7 -0
- data/spec/support/test_helper/rails.rb +31 -0
- data/spec/support/test_helper/rails_minitest.rb +7 -0
- data/spec/support/test_helper/rails_rspec.rb +25 -0
- data/spec/support/test_helper/rails_test_unit.rb +23 -0
- data/spec/support/test_helper/rspec.rb +7 -0
- data/spec/support/test_helper/ruby.rb +31 -0
- data/spec/support/test_helper/test_unit.rb +7 -0
- metadata +240 -19
- data/VERSION +0 -1
- data/lib/rr/adapters.rb +0 -44
- 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 -15
- 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/lib/rr/proc_from_block.rb +0 -11
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake", "~> 10.0"
|
6
|
+
gem "aws-sdk", "~> 1.0"
|
7
|
+
gem "minitar", "~> 0.5"
|
8
|
+
gem "dotenv", "~> 0.7"
|
9
|
+
gem "simplecov", "~> 0.7"
|
10
|
+
gem "appraisal", "~> 0.5"
|
11
|
+
gem "posix-spawn", :platforms=>:mri
|
12
|
+
gem "open4", :platforms=>:mri
|
13
|
+
gem "rspec", "~> 2.14"
|
14
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
appraisal (0.5.2)
|
5
|
+
bundler
|
6
|
+
rake
|
7
|
+
aws-sdk (1.9.5)
|
8
|
+
json (~> 1.4)
|
9
|
+
nokogiri (>= 1.4.4)
|
10
|
+
uuidtools (~> 2.1)
|
11
|
+
diff-lcs (1.2.4)
|
12
|
+
dotenv (0.7.0)
|
13
|
+
json (1.8.0)
|
14
|
+
json (1.8.0-java)
|
15
|
+
minitar (0.5.4)
|
16
|
+
multi_json (1.7.7)
|
17
|
+
nokogiri (1.5.9)
|
18
|
+
nokogiri (1.5.9-java)
|
19
|
+
open4 (1.3.0)
|
20
|
+
posix-spawn (0.3.6)
|
21
|
+
rake (10.0.4)
|
22
|
+
rspec (2.14.1)
|
23
|
+
rspec-core (~> 2.14.0)
|
24
|
+
rspec-expectations (~> 2.14.0)
|
25
|
+
rspec-mocks (~> 2.14.0)
|
26
|
+
rspec-core (2.14.5)
|
27
|
+
rspec-expectations (2.14.2)
|
28
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
29
|
+
rspec-mocks (2.14.3)
|
30
|
+
simplecov (0.7.1)
|
31
|
+
multi_json (~> 1.0)
|
32
|
+
simplecov-html (~> 0.7.1)
|
33
|
+
simplecov-html (0.7.1)
|
34
|
+
uuidtools (2.1.4)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
java
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
appraisal (~> 0.5)
|
42
|
+
aws-sdk (~> 1.0)
|
43
|
+
dotenv (~> 0.7)
|
44
|
+
minitar (~> 0.5)
|
45
|
+
open4
|
46
|
+
posix-spawn
|
47
|
+
rake (~> 10.0)
|
48
|
+
rspec (~> 2.14)
|
49
|
+
simplecov (~> 0.7)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake", "~> 10.0"
|
6
|
+
gem "aws-sdk", "~> 1.0"
|
7
|
+
gem "minitar", "~> 0.5"
|
8
|
+
gem "dotenv", "~> 0.7"
|
9
|
+
gem "simplecov", "~> 0.7"
|
10
|
+
gem "appraisal", "~> 0.5"
|
11
|
+
gem "posix-spawn", :platforms=>:mri
|
12
|
+
gem "open4", :platforms=>:mri
|
13
|
+
gem "rspec", "~> 2.14"
|
14
|
+
gem "rails", "4.0.0"
|
15
|
+
|
@@ -0,0 +1,119 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (4.0.0)
|
5
|
+
actionpack (= 4.0.0)
|
6
|
+
mail (~> 2.5.3)
|
7
|
+
actionpack (4.0.0)
|
8
|
+
activesupport (= 4.0.0)
|
9
|
+
builder (~> 3.1.0)
|
10
|
+
erubis (~> 2.7.0)
|
11
|
+
rack (~> 1.5.2)
|
12
|
+
rack-test (~> 0.6.2)
|
13
|
+
activemodel (4.0.0)
|
14
|
+
activesupport (= 4.0.0)
|
15
|
+
builder (~> 3.1.0)
|
16
|
+
activerecord (4.0.0)
|
17
|
+
activemodel (= 4.0.0)
|
18
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
19
|
+
activesupport (= 4.0.0)
|
20
|
+
arel (~> 4.0.0)
|
21
|
+
activerecord-deprecated_finders (1.0.3)
|
22
|
+
activesupport (4.0.0)
|
23
|
+
i18n (~> 0.6, >= 0.6.4)
|
24
|
+
minitest (~> 4.2)
|
25
|
+
multi_json (~> 1.3)
|
26
|
+
thread_safe (~> 0.1)
|
27
|
+
tzinfo (~> 0.3.37)
|
28
|
+
appraisal (0.5.2)
|
29
|
+
bundler
|
30
|
+
rake
|
31
|
+
arel (4.0.0)
|
32
|
+
atomic (1.1.13)
|
33
|
+
aws-sdk (1.9.5)
|
34
|
+
json (~> 1.4)
|
35
|
+
nokogiri (>= 1.4.4)
|
36
|
+
uuidtools (~> 2.1)
|
37
|
+
builder (3.1.4)
|
38
|
+
diff-lcs (1.2.4)
|
39
|
+
dotenv (0.7.0)
|
40
|
+
erubis (2.7.0)
|
41
|
+
hike (1.2.3)
|
42
|
+
i18n (0.6.5)
|
43
|
+
json (1.8.0)
|
44
|
+
json (1.8.0-java)
|
45
|
+
mail (2.5.4)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.24)
|
49
|
+
minitar (0.5.4)
|
50
|
+
minitest (4.7.5)
|
51
|
+
multi_json (1.7.9)
|
52
|
+
nokogiri (1.5.9)
|
53
|
+
nokogiri (1.5.9-java)
|
54
|
+
open4 (1.3.0)
|
55
|
+
polyglot (0.3.3)
|
56
|
+
posix-spawn (0.3.6)
|
57
|
+
rack (1.5.2)
|
58
|
+
rack-test (0.6.2)
|
59
|
+
rack (>= 1.0)
|
60
|
+
rails (4.0.0)
|
61
|
+
actionmailer (= 4.0.0)
|
62
|
+
actionpack (= 4.0.0)
|
63
|
+
activerecord (= 4.0.0)
|
64
|
+
activesupport (= 4.0.0)
|
65
|
+
bundler (>= 1.3.0, < 2.0)
|
66
|
+
railties (= 4.0.0)
|
67
|
+
sprockets-rails (~> 2.0.0)
|
68
|
+
railties (4.0.0)
|
69
|
+
actionpack (= 4.0.0)
|
70
|
+
activesupport (= 4.0.0)
|
71
|
+
rake (>= 0.8.7)
|
72
|
+
thor (>= 0.18.1, < 2.0)
|
73
|
+
rake (10.1.0)
|
74
|
+
rspec (2.14.1)
|
75
|
+
rspec-core (~> 2.14.0)
|
76
|
+
rspec-expectations (~> 2.14.0)
|
77
|
+
rspec-mocks (~> 2.14.0)
|
78
|
+
rspec-core (2.14.5)
|
79
|
+
rspec-expectations (2.14.2)
|
80
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
81
|
+
rspec-mocks (2.14.3)
|
82
|
+
simplecov (0.7.1)
|
83
|
+
multi_json (~> 1.0)
|
84
|
+
simplecov-html (~> 0.7.1)
|
85
|
+
simplecov-html (0.7.1)
|
86
|
+
sprockets (2.10.0)
|
87
|
+
hike (~> 1.2)
|
88
|
+
multi_json (~> 1.0)
|
89
|
+
rack (~> 1.0)
|
90
|
+
tilt (~> 1.1, != 1.3.0)
|
91
|
+
sprockets-rails (2.0.0)
|
92
|
+
actionpack (>= 3.0)
|
93
|
+
activesupport (>= 3.0)
|
94
|
+
sprockets (~> 2.8)
|
95
|
+
thor (0.18.1)
|
96
|
+
thread_safe (0.1.2)
|
97
|
+
atomic
|
98
|
+
tilt (1.4.1)
|
99
|
+
treetop (1.4.14)
|
100
|
+
polyglot
|
101
|
+
polyglot (>= 0.3.1)
|
102
|
+
tzinfo (0.3.37)
|
103
|
+
uuidtools (2.1.4)
|
104
|
+
|
105
|
+
PLATFORMS
|
106
|
+
java
|
107
|
+
ruby
|
108
|
+
|
109
|
+
DEPENDENCIES
|
110
|
+
appraisal (~> 0.5)
|
111
|
+
aws-sdk (~> 1.0)
|
112
|
+
dotenv (~> 0.7)
|
113
|
+
minitar (~> 0.5)
|
114
|
+
open4
|
115
|
+
posix-spawn
|
116
|
+
rails (= 4.0.0)
|
117
|
+
rake (~> 10.0)
|
118
|
+
rspec (~> 2.14)
|
119
|
+
simplecov (~> 0.7)
|
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
|
data/lib/rr/double.rb
CHANGED
@@ -4,14 +4,20 @@ module RR
|
|
4
4
|
# and the implementation.
|
5
5
|
class Double
|
6
6
|
extend(Module.new do
|
7
|
-
def formatted_name(method_name, args)
|
8
|
-
|
7
|
+
def formatted_name(method_name, args, kwargs)
|
8
|
+
formatted_arguments =
|
9
|
+
args.collect {|arg| arg.inspect} +
|
10
|
+
kwargs.collect {|keyword, value| "#{keyword}: #{value.inspect}"}
|
11
|
+
formatted_errors = formatted_arguments.join(', ')
|
9
12
|
"#{method_name}(#{formatted_errors})"
|
10
13
|
end
|
11
14
|
|
12
15
|
def list_message_part(doubles)
|
13
16
|
doubles.collect do |double|
|
14
|
-
|
17
|
+
name = formatted_name(double.method_name,
|
18
|
+
double.expected_arguments,
|
19
|
+
double.expected_keyword_arguments)
|
20
|
+
"- #{name}"
|
15
21
|
end.join("\n")
|
16
22
|
end
|
17
23
|
end)
|
@@ -32,14 +38,14 @@ module RR
|
|
32
38
|
|
33
39
|
# Double#exact_match? returns true when the passed in arguments
|
34
40
|
# exactly match the ArgumentEqualityExpectation arguments.
|
35
|
-
def exact_match?(
|
36
|
-
definition.exact_match?(
|
41
|
+
def exact_match?(arguments, keyword_arguments)
|
42
|
+
definition.exact_match?(arguments, keyword_arguments)
|
37
43
|
end
|
38
44
|
|
39
45
|
# Double#wildcard_match? returns true when the passed in arguments
|
40
46
|
# wildcard match the ArgumentEqualityExpectation arguments.
|
41
|
-
def wildcard_match?(
|
42
|
-
definition.wildcard_match?(
|
47
|
+
def wildcard_match?(arguments, keyword_arguments)
|
48
|
+
definition.wildcard_match?(arguments, keyword_arguments)
|
43
49
|
end
|
44
50
|
|
45
51
|
# Double#attempt? returns true when the
|
@@ -74,18 +80,26 @@ module RR
|
|
74
80
|
argument_expectation.expected_arguments
|
75
81
|
end
|
76
82
|
|
83
|
+
# The keyword arguments that this Double expects
|
84
|
+
def expected_keyword_arguments
|
85
|
+
verify_argument_expectation_is_set
|
86
|
+
argument_expectation.expected_keyword_arguments
|
87
|
+
end
|
88
|
+
|
77
89
|
# The TimesCalledMatcher for the TimesCalledExpectation
|
78
90
|
def times_matcher
|
79
91
|
definition.times_matcher
|
80
92
|
end
|
81
93
|
|
82
94
|
def formatted_name
|
83
|
-
self.class.formatted_name(method_name,
|
95
|
+
self.class.formatted_name(method_name,
|
96
|
+
expected_arguments,
|
97
|
+
expected_keyword_arguments)
|
84
98
|
end
|
85
99
|
|
86
|
-
def method_call(args)
|
100
|
+
def method_call(args, kwargs)
|
87
101
|
if verbose?
|
88
|
-
puts Double.formatted_name(method_name, args)
|
102
|
+
puts Double.formatted_name(method_name, args, kwargs)
|
89
103
|
end
|
90
104
|
times_called_expectation.attempt if definition.times_matcher
|
91
105
|
space.verify_ordered_double(self) if ordered?
|
@@ -148,6 +162,10 @@ module RR
|
|
148
162
|
definition.argument_expectation.expected_arguments
|
149
163
|
end
|
150
164
|
|
165
|
+
def kwargs
|
166
|
+
definition.argument_expectation.expected_keyword_arguments
|
167
|
+
end
|
168
|
+
|
151
169
|
def argument_expectation
|
152
170
|
definition.argument_expectation
|
153
171
|
end
|
@@ -36,16 +36,26 @@ module RR
|
|
36
36
|
end
|
37
37
|
|
38
38
|
module ArgumentDefinitionConstructionMethods
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
if KeywordArguments.fully_supported?
|
40
|
+
# Double#with sets the expectation that the Double will receive
|
41
|
+
# the passed in arguments.
|
42
|
+
#
|
43
|
+
# Passing in a block sets the return value.
|
44
|
+
#
|
45
|
+
# mock(subject).method_name.with(1, 2) {:return_value}
|
46
|
+
def with(*args, **kwargs, &return_value_block)
|
47
|
+
@argument_expectation =
|
48
|
+
Expectations::ArgumentEqualityExpectation.new(args, kwargs)
|
49
|
+
install_method_callback return_value_block
|
50
|
+
self
|
51
|
+
end
|
52
|
+
else
|
53
|
+
def with(*args, &return_value_block)
|
54
|
+
@argument_expectation =
|
55
|
+
Expectations::ArgumentEqualityExpectation.new(args, {})
|
56
|
+
install_method_callback return_value_block
|
57
|
+
self
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
# Double#with_any_args sets the expectation that the Double can receive
|
@@ -67,7 +77,8 @@ module RR
|
|
67
77
|
#
|
68
78
|
# mock(subject).method_name.with_no_args {:return_value}
|
69
79
|
def with_no_args(&return_value_block)
|
70
|
-
@argument_expectation =
|
80
|
+
@argument_expectation =
|
81
|
+
Expectations::ArgumentEqualityExpectation.new([], {})
|
71
82
|
install_method_callback return_value_block
|
72
83
|
self
|
73
84
|
end
|
@@ -298,18 +309,18 @@ module RR
|
|
298
309
|
@verbose ? true : false
|
299
310
|
end
|
300
311
|
|
301
|
-
def exact_match?(
|
312
|
+
def exact_match?(arguments, keyword_arguments)
|
302
313
|
unless @argument_expectation
|
303
314
|
raise RR::Errors.build_error(:DoubleDefinitionError, "#argument_expectation must be defined on #{inspect}")
|
304
315
|
end
|
305
|
-
@argument_expectation.exact_match?(
|
316
|
+
@argument_expectation.exact_match?(arguments, keyword_arguments)
|
306
317
|
end
|
307
318
|
|
308
|
-
def wildcard_match?(
|
319
|
+
def wildcard_match?(arguments, keyword_arguments)
|
309
320
|
unless @argument_expectation
|
310
321
|
raise RR::Errors.build_error(:DoubleDefinitionError, "#argument_expectation must be defined on #{inspect}")
|
311
322
|
end
|
312
|
-
@argument_expectation.wildcard_match?(
|
323
|
+
@argument_expectation.wildcard_match?(arguments, keyword_arguments)
|
313
324
|
end
|
314
325
|
|
315
326
|
def terminal?
|
@@ -320,7 +331,19 @@ module RR
|
|
320
331
|
end
|
321
332
|
|
322
333
|
def expected_arguments
|
323
|
-
|
334
|
+
if argument_expectation
|
335
|
+
argument_expectation.expected_arguments
|
336
|
+
else
|
337
|
+
[]
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
def expected_keyword_arguments
|
342
|
+
if argument_expectation
|
343
|
+
argument_expectation.expected_keyword_arguments
|
344
|
+
else
|
345
|
+
{}
|
346
|
+
end
|
324
347
|
end
|
325
348
|
|
326
349
|
def implementation_is_original_method?
|