rr 1.1.2.rc1 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,67 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
2
+
3
+ module RR
4
+ describe DSL do
5
+ include DSL
6
+
7
+ describe "#anything" do
8
+ it "returns an Anything matcher" do
9
+ expect(anything).to eq RR::WildcardMatchers::Anything.new
10
+ end
11
+
12
+ it "rr_anything returns an Anything matcher" do
13
+ expect(rr_anything).to eq RR::WildcardMatchers::Anything.new
14
+ end
15
+ end
16
+
17
+ describe "#is_a" do
18
+ it "returns an IsA matcher" do
19
+ expect(is_a(Integer)).to eq RR::WildcardMatchers::IsA.new(Integer)
20
+ end
21
+
22
+ it "rr_is_a returns an IsA matcher" do
23
+ expect(rr_is_a(Integer)).to eq RR::WildcardMatchers::IsA.new(Integer)
24
+ end
25
+ end
26
+
27
+ describe "#numeric" do
28
+ it "returns an Numeric matcher" do
29
+ expect(numeric).to eq RR::WildcardMatchers::Numeric.new
30
+ end
31
+
32
+ it "rr_numeric returns an Numeric matcher" do
33
+ expect(rr_numeric).to eq RR::WildcardMatchers::Numeric.new
34
+ end
35
+ end
36
+
37
+ describe "#boolean" do
38
+ it "returns an Boolean matcher" do
39
+ expect(boolean).to eq RR::WildcardMatchers::Boolean.new
40
+ end
41
+
42
+ it "rr_boolean returns an Boolean matcher" do
43
+ expect(rr_boolean).to eq RR::WildcardMatchers::Boolean.new
44
+ end
45
+ end
46
+
47
+ describe "#duck_type" do
48
+ it "returns a DuckType matcher" do
49
+ expect(duck_type(:one, :two)).to eq RR::WildcardMatchers::DuckType.new(:one, :two)
50
+ end
51
+
52
+ it "rr_duck_type returns a DuckType matcher" do
53
+ expect(rr_duck_type(:one, :two)).to eq RR::WildcardMatchers::DuckType.new(:one, :two)
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "#any_times" do
59
+ it "returns an AnyTimesMatcher" do
60
+ expect(any_times).to eq RR::TimesCalledMatchers::AnyTimesMatcher.new
61
+ end
62
+
63
+ it "rr_any_times returns an AnyTimesMatcher" do
64
+ expect(rr_any_times).to eq RR::TimesCalledMatchers::AnyTimesMatcher.new
65
+ end
66
+ end
67
+ end
@@ -21,26 +21,26 @@ module RR
21
21
  end
22
22
 
23
23
  it "returns false when comparing with ArgumentEqualityExpectation" do
24
- expect(expectation).to_not eq ArgumentEqualityExpectation.new(1)
24
+ expect(expectation).to_not eq ArgumentEqualityExpectation.new([1], {})
25
25
  end
26
26
  end
27
27
 
28
28
  describe "#exact_match?" do
29
29
  it "returns false" do
30
- expectation.should_not be_exact_match(1, 2, 3)
31
- expectation.should_not be_exact_match(1, 2)
32
- expectation.should_not be_exact_match(1)
33
- expectation.should_not be_exact_match()
34
- expectation.should_not be_exact_match("does not match")
30
+ expectation.should_not be_exact_match([1, 2, 3], {})
31
+ expectation.should_not be_exact_match([1, 2], {})
32
+ expectation.should_not be_exact_match([1], {})
33
+ expectation.should_not be_exact_match([], {})
34
+ expectation.should_not be_exact_match(["does not match"], {})
35
35
  end
36
36
  end
37
37
 
38
38
  describe "#wildcard_match?" do
39
39
  it "returns true" do
40
40
  expectation = AnyArgumentExpectation.new
41
- expect(expectation).to be_wildcard_match(1, 2, 3)
42
- expect(expectation).to be_wildcard_match("whatever")
43
- expect(expectation).to be_wildcard_match("whatever", "else")
41
+ expect(expectation).to be_wildcard_match([1, 2, 3], {})
42
+ expect(expectation).to be_wildcard_match(["whatever"], {})
43
+ expect(expectation).to be_wildcard_match(["whatever", "else"], {})
44
44
  end
45
45
  end
46
46
  end
@@ -5,7 +5,7 @@ module RR
5
5
  describe ArgumentEqualityExpectation do
6
6
  attr_reader :expectation
7
7
  before do
8
- @expectation = ArgumentEqualityExpectation.new(1, 2, 3)
8
+ @expectation = ArgumentEqualityExpectation.new([1, 2, 3], {})
9
9
  end
10
10
 
11
11
  describe "#expected_arguments" do
@@ -16,30 +16,30 @@ module RR
16
16
 
17
17
  describe "==" do
18
18
  it "returns true when passed in expected_arguments are equal" do
19
- expect(expectation).to eq ArgumentEqualityExpectation.new(1, 2, 3)
19
+ expect(expectation).to eq ArgumentEqualityExpectation.new([1, 2, 3], {})
20
20
  end
21
21
 
22
22
  it "returns false when passed in expected_arguments are not equal" do
23
- expect(expectation).to_not eq ArgumentEqualityExpectation.new(1, 2)
24
- expect(expectation).to_not eq ArgumentEqualityExpectation.new(1)
25
- expect(expectation).to_not eq ArgumentEqualityExpectation.new(:something)
26
- expect(expectation).to_not eq ArgumentEqualityExpectation.new()
23
+ expect(expectation).to_not eq ArgumentEqualityExpectation.new([1, 2], {})
24
+ expect(expectation).to_not eq ArgumentEqualityExpectation.new([1], {})
25
+ expect(expectation).to_not eq ArgumentEqualityExpectation.new([:something], {})
26
+ expect(expectation).to_not eq ArgumentEqualityExpectation.new([], {})
27
27
  end
28
28
  end
29
29
 
30
30
  describe "#exact_match?" do
31
31
  context "when all arguments exactly match" do
32
32
  it "returns true" do
33
- expect(expectation).to be_exact_match(1, 2, 3)
33
+ expect(expectation).to be_exact_match([1, 2, 3], {})
34
34
  end
35
35
  end
36
36
 
37
37
  context "when all arguments do not exactly match" do
38
38
  it "returns false" do
39
- expectation.should_not be_exact_match(1, 2)
40
- expectation.should_not be_exact_match(1)
41
- expectation.should_not be_exact_match()
42
- expectation.should_not be_exact_match("does not match")
39
+ expectation.should_not be_exact_match([1, 2], {})
40
+ expectation.should_not be_exact_match([1], {})
41
+ expectation.should_not be_exact_match([], {})
42
+ expectation.should_not be_exact_match(["does not match"], {})
43
43
  end
44
44
  end
45
45
  end
@@ -47,26 +47,26 @@ module RR
47
47
  describe "#wildcard_match?" do
48
48
  context "when not an exact match" do
49
49
  it "returns false" do
50
- expectation = ArgumentEqualityExpectation.new(1)
51
- expectation.should_not be_wildcard_match(1, 2, 3)
52
- expectation.should_not be_wildcard_match("whatever")
53
- expectation.should_not be_wildcard_match("whatever", "else")
50
+ expectation = ArgumentEqualityExpectation.new([1], {})
51
+ expectation.should_not be_wildcard_match([1, 2, 3], {})
52
+ expectation.should_not be_wildcard_match(["whatever"], {})
53
+ expectation.should_not be_wildcard_match(["whatever", "else"], {})
54
54
  end
55
55
  end
56
56
 
57
57
  context "when an exact match" do
58
58
  it "returns true" do
59
- expectation = ArgumentEqualityExpectation.new(1, 2)
60
- expect(expectation).to be_wildcard_match(1, 2)
61
- expectation.should_not be_wildcard_match(1)
62
- expectation.should_not be_wildcard_match("whatever", "else")
59
+ expectation = ArgumentEqualityExpectation.new([1, 2], {})
60
+ expect(expectation).to be_wildcard_match([1, 2], {})
61
+ expectation.should_not be_wildcard_match([1], {})
62
+ expectation.should_not be_wildcard_match(["whatever", "else"], {})
63
63
  end
64
64
  end
65
65
 
66
66
  context "when not passed correct number of arguments" do
67
67
  it "returns false" do
68
- expectation.should_not be_wildcard_match()
69
- expectation.should_not be_wildcard_match(Object.new, Object.new)
68
+ expectation.should_not be_wildcard_match([], {})
69
+ expectation.should_not be_wildcard_match([Object.new, Object.new], {})
70
70
  end
71
71
  end
72
72
  end
@@ -7,20 +7,20 @@ module RR
7
7
  attr_reader :expectation
8
8
 
9
9
  before do
10
- @expectation = ArgumentEqualityExpectation.new(boolean)
10
+ @expectation = ArgumentEqualityExpectation.new([boolean], {})
11
11
  end
12
12
 
13
13
  describe "#wildcard_match?" do
14
14
  context "when passed a Boolean" do
15
15
  it "returns true" do
16
- expect(expectation).to be_wildcard_match(true)
17
- expect(expectation).to be_wildcard_match(false)
16
+ expect(expectation).to be_wildcard_match([true], {})
17
+ expect(expectation).to be_wildcard_match([false], {})
18
18
  end
19
19
  end
20
20
 
21
21
  context "when not passed a Boolean" do
22
22
  it "returns false" do
23
- expectation.should_not be_wildcard_match(:not_a_boolean)
23
+ expectation.should_not be_wildcard_match([:not_a_boolean], {})
24
24
  end
25
25
  end
26
26
  end
@@ -11,70 +11,80 @@ module Expectations
11
11
 
12
12
  describe "#exact_match?" do
13
13
  before do
14
- @expectation = ArgumentEqualityExpectation.new(hash_including(expected_hash))
14
+ @expectation = ArgumentEqualityExpectation.new([hash_including(expected_hash)], {})
15
15
  end
16
16
 
17
17
  it "returns true when passed in a HashIncluding matcher with the same hash" do
18
- expect(expectation).to be_exact_match(RR::WildcardMatchers::HashIncluding.new(expected_hash))
18
+ expect(expectation).to be_exact_match([RR::WildcardMatchers::HashIncluding.new(expected_hash)],
19
+ {})
19
20
  end
20
21
 
21
22
  it "returns false when passed in a HashIncluding matcher with a different argument list" do
22
- expectation.should_not be_exact_match(RR::WildcardMatchers::HashIncluding.new(:foo => 1))
23
+ expectation.should_not be_exact_match([RR::WildcardMatchers::HashIncluding.new(:foo => 1)],
24
+ {})
23
25
  end
24
26
 
25
27
  it "returns false otherwise" do
26
- expectation.should_not be_exact_match("hello")
27
- expectation.should_not be_exact_match(:hello)
28
- expectation.should_not be_exact_match(1)
29
- expectation.should_not be_exact_match(nil)
30
- expectation.should_not be_exact_match(true)
31
- expectation.should_not be_exact_match()
28
+ expectation.should_not be_exact_match(["hello"], {})
29
+ expectation.should_not be_exact_match([:hello], {})
30
+ expectation.should_not be_exact_match([1], {})
31
+ expectation.should_not be_exact_match([nil], {})
32
+ expectation.should_not be_exact_match([true], {})
33
+ expectation.should_not be_exact_match([], {})
32
34
  end
33
35
  end
34
36
 
35
37
  describe "#wildcard_match?" do
36
38
  before do
37
- @expectation = ArgumentEqualityExpectation.new(hash_including(expected_hash))
39
+ @expectation = ArgumentEqualityExpectation.new([hash_including(expected_hash)],
40
+ {})
38
41
  end
39
42
 
40
43
  it "returns true when hash contains same key/values as the expectation" do
41
- expect(expectation).to be_wildcard_match(expected_hash)
44
+ expect(expectation).to be_wildcard_match([expected_hash], {})
42
45
  end
43
46
 
44
47
  it "returns true when hash contains at least expectation's key/values" do
45
- expect(expectation).to be_wildcard_match(expected_hash.merge(:oregon => "Salem"))
48
+ expect(expectation).to be_wildcard_match([expected_hash.merge(:oregon => "Salem")],
49
+ {})
46
50
  end
47
51
 
48
52
  it "returns true when passed the same hash, even after the original is modified" do
49
53
  original_expected_hash = expected_hash.clone
50
54
  expected_hash[:texas] = nil
51
- expect(expectation).to be_wildcard_match(original_expected_hash)
55
+ expect(expectation).to be_wildcard_match([original_expected_hash], {})
52
56
  end
53
57
 
54
58
  it "returns true even if one of the expectation's values is nil" do
55
- expectation = ArgumentEqualityExpectation.new(hash_including(:foo => nil))
56
- expect(expectation).to be_wildcard_match({:foo => nil})
59
+ expectation = ArgumentEqualityExpectation.new([hash_including(:foo => nil)],
60
+ {})
61
+ expect(expectation).to be_wildcard_match([{:foo => nil}],
62
+ {})
57
63
  end
58
64
 
59
65
  it "returns false when hash matches only some required key/values" do
60
- expectation.should_not be_wildcard_match({:texas => "Austin"})
66
+ expectation.should_not be_wildcard_match([{:texas => "Austin"}],
67
+ {})
61
68
  end
62
69
 
63
70
  it "returns false when hash matches all the keys but not all the values" do
64
- expectation.should_not be_wildcard_match({:texas => "Austin", :maine => "Portland"})
71
+ expectation.should_not be_wildcard_match([{:texas => "Austin", :maine => "Portland"}],
72
+ {})
65
73
  end
66
74
 
67
75
  it "returns false when passed a hash that matches all values but not all keys" do
68
- expectation.should_not be_wildcard_match({:texas => "Austin", :georgia => "Augusta"})
76
+ expectation.should_not be_wildcard_match([{:texas => "Austin", :georgia => "Augusta"}],
77
+ {})
69
78
  end
70
79
 
71
80
  it "returns true when an exact match" do
72
- expect(expectation).to be_wildcard_match(hash_including(expected_hash))
81
+ expect(expectation).to be_wildcard_match([hash_including(expected_hash)],
82
+ {})
73
83
  end
74
84
 
75
85
  it "returns false when not passed correct number of arguments" do
76
- expectation.should_not be_wildcard_match()
77
- expectation.should_not be_wildcard_match(:a, :b)
86
+ expectation.should_not be_wildcard_match([], {})
87
+ expectation.should_not be_wildcard_match([:a, :b], {})
78
88
  end
79
89
  end
80
90
  end
@@ -231,12 +231,6 @@ module RR
231
231
  end
232
232
 
233
233
  describe "being called" do
234
- it "defines __rr__original_{method_name} to be the lazily created method" do
235
- subject.foobar
236
- expect((!!subject.methods.detect {|method| method.to_sym == :__rr__original_foobar})).to be_true
237
- expect(subject.__rr__original_foobar).to eq :original_foobar
238
- end
239
-
240
234
  it "calls the lazily created method and returns the injected method return value" do
241
235
  original_return_value = nil
242
236
  stub.proxy(subject).foobar {|arg| original_return_value = arg; :new_foobar}
@@ -383,12 +377,6 @@ module RR
383
377
  end
384
378
 
385
379
  describe "being called" do
386
- it "defines __rr__original_{method_name} to be the lazily created method" do
387
- subject.foobar
388
- expect((!!subject.methods.detect {|method| method.to_sym == :__rr__original_foobar})).to be_true
389
- expect(subject.__rr__original_foobar).to eq :original_foobar
390
- end
391
-
392
380
  it "calls the lazily created method and returns the injected method return value" do
393
381
  original_return_value = nil
394
382
  stub.proxy(subject).foobar {|arg| original_return_value = arg; :new_foobar}
@@ -2,7 +2,7 @@ require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
2
2
 
3
3
  module RR
4
4
  module Integrations
5
- describe RSpec1 do
5
+ describe RSpec2 do
6
6
  attr_reader :fixture, :method_name
7
7
 
8
8
  describe "#setup_mocks_for_rspec" do
@@ -10,7 +10,7 @@ module RR
10
10
 
11
11
  before do
12
12
  @fixture = Object.new
13
- fixture.extend RSpec1::Mixin
13
+ fixture.extend RSpec2::Mixin
14
14
  @method_name = :foobar
15
15
  end
16
16
 
@@ -28,7 +28,7 @@ module RR
28
28
 
29
29
  before do
30
30
  @fixture = Object.new
31
- fixture.extend RSpec1::Mixin
31
+ fixture.extend RSpec2::Mixin
32
32
  @method_name = :foobar
33
33
  end
34
34
 
@@ -47,7 +47,7 @@ module RR
47
47
 
48
48
  before do
49
49
  @fixture = Object.new
50
- fixture.extend RSpec1::Mixin
50
+ fixture.extend RSpec2::Mixin
51
51
  @method_name = :foobar
52
52
  end
53
53
 
@@ -65,21 +65,6 @@ module RR
65
65
  expect(RR.trim_backtrace).to eq false
66
66
  end
67
67
  end
68
-
69
- describe '#have_received' do
70
- it "creates an invocation matcher with a method name" do
71
- method = :test
72
- matcher = 'fake'
73
- mock(RR::Integrations::RSpec::InvocationMatcher).new(method) { matcher }
74
- expect(have_received(method)).to eq matcher
75
- end
76
-
77
- it "creates an invocation matcher without a method name" do
78
- matcher = 'fake'
79
- mock(RR::Integrations::RSpec::InvocationMatcher).new(nil) { matcher }
80
- expect(have_received).to eq matcher
81
- end
82
- end
83
68
  end
84
69
  end
85
70
  end
@@ -11,9 +11,12 @@ module RR
11
11
  describe "#record_call" do
12
12
  it "should add a call to the list" do
13
13
  object = Object.new
14
- block = lambda {}
15
- space.record_call(object, :to_s, [], block)
16
- expect(space.recorded_calls).to eq RR::RecordedCalls.new([[object, :to_s, [], block]])
14
+ method_name = :to_s
15
+ arguments = []
16
+ keyword_arguments = {}
17
+ space.record_call(object, method_name, arguments, keyword_arguments, lambda {})
18
+ expect(space.recorded_calls[0]).to eq \
19
+ RR::RecordedCall.new(object, method_name, arguments, keyword_arguments, lambda {})
17
20
  end
18
21
  end
19
22
 
@@ -200,7 +203,7 @@ module RR
200
203
 
201
204
  it "should clear the #recorded_calls" do
202
205
  object = Object.new
203
- space.record_call(object, :to_s, [], nil)
206
+ space.record_call(object, :to_s, [], {}, nil)
204
207
 
205
208
  space.reset
206
209
  expect(space.recorded_calls).to eq RR::RecordedCalls.new([])
@@ -12,7 +12,7 @@ describe RR::SpyVerification do
12
12
 
13
13
  include_examples "Swapped Space"
14
14
 
15
- include RR::Adapters::RRMethods
15
+ include RR::DSL
16
16
 
17
17
  before(:each) do
18
18
  stub(subject).foobar
@@ -9,7 +9,7 @@ class Adapter
9
9
 
10
10
  def appraisal_name
11
11
  parts = []
12
- parts << (RUBY_VERSION =~ /^1\.8/ ? 'ruby_18' : 'ruby_19')
12
+ parts << 'ruby_19'
13
13
  parts << name
14
14
  parts.join('_')
15
15
  end