rr 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +3 -43
  3. data/CHANGES.md +46 -0
  4. data/CREDITS.md +5 -0
  5. data/Gemfile +3 -12
  6. data/README.md +25 -24
  7. data/Rakefile +16 -38
  8. data/doc/02_syntax_comparison.md +1 -0
  9. data/lib/rr/core_ext/array.rb +2 -0
  10. data/lib/rr/core_ext/hash.rb +2 -0
  11. data/lib/rr/deprecations.rb +97 -0
  12. data/lib/rr/double_definitions/double_injections/any_instance_of.rb +1 -1
  13. data/lib/rr/double_definitions/double_injections/instance.rb +2 -2
  14. data/lib/rr/dsl.rb +152 -0
  15. data/lib/rr/injections/method_missing_injection.rb +6 -2
  16. data/lib/rr/integrations/minitest_4.rb +1 -1
  17. data/lib/rr/integrations/minitest_4_active_support.rb +1 -1
  18. data/lib/rr/integrations/rspec/invocation_matcher.rb +0 -8
  19. data/lib/rr/integrations/rspec_2.rb +20 -2
  20. data/lib/rr/recorded_call.rb +29 -0
  21. data/lib/rr/recorded_calls.rb +8 -4
  22. data/lib/rr/space.rb +1 -1
  23. data/lib/rr/spy_verification.rb +13 -5
  24. data/lib/rr/version.rb +1 -1
  25. data/lib/rr/wildcard_matchers.rb +10 -10
  26. data/lib/rr/without_autohook.rb +5 -13
  27. data/rr.gemspec +3 -3
  28. data/spec/defines_spec_suite_tasks.rb +12 -0
  29. data/spec/global_helper.rb +5 -0
  30. data/spec/spec_suite_configuration.rb +1 -7
  31. data/spec/suites.yml +1 -1
  32. data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +133 -33
  33. data/spec/suites/rspec_2/functional/dont_allow_spec.rb +13 -8
  34. data/spec/suites/rspec_2/functional/mock_bang_spec.rb +20 -0
  35. data/spec/suites/rspec_2/functional/mock_instance_of_spec.rb +14 -0
  36. data/spec/suites/rspec_2/functional/mock_instance_of_strong_spec.rb +15 -0
  37. data/spec/suites/rspec_2/functional/mock_proxy_instance_of_spec.rb +15 -0
  38. data/spec/suites/rspec_2/functional/mock_proxy_spec.rb +14 -0
  39. data/spec/suites/rspec_2/functional/mock_spec.rb +8 -232
  40. data/spec/suites/rspec_2/functional/mock_strong_spec.rb +14 -0
  41. data/spec/suites/rspec_2/functional/received_spec.rb +16 -0
  42. data/spec/suites/rspec_2/functional/spy_spec.rb +89 -28
  43. data/spec/suites/rspec_2/functional/stub_bang_spec.rb +20 -0
  44. data/spec/suites/rspec_2/functional/stub_instance_of_spec.rb +15 -0
  45. data/spec/suites/rspec_2/functional/stub_instance_of_strong_spec.rb +15 -0
  46. data/spec/suites/rspec_2/functional/stub_proxy_instance_of_spec.rb +16 -0
  47. data/spec/suites/rspec_2/functional/stub_proxy_spec.rb +45 -0
  48. data/spec/suites/rspec_2/functional/stub_spec.rb +42 -161
  49. data/spec/suites/rspec_2/functional/stub_strong_spec.rb +15 -0
  50. data/spec/suites/rspec_2/helper.rb +2 -2
  51. data/spec/suites/rspec_2/support/mixins/double_definition_creator_helpers.rb +173 -0
  52. data/spec/suites/rspec_2/support/mixins/mock_definition_creator_helpers.rb +45 -0
  53. data/spec/suites/rspec_2/support/mixins/proxy_definition_creator_helpers.rb +33 -0
  54. data/spec/suites/rspec_2/support/mixins/stub_creator_helpers.rb +43 -0
  55. data/spec/suites/rspec_2/support/mixins/stub_definition_creator_helpers.rb +45 -0
  56. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_with_never_called_qualifier.rb +39 -0
  57. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_with_times_called_qualifier.rb +50 -0
  58. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/argument_expectations_without_qualifiers.rb +131 -0
  59. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/dont_allow.rb +148 -0
  60. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_instance_of.rb +26 -0
  61. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_instance_of_strong.rb +28 -0
  62. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_proxy.rb +11 -0
  63. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mock_strong.rb +37 -0
  64. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/mocking.rb +107 -0
  65. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_instance_of.rb +32 -0
  66. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_instance_of_strong.rb +39 -0
  67. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_proxy.rb +11 -0
  68. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stub_strong.rb +37 -0
  69. data/spec/suites/rspec_2/support/shared_contexts/double_definition_creators/stubbing.rb +57 -0
  70. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/array_flatten_bug.rb +35 -0
  71. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/block_form.rb +31 -0
  72. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/comparing_arity.rb +63 -0
  73. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/object_is_proxy.rb +43 -0
  74. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/sequential_invocations.rb +26 -0
  75. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/setting_implementation.rb +51 -0
  76. data/spec/suites/rspec_2/support/shared_examples/double_definition_creators/yields.rb +81 -0
  77. data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +0 -28
  78. data/spec/suites/rspec_2/unit/deprecations_spec.rb +27 -0
  79. data/spec/suites/rspec_2/unit/dsl/double_creators_spec.rb +133 -0
  80. data/spec/suites/rspec_2/unit/dsl/space_spec.rb +99 -0
  81. data/spec/suites/rspec_2/unit/dsl/wildcard_matchers_spec.rb +67 -0
  82. data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +4 -19
  83. data/spec/suites/rspec_2/unit/space_spec.rb +5 -3
  84. data/spec/suites/rspec_2/unit/spy_verification_spec.rb +1 -1
  85. data/spec/support/adapter.rb +1 -1
  86. data/spec/support/adapter_tests/rspec.rb +19 -15
  87. data/spec/support/project/generator.rb +0 -4
  88. metadata +55 -48
  89. data/gemfiles/ruby_18_rspec_1.gemfile +0 -14
  90. data/gemfiles/ruby_18_rspec_1.gemfile.lock +0 -38
  91. data/gemfiles/ruby_18_rspec_1_rails_2.gemfile +0 -18
  92. data/gemfiles/ruby_18_rspec_1_rails_2.gemfile.lock +0 -64
  93. data/gemfiles/ruby_19_rspec_2_rails_3.gemfile +0 -15
  94. data/gemfiles/ruby_19_rspec_2_rails_3.gemfile.lock +0 -123
  95. data/lib/rr/adapters.rb +0 -34
  96. data/lib/rr/adapters/rr_methods.rb +0 -142
  97. data/lib/rr/integrations/rspec_1.rb +0 -46
  98. data/lib/rr/integrations/test_unit_1.rb +0 -63
  99. data/lib/rr/integrations/test_unit_2.rb +0 -17
  100. data/lib/rr/integrations/test_unit_200.rb +0 -27
  101. data/lib/rr/integrations/test_unit_200_active_support.rb +0 -25
  102. data/lib/rr/integrations/test_unit_2_active_support.rb +0 -38
  103. data/spec/suites/rspec_1/helper.rb +0 -24
  104. data/spec/suites/rspec_1/integration/rspec_1_spec.rb +0 -93
  105. data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +0 -102
  106. data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +0 -109
  107. data/spec/suites/rspec_1/spec_helper.rb +0 -3
  108. data/spec/suites/rspec_1_rails_2/integration/astc_rails_2_spec.rb +0 -141
  109. data/spec/suites/rspec_1_rails_2/integration/rspec_1_rails_2_spec.rb +0 -132
  110. data/spec/suites/rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb +0 -141
  111. data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +0 -148
  112. data/spec/suites/rspec_1_rails_2/spec_helper.rb +0 -3
  113. data/spec/suites/rspec_2/functional/dsl_spec.rb +0 -13
  114. data/spec/suites/rspec_2/functional/instance_of_spec.rb +0 -14
  115. data/spec/suites/rspec_2/functional/proxy_spec.rb +0 -136
  116. data/spec/suites/rspec_2/functional/strong_spec.rb +0 -79
  117. data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +0 -102
  118. data/spec/suites/rspec_2/integration/test_unit_2_spec.rb +0 -109
  119. data/spec/suites/rspec_2/unit/adapters/rr_methods/double_creators_spec.rb +0 -135
  120. data/spec/suites/rspec_2/unit/adapters/rr_methods/space_spec.rb +0 -101
  121. data/spec/suites/rspec_2/unit/adapters/rr_methods/wildcard_matchers_spec.rb +0 -69
  122. data/spec/suites/rspec_2_rails_3/integration/astc_rails_3_spec.rb +0 -141
  123. data/spec/suites/rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb +0 -148
  124. data/spec/suites/rspec_2_rails_3/integration/rspec_2_rails_3_spec.rb +0 -172
  125. data/spec/suites/rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb +0 -141
  126. data/spec/suites/rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb +0 -148
  127. data/spec/suites/rspec_2_rails_3/spec_helper.rb +0 -3
  128. data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +0 -142
  129. data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +0 -149
@@ -42,34 +42,6 @@ describe Enumerable do
42
42
  end
43
43
  end
44
44
 
45
- if RUBY_VERSION =~ /^1.8/
46
- context 'when the Enumerable is a String' do
47
- subject { 'foo' }
48
-
49
- it "returns true if the String is exactly equal to the given String" do
50
- should wildcard_match('foo')
51
- end
52
-
53
- it "returns false if the string is not exactly equal to the given String" do
54
- should_not wildcard_match('bar')
55
- end
56
-
57
- context 'whose #== method has been proxied' do
58
- before do
59
- @r1 = 'x'
60
- @r2 = 'y'
61
- mock.proxy(@r1) == @r1
62
- mock.proxy(@r1) == @r2
63
- end
64
-
65
- it "doesn't blow up with a recursive loop error" do
66
- @r1 == @r1
67
- @r1 == @r2
68
- end
69
- end
70
- end
71
- end
72
-
73
45
  context 'when not given an Enumerable' do
74
46
  subject { klass.new({:foo => 'bar'}) }
75
47
 
@@ -0,0 +1,27 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+ describe 'Deprecations' do
4
+ before do
5
+ stub(RR::Deprecations).show_warning
6
+ end
7
+
8
+ specify 'RR::Adapters::MiniTest still works' do
9
+ expect { RR::Adapters::MiniTest }.not_to raise_error
10
+ end
11
+
12
+ specify 'RR::Adapters::TestUnit still works' do
13
+ expect { RR::Adapters::TestUnit }.not_to raise_error
14
+ end
15
+
16
+ specify 'RR::Adapters::Rspec::InvocationMatcher still works' do
17
+ expect { RR::Adapters::Rspec::InvocationMatcher }.not_to raise_error
18
+ end
19
+
20
+ specify 'RR::Adapters::RRMethods should still work' do
21
+ expect { RR::Adapters::RRMethods }.not_to raise_error
22
+ end
23
+
24
+ specify 'RR::Extensions::InstanceMethods should still work' do
25
+ expect { RR::Extensions::InstanceMethods }.not_to raise_error
26
+ end
27
+ end
@@ -0,0 +1,133 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
2
+
3
+ module RR
4
+ describe DSL do
5
+ subject { Object.new }
6
+
7
+ after(:each) do
8
+ RR.reset
9
+ end
10
+
11
+ describe "normal strategy definitions" do
12
+ attr_reader :strategy_method_name
13
+
14
+ def call_strategy(*args, &block)
15
+ __send__(strategy_method_name, *args, &block)
16
+ end
17
+
18
+ describe "#mock" do
19
+ before do
20
+ @strategy_method_name = :mock
21
+ end
22
+
23
+ context "when passing no args" do
24
+ it "returns a DoubleDefinitionCreate" do
25
+ expect(call_strategy.class).to eq RR::DoubleDefinitions::DoubleDefinitionCreate
26
+ end
27
+ end
28
+
29
+ context "when passed a method_name argument" do
30
+ it "creates a mock Double for method" do
31
+ double_definition = mock(subject, :foobar).returns {:baz}
32
+ expect(double_definition.times_matcher).to eq RR::TimesCalledMatchers::IntegerMatcher.new(1)
33
+ expect(double_definition.argument_expectation.class).to eq RR::Expectations::ArgumentEqualityExpectation
34
+ expect(double_definition.argument_expectation.expected_arguments).to eq []
35
+ expect(subject.foobar).to eq :baz
36
+ end
37
+ end
38
+ end
39
+
40
+ describe "#stub" do
41
+ before do
42
+ @strategy_method_name = :stub
43
+ end
44
+
45
+ context "when passing no args" do
46
+ it "returns a DoubleDefinitionCreate" do
47
+ expect(call_strategy.class).to eq RR::DoubleDefinitions::DoubleDefinitionCreate
48
+ end
49
+ end
50
+
51
+ context "when passed a method_name argument" do
52
+ it "creates a stub Double for method when passed a method_name argument" do
53
+ double_definition = stub(subject, :foobar).returns {:baz}
54
+ expect(double_definition.times_matcher).to eq RR::TimesCalledMatchers::AnyTimesMatcher.new
55
+ expect(double_definition.argument_expectation.class).to eq RR::Expectations::AnyArgumentExpectation
56
+ expect(subject.foobar).to eq :baz
57
+ end
58
+ end
59
+ end
60
+
61
+ describe "#dont_allow" do
62
+ before do
63
+ @strategy_method_name = :dont_allow
64
+ end
65
+
66
+ context "when passing no args" do
67
+ it "returns a DoubleDefinitionCreate" do
68
+ expect(call_strategy.class).to eq RR::DoubleDefinitions::DoubleDefinitionCreate
69
+ end
70
+ end
71
+
72
+ context "when passed a method_name argument_expectation" do
73
+ it "creates a mock Double for method" do
74
+ double_definition = dont_allow(subject, :foobar)
75
+ expect(double_definition.times_matcher).to eq RR::TimesCalledMatchers::NeverMatcher.new
76
+ expect(double_definition.argument_expectation.class).to eq RR::Expectations::AnyArgumentExpectation
77
+
78
+ expect {
79
+ subject.foobar
80
+ }.to raise_error(RR::Errors::TimesCalledError)
81
+ RR.reset
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ describe "! strategy definitions" do
88
+ attr_reader :strategy_method_name
89
+ def call_strategy(*args, &definition_eval_block)
90
+ __send__(strategy_method_name, *args, &definition_eval_block)
91
+ end
92
+
93
+ describe "#mock!" do
94
+ before do
95
+ @strategy_method_name = :mock!
96
+ end
97
+
98
+ context "when passed a method_name argument" do
99
+ it "sets #verification_strategy to Mock" do
100
+ proxy = mock!(:foobar)
101
+ expect(proxy.double_definition_create.verification_strategy.class).to eq RR::DoubleDefinitions::Strategies::Verification::Mock
102
+ end
103
+ end
104
+ end
105
+
106
+ describe "#stub!" do
107
+ before do
108
+ @strategy_method_name = :stub!
109
+ end
110
+
111
+ context "when passed a method_name argument" do
112
+ it "sets #verification_strategy to Stub" do
113
+ proxy = stub!(:foobar)
114
+ expect(proxy.double_definition_create.verification_strategy.class).to eq RR::DoubleDefinitions::Strategies::Verification::Stub
115
+ end
116
+ end
117
+ end
118
+
119
+ describe "#dont_allow!" do
120
+ before do
121
+ @strategy_method_name = :dont_allow!
122
+ end
123
+
124
+ context "when passed a method_name argument" do
125
+ it "sets #verification_strategy to DontAllow" do
126
+ proxy = dont_allow!(:foobar)
127
+ expect(proxy.double_definition_create.verification_strategy.class).to eq RR::DoubleDefinitions::Strategies::Verification::DontAllow
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,99 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
2
+
3
+ module RR
4
+ describe DSL do
5
+ attr_reader :space, :subject_1, :subject_2, :method_name
6
+
7
+ include_examples "Swapped Space"
8
+
9
+ include RR::DSL
10
+
11
+ before do
12
+ @subject_1 = Object.new
13
+ @subject_2 = Object.new
14
+ @method_name = :foobar
15
+ end
16
+
17
+ describe "#verify" do
18
+ it "aliases #rr_verify" do
19
+ expect(DSL.instance_method("verify")).to eq DSL.instance_method("rr_verify")
20
+ end
21
+ end
22
+
23
+ describe "#rr_verify" do
24
+ it "verifies and deletes the double_injections" do
25
+ double_1 = ::RR::Injections::DoubleInjection.find_or_create_by_subject(subject_1, method_name)
26
+ double_1_verify_calls = 0
27
+ double_1_reset_calls = 0
28
+ (
29
+ class << double_1;
30
+ self;
31
+ end).class_eval do
32
+ define_method(:verify) do ||
33
+ double_1_verify_calls += 1
34
+ end
35
+ define_method(:reset) do ||
36
+ double_1_reset_calls += 1
37
+ end
38
+ end
39
+ double_2 = ::RR::Injections::DoubleInjection.find_or_create_by_subject(subject_2, method_name)
40
+ double_2_verify_calls = 0
41
+ double_2_reset_calls = 0
42
+ ( class << double_2; self; end).class_eval do
43
+ define_method(:verify) do ||
44
+ double_2_verify_calls += 1
45
+ end
46
+ define_method(:reset) do ||
47
+ double_2_reset_calls += 1
48
+ end
49
+ end
50
+
51
+ rr_verify
52
+ expect(double_1_verify_calls).to eq 1
53
+ expect(double_2_verify_calls).to eq 1
54
+ expect(double_1_reset_calls).to eq 1
55
+ expect(double_1_reset_calls).to eq 1
56
+ end
57
+ end
58
+
59
+ describe "#reset" do
60
+ it "aliases #rr_reset" do
61
+ expect(DSL.instance_method("reset")).to eq DSL.instance_method("rr_reset")
62
+ end
63
+ end
64
+
65
+ describe "#rr_reset" do
66
+ it "removes the ordered doubles" do
67
+ mock(subject_1).foobar1.ordered
68
+ mock(subject_2).foobar2.ordered
69
+
70
+ ::RR::Injections::DoubleInjection.instances.should_not be_empty
71
+
72
+ rr_reset
73
+ ::RR::Injections::DoubleInjection.instances
74
+ expect(::RR::Injections::DoubleInjection.instances).to be_empty
75
+ end
76
+
77
+ it "resets all double_injections" do
78
+ double_1 = ::RR::Injections::DoubleInjection.find_or_create_by_subject(subject_1, method_name)
79
+ double_1_reset_calls = 0
80
+ ( class << double_1; self; end).class_eval do
81
+ define_method(:reset) do ||
82
+ double_1_reset_calls += 1
83
+ end
84
+ end
85
+ double_2 = ::RR::Injections::DoubleInjection.find_or_create_by_subject(subject_2, method_name)
86
+ double_2_reset_calls = 0
87
+ ( class << double_2; self; end).class_eval do
88
+ define_method(:reset) do ||
89
+ double_2_reset_calls += 1
90
+ end
91
+ end
92
+
93
+ rr_reset
94
+ expect(double_1_reset_calls).to eq 1
95
+ expect(double_2_reset_calls).to eq 1
96
+ end
97
+ end
98
+ end
99
+ end
@@ -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
@@ -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,11 @@ 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
+ space.record_call(object, method_name, arguments, lambda {})
17
+ expect(space.recorded_calls[0]).to eq \
18
+ RR::RecordedCall.new(object, method_name, arguments, lambda {})
17
19
  end
18
20
  end
19
21
 
@@ -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