rr 1.1.1.rc1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CREDITS.md +61 -0
- data/VERSION +1 -1
- data/doc/01_test_double.md +16 -0
- data/doc/02_syntax_comparison.md +96 -0
- data/doc/03_api_overview.md +616 -0
- data/rr.gemspec +6 -6
- metadata +12 -230
- data/spec/global_helper.rb +0 -53
- data/spec/spec.opts +0 -2
- data/spec/suite.rb +0 -107
- data/spec/suites/common/adapter_integration_tests.rb +0 -160
- data/spec/suites/common/adapter_tests.rb +0 -43
- data/spec/suites/common/rails_integration_tests.rb +0 -106
- data/spec/suites/common/test_unit_tests.rb +0 -21
- data/spec/suites/minitest/integration/minitest_test.rb +0 -13
- data/spec/suites/minitest/test_helper.rb +0 -7
- data/spec/suites/minitest_4/integration/minitest_test.rb +0 -13
- data/spec/suites/minitest_4/test_helper.rb +0 -7
- data/spec/suites/rspec_1/helper.rb +0 -24
- data/spec/suites/rspec_1/integration/rspec_1_spec.rb +0 -77
- data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +0 -41
- data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +0 -57
- data/spec/suites/rspec_1/spec_helper.rb +0 -3
- data/spec/suites/rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb +0 -53
- data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +0 -57
- data/spec/suites/rspec_1_rails_2/spec_helper.rb +0 -3
- data/spec/suites/rspec_2/functional/any_instance_of_spec.rb +0 -47
- data/spec/suites/rspec_2/functional/dont_allow_spec.rb +0 -12
- 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/mock_spec.rb +0 -241
- data/spec/suites/rspec_2/functional/proxy_spec.rb +0 -136
- data/spec/suites/rspec_2/functional/spy_spec.rb +0 -41
- data/spec/suites/rspec_2/functional/strong_spec.rb +0 -79
- data/spec/suites/rspec_2/functional/stub_spec.rb +0 -190
- data/spec/suites/rspec_2/functional/wildcard_matchers_spec.rb +0 -128
- data/spec/suites/rspec_2/helper.rb +0 -27
- data/spec/suites/rspec_2/integration/minitest_4_spec.rb +0 -57
- data/spec/suites/rspec_2/integration/minitest_spec.rb +0 -57
- data/spec/suites/rspec_2/integration/rspec_2_spec.rb +0 -126
- data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +0 -57
- data/spec/suites/rspec_2/integration/test_unit_2_spec.rb +0 -57
- data/spec/suites/rspec_2/spec_helper.rb +0 -3
- data/spec/suites/rspec_2/support/matchers/wildcard_matcher_matchers.rb +0 -32
- data/spec/suites/rspec_2/support/shared_examples/space.rb +0 -13
- data/spec/suites/rspec_2/support/shared_examples/times_called_expectation.rb +0 -9
- 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/unit/core_ext/array_spec.rb +0 -39
- data/spec/suites/rspec_2/unit/core_ext/enumerable_spec.rb +0 -81
- data/spec/suites/rspec_2/unit/core_ext/hash_spec.rb +0 -55
- data/spec/suites/rspec_2/unit/core_ext/range_spec.rb +0 -41
- data/spec/suites/rspec_2/unit/core_ext/regexp_spec.rb +0 -41
- data/spec/suites/rspec_2/unit/double_definitions/child_double_definition_create_spec.rb +0 -114
- data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_blank_slate_spec.rb +0 -93
- data/spec/suites/rspec_2/unit/double_definitions/double_definition_create_spec.rb +0 -446
- data/spec/suites/rspec_2/unit/errors/rr_error_spec.rb +0 -67
- data/spec/suites/rspec_2/unit/expectations/any_argument_expectation_spec.rb +0 -48
- data/spec/suites/rspec_2/unit/expectations/anything_argument_equality_expectation_spec.rb +0 -14
- data/spec/suites/rspec_2/unit/expectations/argument_equality_expectation_spec.rb +0 -135
- data/spec/suites/rspec_2/unit/expectations/boolean_argument_equality_expectation_spec.rb +0 -30
- data/spec/suites/rspec_2/unit/expectations/hash_including_argument_equality_expectation_spec.rb +0 -82
- data/spec/suites/rspec_2/unit/expectations/satisfy_argument_equality_expectation_spec.rb +0 -61
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/any_times_matcher_spec.rb +0 -22
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_least_matcher_spec.rb +0 -37
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/at_most_matcher_spec.rb +0 -43
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/integer_matcher_spec.rb +0 -58
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/proc_matcher_spec.rb +0 -35
- data/spec/suites/rspec_2/unit/expectations/times_called_expectation/range_matcher_spec.rb +0 -39
- data/spec/suites/rspec_2/unit/hash_with_object_id_key_spec.rb +0 -88
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_spec.rb +0 -545
- data/spec/suites/rspec_2/unit/injections/double_injection/double_injection_verify_spec.rb +0 -32
- data/spec/suites/rspec_2/unit/integrations/rspec/invocation_matcher_spec.rb +0 -297
- data/spec/suites/rspec_2/unit/integrations/rspec_spec.rb +0 -85
- data/spec/suites/rspec_2/unit/proc_from_block_spec.rb +0 -14
- data/spec/suites/rspec_2/unit/rr_spec.rb +0 -28
- data/spec/suites/rspec_2/unit/space_spec.rb +0 -595
- data/spec/suites/rspec_2/unit/spy_verification_spec.rb +0 -133
- data/spec/suites/rspec_2/unit/times_called_matchers/any_times_matcher_spec.rb +0 -46
- data/spec/suites/rspec_2/unit/times_called_matchers/at_least_matcher_spec.rb +0 -54
- data/spec/suites/rspec_2/unit/times_called_matchers/at_most_matcher_spec.rb +0 -69
- data/spec/suites/rspec_2/unit/times_called_matchers/integer_matcher_spec.rb +0 -69
- data/spec/suites/rspec_2/unit/times_called_matchers/proc_matcher_spec.rb +0 -54
- data/spec/suites/rspec_2/unit/times_called_matchers/range_matcher_spec.rb +0 -75
- data/spec/suites/rspec_2/unit/times_called_matchers/times_called_matcher_spec.rb +0 -117
- data/spec/suites/rspec_2/unit/wildcard_matchers/anything_spec.rb +0 -33
- data/spec/suites/rspec_2/unit/wildcard_matchers/boolean_spec.rb +0 -45
- data/spec/suites/rspec_2/unit/wildcard_matchers/duck_type_spec.rb +0 -64
- data/spec/suites/rspec_2/unit/wildcard_matchers/hash_including_spec.rb +0 -64
- data/spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb +0 -55
- data/spec/suites/rspec_2/unit/wildcard_matchers/numeric_spec.rb +0 -46
- data/spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb +0 -57
- data/spec/suites/rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_3/spec_helper.rb +0 -3
- data/spec/suites/rspec_2_rails_4/integration/minitest_4_rails_4_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb +0 -156
- data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +0 -66
- data/spec/suites/rspec_2_rails_4/spec_helper.rb +0 -3
- data/spec/suites/test_unit_1/integration/test_unit_1_test.rb +0 -10
- data/spec/suites/test_unit_1/test_helper.rb +0 -10
- data/spec/suites/test_unit_2/integration/test_unit_2_test.rb +0 -10
- data/spec/suites/test_unit_2/test_helper.rb +0 -6
- data/spec/suites/test_unit_200/integration/test_unit_200_test.rb +0 -10
- data/spec/suites/test_unit_200/test_helper.rb +0 -6
- data/spec/suites/test_unit_200_rails_3/integration/test_unit_200_rails_3_test.rb +0 -10
- data/spec/suites/test_unit_200_rails_3/test_helper.rb +0 -7
- data/spec/suites/test_unit_200_rails_4/integration/test_unit_200_rails_4_test.rb +0 -10
- data/spec/suites/test_unit_200_rails_4/test_helper.rb +0 -7
- data/spec/suites/test_unit_2_rails_2/integration/test_unit_2_rails_2_test.rb +0 -10
- data/spec/suites/test_unit_2_rails_2/test_helper.rb +0 -7
- data/spec/suites/test_unit_2_rails_3/integration/test_unit_2_rails_3_test.rb +0 -10
- data/spec/suites/test_unit_2_rails_3/test_helper.rb +0 -7
- data/spec/suites/test_unit_2_rails_4/integration/test_unit_2_rails_4_test.rb +0 -10
- data/spec/suites/test_unit_2_rails_4/test_helper.rb +0 -7
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../../spec_helper")
|
2
|
-
|
3
|
-
module RR
|
4
|
-
module Injections
|
5
|
-
describe DoubleInjection, "#verify" do
|
6
|
-
subject { Object.new }
|
7
|
-
|
8
|
-
include_examples "Swapped Space"
|
9
|
-
|
10
|
-
attr_reader :method_name, :double_injection
|
11
|
-
|
12
|
-
before do
|
13
|
-
@method_name = :foobar
|
14
|
-
subject.methods.should_not include(method_name.to_s)
|
15
|
-
@double_injection = ::RR::Injections::DoubleInjection.find_or_create_by_subject(subject, method_name)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "verifies each double was met" do
|
19
|
-
double = RR::Double.new(
|
20
|
-
double_injection,
|
21
|
-
RR::DoubleDefinitions::DoubleDefinition.new(RR::DoubleDefinitions::DoubleDefinitionCreate.new)
|
22
|
-
)
|
23
|
-
double_injection.register_double double
|
24
|
-
|
25
|
-
double.definition.with(1).once.returns {nil}
|
26
|
-
expect { double_injection.verify }.to raise_error(RR::Errors::TimesCalledError)
|
27
|
-
subject.foobar(1)
|
28
|
-
expect { double_injection.verify }.to_not raise_error
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,297 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../../spec_helper")
|
2
|
-
|
3
|
-
module RR
|
4
|
-
module Integrations
|
5
|
-
module RSpec
|
6
|
-
describe InvocationMatcher do
|
7
|
-
describe "matching against a method with no doubles" do
|
8
|
-
before do
|
9
|
-
@matcher = InvocationMatcher.new(:foobar)
|
10
|
-
@result = @matcher.matches?(Object.new)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "does not match" do
|
14
|
-
@result.should_not be
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "defining an expectation using a method invocation" do
|
19
|
-
subject { Object.new }
|
20
|
-
|
21
|
-
before do
|
22
|
-
stub(subject).foobar
|
23
|
-
subject.foobar(:args)
|
24
|
-
@result = InvocationMatcher.new.foobar(:args).matches?(subject)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "uses the invoked method as the expected method" do
|
28
|
-
expect(@result).to be
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "matching against a stubbed method that was never called" do
|
33
|
-
subject { Object.new }
|
34
|
-
|
35
|
-
before do
|
36
|
-
stub(subject).foobar
|
37
|
-
@matcher = InvocationMatcher.new(:foobar)
|
38
|
-
@result = @matcher.matches?(subject)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "does not match" do
|
42
|
-
@result.should_not be
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "matching against a stubbed method that was called once" do
|
47
|
-
subject { Object.new }
|
48
|
-
|
49
|
-
before do
|
50
|
-
stub(subject).foobar
|
51
|
-
subject.foobar
|
52
|
-
@result = InvocationMatcher.new(:foobar).matches?(subject)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "does match" do
|
56
|
-
expect(@result).to be
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "matching against a stubbed method that was called with unexpected arguments" do
|
61
|
-
subject { Object.new }
|
62
|
-
|
63
|
-
before do
|
64
|
-
@args = %w(one two)
|
65
|
-
stub(subject).foobar
|
66
|
-
subject.foobar(:other)
|
67
|
-
@result = InvocationMatcher.new(:foobar).with(*@args).matches?(subject)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "does not match" do
|
71
|
-
@result.should_not be
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe "matching against a stubbed method that was called with expected arguments" do
|
76
|
-
subject { Object.new }
|
77
|
-
|
78
|
-
before do
|
79
|
-
@args = %w(one two)
|
80
|
-
stub(subject).foobar
|
81
|
-
subject.foobar(*@args)
|
82
|
-
@result = InvocationMatcher.new(:foobar).with(*@args).matches?(subject)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "does match" do
|
86
|
-
expect(@result).to be
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "defining a fulfilled argument expectation using a method invocation" do
|
91
|
-
subject { Object.new }
|
92
|
-
|
93
|
-
before do
|
94
|
-
@args = %w(one two)
|
95
|
-
stub(subject).foobar
|
96
|
-
subject.foobar(*@args)
|
97
|
-
@result = InvocationMatcher.new.foobar(*@args).matches?(subject)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "does match" do
|
101
|
-
expect(@result).to be
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "defining an unfulfilled argument expectation using a method invocation" do
|
106
|
-
subject { Object.new }
|
107
|
-
|
108
|
-
before do
|
109
|
-
@args = %w(one two)
|
110
|
-
stub(subject).foobar
|
111
|
-
subject.foobar(:other)
|
112
|
-
@result = InvocationMatcher.new.foobar(*@args).matches?(subject)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "does not match" do
|
116
|
-
@result.should_not be
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe "matching against a stubbed method that was called more than once" do
|
121
|
-
subject { Object.new }
|
122
|
-
|
123
|
-
before do
|
124
|
-
stub(subject).foobar
|
125
|
-
2.times { subject.foobar }
|
126
|
-
@result = InvocationMatcher.new(:foobar).twice.matches?(subject)
|
127
|
-
end
|
128
|
-
|
129
|
-
it "does match" do
|
130
|
-
expect(@result).to be
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe "matching a stubbed method with any arguments" do
|
135
|
-
subject { Object.new }
|
136
|
-
|
137
|
-
before do
|
138
|
-
stub(subject).foobar
|
139
|
-
subject.foobar(:args)
|
140
|
-
@result = InvocationMatcher.new(:foobar).with_any_args.matches?(subject)
|
141
|
-
end
|
142
|
-
|
143
|
-
it "does match" do
|
144
|
-
expect(@result).to be
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
describe "matching a stubbed method with no arguments when arguments are not provided" do
|
149
|
-
subject { Object.new }
|
150
|
-
|
151
|
-
before do
|
152
|
-
stub(subject).foobar
|
153
|
-
subject.foobar
|
154
|
-
@result = InvocationMatcher.new(:foobar).with_no_args.matches?(subject)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "does match" do
|
158
|
-
expect(@result).to be
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
describe "matching a stubbed method with no arguments when arguments are provided" do
|
163
|
-
subject { Object.new }
|
164
|
-
|
165
|
-
before do
|
166
|
-
stub(subject).foobar
|
167
|
-
subject.foobar(:args)
|
168
|
-
@result = InvocationMatcher.new(:foobar).with_no_args.matches?(subject)
|
169
|
-
end
|
170
|
-
|
171
|
-
it "does not match" do
|
172
|
-
@result.should_not be
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe "matching a method that was called twice when expected once" do
|
177
|
-
subject { Object.new }
|
178
|
-
|
179
|
-
before do
|
180
|
-
stub(subject).foobar
|
181
|
-
2.times { subject.foobar }
|
182
|
-
@matcher = InvocationMatcher.new(:foobar).times(1)
|
183
|
-
@result = @matcher.matches?(subject)
|
184
|
-
end
|
185
|
-
|
186
|
-
it "does not match" do
|
187
|
-
@result.should_not be
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe "matching a method that was called twice when expected twice" do
|
192
|
-
subject { Object.new }
|
193
|
-
|
194
|
-
before do
|
195
|
-
stub(subject).foobar
|
196
|
-
2.times { subject.foobar }
|
197
|
-
@result = InvocationMatcher.new(:foobar).times(2).matches?(subject)
|
198
|
-
end
|
199
|
-
|
200
|
-
it "does match" do
|
201
|
-
expect(@result).to be
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
describe "matching a method that was called twice when any number of times" do
|
206
|
-
subject { Object.new }
|
207
|
-
|
208
|
-
before do
|
209
|
-
stub(subject).foobar
|
210
|
-
2.times { subject.foobar }
|
211
|
-
@result = InvocationMatcher.new(:foobar).any_number_of_times.matches?(subject)
|
212
|
-
end
|
213
|
-
|
214
|
-
it "does match" do
|
215
|
-
expect(@result).to be
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
describe "matching a method that was called three times when expected at most twice" do
|
220
|
-
subject { Object.new }
|
221
|
-
|
222
|
-
before do
|
223
|
-
stub(subject).foobar
|
224
|
-
3.times { subject.foobar }
|
225
|
-
@result = InvocationMatcher.new(:foobar).at_most(2).matches?(subject)
|
226
|
-
end
|
227
|
-
|
228
|
-
it "does not match" do
|
229
|
-
@result.should_not be
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
describe "matching a method that was called once when expected at most twice" do
|
234
|
-
subject { Object.new }
|
235
|
-
|
236
|
-
before do
|
237
|
-
stub(subject).foobar
|
238
|
-
subject.foobar
|
239
|
-
@result = InvocationMatcher.new(:foobar).at_most(2).matches?(subject)
|
240
|
-
end
|
241
|
-
|
242
|
-
it "does match" do
|
243
|
-
expect(@result).to be
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
describe "matching a method that was called once when expected at least twice" do
|
248
|
-
subject { Object.new }
|
249
|
-
|
250
|
-
before do
|
251
|
-
stub(subject).foobar
|
252
|
-
subject.foobar
|
253
|
-
@result = InvocationMatcher.new(:foobar).at_least(2).matches?(subject)
|
254
|
-
end
|
255
|
-
|
256
|
-
it "does not match" do
|
257
|
-
@result.should_not be
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
describe "matching a method that was called three times when expected at least twice" do
|
262
|
-
subject { Object.new }
|
263
|
-
|
264
|
-
before do
|
265
|
-
stub(subject).foobar
|
266
|
-
3.times { subject.foobar }
|
267
|
-
@result = InvocationMatcher.new(:foobar).at_least(2).matches?(subject)
|
268
|
-
end
|
269
|
-
|
270
|
-
it "does match" do
|
271
|
-
expect(@result).to be
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
describe "that does not match" do
|
276
|
-
before do
|
277
|
-
@error = Object.new
|
278
|
-
@message = 'Verification error message'
|
279
|
-
stub(RR::Space.instance.recorded_calls).match_error { @error }
|
280
|
-
stub(@error).message { @message }
|
281
|
-
|
282
|
-
@matcher = InvocationMatcher.new(:foobar)
|
283
|
-
@result = @matcher.matches?(Object.new)
|
284
|
-
end
|
285
|
-
|
286
|
-
it "returns false when matching" do
|
287
|
-
@result.should_not be
|
288
|
-
end
|
289
|
-
|
290
|
-
it "returns a failure messsage" do
|
291
|
-
expect(@matcher.failure_message).to eq @message
|
292
|
-
end
|
293
|
-
end
|
294
|
-
end
|
295
|
-
end
|
296
|
-
end
|
297
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
|
2
|
-
|
3
|
-
module RR
|
4
|
-
module Integrations
|
5
|
-
describe RSpec1 do
|
6
|
-
attr_reader :fixture, :method_name
|
7
|
-
|
8
|
-
describe "#setup_mocks_for_rspec" do
|
9
|
-
subject { Object.new }
|
10
|
-
|
11
|
-
before do
|
12
|
-
@fixture = Object.new
|
13
|
-
fixture.extend RSpec1::Mixin
|
14
|
-
@method_name = :foobar
|
15
|
-
end
|
16
|
-
|
17
|
-
it "resets the double_injections" do
|
18
|
-
stub(subject).foobar
|
19
|
-
::RR::Injections::DoubleInjection.instances.should_not be_empty
|
20
|
-
|
21
|
-
fixture.setup_mocks_for_rspec
|
22
|
-
expect(::RR::Injections::DoubleInjection.instances).to be_empty
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#verify_mocks_for_rspec" do
|
27
|
-
subject { Object.new }
|
28
|
-
|
29
|
-
before do
|
30
|
-
@fixture = Object.new
|
31
|
-
fixture.extend RSpec1::Mixin
|
32
|
-
@method_name = :foobar
|
33
|
-
end
|
34
|
-
|
35
|
-
it "verifies the double_injections" do
|
36
|
-
mock(subject).foobar
|
37
|
-
|
38
|
-
expect {
|
39
|
-
fixture.verify_mocks_for_rspec
|
40
|
-
}.to raise_error(::RR::Errors::TimesCalledError)
|
41
|
-
expect(::RR::Injections::DoubleInjection.instances).to be_empty
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "#teardown_mocks_for_rspec" do
|
46
|
-
subject { Object.new }
|
47
|
-
|
48
|
-
before do
|
49
|
-
@fixture = Object.new
|
50
|
-
fixture.extend RSpec1::Mixin
|
51
|
-
@method_name = :foobar
|
52
|
-
end
|
53
|
-
|
54
|
-
it "resets the double_injections" do
|
55
|
-
stub(subject).foobar
|
56
|
-
::RR::Injections::DoubleInjection.instances.should_not be_empty
|
57
|
-
|
58
|
-
fixture.teardown_mocks_for_rspec
|
59
|
-
expect(::RR::Injections::DoubleInjection.instances).to be_empty
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "#trim_backtrace" do
|
64
|
-
it "does not set trim_backtrace" do
|
65
|
-
expect(RR.trim_backtrace).to eq false
|
66
|
-
end
|
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
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
|
2
|
-
|
3
|
-
module RR
|
4
|
-
describe ProcFromBlock do
|
5
|
-
describe "#==" do
|
6
|
-
it "acts the same as #== on a Proc" do
|
7
|
-
original_proc = lambda {}
|
8
|
-
expect(Proc.new(&original_proc)).to eq original_proc
|
9
|
-
|
10
|
-
expect(ProcFromBlock.new(&original_proc)).to eq original_proc
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
|
2
|
-
|
3
|
-
describe "RR" do
|
4
|
-
before do
|
5
|
-
Object.class_eval do
|
6
|
-
def verify
|
7
|
-
raise "Dont call me"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
Object.class_eval do
|
14
|
-
remove_method :verify
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
it "has proxy methods for each method defined directly on Space" do
|
19
|
-
space_instance_methods = RR::Space.instance_methods(false)
|
20
|
-
space_instance_methods.should_not be_empty
|
21
|
-
|
22
|
-
rr_instance_methods = RR.methods(false)
|
23
|
-
space_instance_methods.each do |space_instance_method|
|
24
|
-
expect(rr_instance_methods).to include(space_instance_method)
|
25
|
-
end
|
26
|
-
RR.verify
|
27
|
-
end
|
28
|
-
end
|