bogus 0.0.2 → 0.0.3.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile.lock +14 -2
  3. data/Guardfile +5 -0
  4. data/README.md +7 -249
  5. data/bogus.gemspec +3 -1
  6. data/features/.nav +21 -0
  7. data/features/authors.md +42 -0
  8. data/{CHANGELOG.md → features/changelog.md} +9 -2
  9. data/features/configuration_options.feature +1 -2
  10. data/features/{contract_tests_mocks.feature → contract_tests/contract_tests_mocks.feature} +4 -1
  11. data/features/{contract_tests_spies.feature → contract_tests/contract_tests_spies.feature} +2 -0
  12. data/features/{contract_tests_stubs.feature → contract_tests/contract_tests_stubs.feature} +14 -0
  13. data/features/contract_tests/readme.md +26 -0
  14. data/features/{return_value_contracts.feature → contract_tests/return_value_contracts.feature} +6 -2
  15. data/features/{anonymous_doubles.feature → fakes/anonymous_doubles.feature} +24 -8
  16. data/features/{fake_objects.feature → fakes/fake_objects.feature} +39 -4
  17. data/features/fakes/global_fake_configuration.feature +88 -0
  18. data/features/fakes/readme.md +11 -0
  19. data/features/fakes/replacing_classes.feature +148 -0
  20. data/features/getting_started.md +36 -0
  21. data/features/license.md +9 -0
  22. data/features/readme.md +173 -0
  23. data/features/safe_stubbing/argument_matchers.feature +30 -0
  24. data/features/safe_stubbing/readme.md +35 -0
  25. data/features/{safe_mocking.feature → safe_stubbing/safe_mocking.feature} +14 -0
  26. data/features/{safe_stubbing.feature → safe_stubbing/safe_stubbing.feature} +18 -4
  27. data/features/{spies.feature → safe_stubbing/spies.feature} +19 -4
  28. data/features/step_definitions/rspec_steps.rb +14 -5
  29. data/features/support/env.rb +4 -0
  30. data/lib/bogus.rb +2 -0
  31. data/lib/bogus/adds_recording.rb +11 -7
  32. data/lib/bogus/any_args.rb +7 -0
  33. data/lib/bogus/anything.rb +11 -0
  34. data/lib/bogus/contract_not_fulfilled.rb +17 -10
  35. data/lib/bogus/copies_classes.rb +2 -6
  36. data/lib/bogus/creates_fakes_with_stubbed_methods.rb +40 -0
  37. data/lib/bogus/double.rb +28 -8
  38. data/lib/bogus/ensures_all_interactions_satisfied.rb +36 -0
  39. data/lib/bogus/fake.rb +6 -0
  40. data/lib/bogus/fake_configuration.rb +69 -0
  41. data/lib/bogus/fakes_classes.rb +21 -0
  42. data/lib/bogus/has_overwritten_methods.rb +24 -0
  43. data/lib/bogus/have_received_matcher.rb +63 -0
  44. data/lib/bogus/injector.rb +36 -14
  45. data/lib/bogus/interaction.rb +33 -17
  46. data/lib/bogus/makes_substitute_methods.rb +15 -0
  47. data/lib/bogus/mocking_dsl.rb +31 -0
  48. data/lib/bogus/multi_stubber.rb +15 -0
  49. data/lib/bogus/not_all_expectations_satisfied.rb +27 -0
  50. data/lib/bogus/overwriten_classes.rb +15 -0
  51. data/lib/bogus/overwrites_classes.rb +2 -2
  52. data/lib/bogus/overwrites_methods.rb +42 -0
  53. data/lib/bogus/proxies_method_calls.rb +23 -0
  54. data/lib/bogus/proxy_class.rb +25 -16
  55. data/lib/bogus/public_methods.rb +36 -11
  56. data/lib/bogus/record_interactions.rb +3 -9
  57. data/lib/bogus/recording_proxy.rb +5 -0
  58. data/lib/bogus/registers_created_fakes.rb +2 -1
  59. data/lib/bogus/resets_overwritten_classes.rb +14 -0
  60. data/lib/bogus/resets_stubbed_methods.rb +12 -0
  61. data/lib/bogus/responds_to_everything.rb +11 -0
  62. data/lib/bogus/rspec.rb +7 -0
  63. data/lib/bogus/rspec_adapter.rb +17 -0
  64. data/lib/bogus/rspec_extensions.rb +8 -20
  65. data/lib/bogus/shadow.rb +60 -0
  66. data/lib/bogus/verifies_contracts.rb +5 -1
  67. data/lib/bogus/verifies_stub_definition.rb +5 -0
  68. data/lib/bogus/version.rb +1 -1
  69. data/lib/tracks_existence_of_test_doubles.rb +11 -0
  70. data/spec/bogus/adds_recording_spec.rb +46 -10
  71. data/spec/bogus/anything_spec.rb +13 -0
  72. data/spec/bogus/copies_classes_spec.rb +4 -3
  73. data/spec/bogus/creates_fakes_with_stubbed_methods_spec.rb +121 -0
  74. data/spec/bogus/double_spec.rb +63 -20
  75. data/spec/bogus/ensures_all_interactions_satisfied_spec.rb +43 -0
  76. data/spec/bogus/fake_configuration_spec.rb +99 -0
  77. data/spec/bogus/fakes_classes_spec.rb +46 -0
  78. data/spec/bogus/have_received_matcher_spec.rb +56 -0
  79. data/spec/bogus/interaction_spec.rb +18 -7
  80. data/spec/bogus/interactions_repository_spec.rb +42 -0
  81. data/spec/bogus/makes_substitute_methods_spec.rb +24 -0
  82. data/spec/bogus/mocking_dsl_spec.rb +234 -7
  83. data/spec/bogus/multi_stubber_spec.rb +31 -0
  84. data/spec/bogus/overwriten_classes_spec.rb +27 -0
  85. data/spec/bogus/overwrites_classes_spec.rb +2 -2
  86. data/spec/bogus/overwrites_methods_spec.rb +107 -0
  87. data/spec/bogus/proxy_class_spec.rb +6 -0
  88. data/spec/bogus/record_interactions_spec.rb +3 -4
  89. data/spec/bogus/registers_created_fakes_spec.rb +8 -0
  90. data/spec/bogus/resets_overwritten_classes_spec.rb +26 -0
  91. data/spec/bogus/resets_stubbed_methods_spec.rb +16 -0
  92. data/spec/bogus/shadow_spec.rb +182 -0
  93. data/spec/bogus/verifies_contracts_spec.rb +9 -3
  94. data/spec/bogus/verifies_stub_definition_spec.rb +4 -0
  95. data/spec/spec_helper.rb +3 -0
  96. data/spec/support/fake_creator_of_fakes.rb +15 -0
  97. data/spec/support/sample_fake.rb +13 -0
  98. data/spec/tracks_existence_of_test_doubles_spec.rb +26 -0
  99. metadata +105 -32
  100. data/lib/bogus/creates_anonymous_stubs.rb +0 -27
  101. data/lib/bogus/invocation_matcher.rb +0 -27
  102. data/lib/bogus/rr_proxy.rb +0 -5
  103. data/spec/bogus/invocation_matcher_spec.rb +0 -26
@@ -10,14 +10,18 @@ describe Bogus::VerifiesContracts do
10
10
  it "fails unmatched calls" do
11
11
  first_interaction = interaction("first")
12
12
  second_interaction = interaction("second")
13
+ other_interaction = interaction("other")
13
14
 
14
15
  stub(doubled_interactions).for_fake(:fake_name){[first_interaction, matched_interaction, second_interaction]}
16
+ stub(real_interactions).for_fake(:fake_name){[matched_interaction, other_interaction]}
15
17
 
16
18
  stub(real_interactions).recorded?(:fake_name, first_interaction) { false }
17
19
  stub(real_interactions).recorded?(:fake_name, second_interaction) { false }
18
20
  stub(real_interactions).recorded?(:fake_name, matched_interaction) { true }
19
21
 
20
- expect_verify_to_raise_error_with_interactions(:fake_name, [first_interaction, second_interaction])
22
+ expect_verify_to_raise_error_with_interactions(:fake_name,
23
+ [first_interaction, second_interaction],
24
+ [matched_interaction, other_interaction])
21
25
  end
22
26
 
23
27
  it "passes with all calls matched" do
@@ -29,11 +33,13 @@ describe Bogus::VerifiesContracts do
29
33
  }.not_to raise_error
30
34
  end
31
35
 
32
- def expect_verify_to_raise_error_with_interactions(name, interactions)
36
+ def expect_verify_to_raise_error_with_interactions(name, missed, real)
33
37
  verifies_contracts.verify(name)
34
38
  fail
35
39
  rescue Bogus::ContractNotFulfilled => contract_error
36
- contract_error.interactions.should == { name => interactions }
40
+ contract_error.fake_name.should == name
41
+ contract_error.missed_interactions.should == missed
42
+ contract_error.actual_interactions.should == real
37
43
  end
38
44
 
39
45
  def interaction(method)
@@ -51,6 +51,10 @@ describe Bogus::VerifiesStubDefinition do
51
51
  it_disallows(:bar, [1], NameError)
52
52
  end
53
53
 
54
+ it "allows interactions that use any_args" do
55
+ it_allows(:three_args, [Bogus::AnyArgs])
56
+ end
57
+
54
58
  describe "method arity checks" do
55
59
  context "method with positive arity" do
56
60
  it_allows_argument_numbers :three_args, 3
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,9 @@ require 'dependor/rspec'
3
3
 
4
4
  require 'rr'
5
5
 
6
+ require_relative 'support/sample_fake'
7
+ require_relative 'support/fake_creator_of_fakes'
8
+
6
9
  RSpec.configure do |config|
7
10
  config.color_enabled = true
8
11
  config.mock_framework = :rr
@@ -0,0 +1,15 @@
1
+ class FakeCreatorOfFakes
2
+ def create(name, opts = {}, &block)
3
+ fake = [name, opts, block && block.call]
4
+ fakes << fake
5
+ fake
6
+ end
7
+
8
+ def fakes
9
+ @fakes ||= []
10
+ end
11
+
12
+ def has_created?(name, opts = {}, klass = nil)
13
+ fakes.include?([name, opts, klass])
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module Samples
2
+ class Foo
3
+ def foo(a, b)
4
+ "the real foo: #{a} #{b}"
5
+ end
6
+
7
+ def bar
8
+ "the real bar"
9
+ end
10
+ end
11
+
12
+ FooFake = Bogus::Injector.new.copies_classes.copy(Foo)
13
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Bogus::TracksExistenceOfTestDoubles do
4
+ let(:tracker) { Bogus::TracksExistenceOfTestDoubles.new }
5
+
6
+ it "returns an empty double list with nothing tracked" do
7
+ tracker.doubles.should == []
8
+ end
9
+
10
+ it "lists the added test doubles in order without duplicates" do
11
+ foo = "foo"
12
+ bar = 1
13
+ baz = Object.new
14
+
15
+ tracker.track foo
16
+ tracker.track bar
17
+ tracker.track foo
18
+ tracker.track baz
19
+ tracker.track baz
20
+ tracker.track bar
21
+ tracker.track foo
22
+
23
+
24
+ tracker.doubles.should == [foo, bar, baz]
25
+ end
26
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3.rc.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam Pohorecki
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-01 00:00:00.000000000 Z
12
+ date: 2013-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dependor
@@ -28,14 +28,14 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: 0.0.4
30
30
  - !ruby/object:Gem::Dependency
31
- name: rr
31
+ name: rake
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
- type: :runtime
38
+ type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
@@ -44,7 +44,7 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: rake
47
+ name: rspec
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
@@ -60,7 +60,7 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: rspec
63
+ name: cucumber
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
@@ -76,7 +76,7 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: cucumber
79
+ name: aruba
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
@@ -92,7 +92,7 @@ dependencies:
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  - !ruby/object:Gem::Dependency
95
- name: aruba
95
+ name: guard
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
@@ -108,7 +108,7 @@ dependencies:
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  - !ruby/object:Gem::Dependency
111
- name: guard
111
+ name: guard-rspec
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -124,7 +124,7 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
- name: guard-rspec
127
+ name: guard-cucumber
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
@@ -140,7 +140,7 @@ dependencies:
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  - !ruby/object:Gem::Dependency
143
- name: guard-cucumber
143
+ name: guard-ctags-bundler
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
@@ -187,6 +187,38 @@ dependencies:
187
187
  - - ! '>='
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: rr
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ - !ruby/object:Gem::Dependency
207
+ name: relish
208
+ requirement: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ type: :development
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
190
222
  description: Decreases the need to write integration tests by ensuring that the things
191
223
  you stub or mock actually exist.
192
224
  email:
@@ -198,77 +230,121 @@ files:
198
230
  - .gitignore
199
231
  - .pelusa.yml
200
232
  - .travis.yml
201
- - CHANGELOG.md
202
233
  - Gemfile
203
234
  - Gemfile.lock
204
235
  - Guardfile
205
236
  - README.md
206
237
  - Rakefile
207
238
  - bogus.gemspec
208
- - features/anonymous_doubles.feature
239
+ - features/.nav
240
+ - features/authors.md
241
+ - features/changelog.md
209
242
  - features/configuration_options.feature
210
- - features/contract_tests_mocks.feature
211
- - features/contract_tests_spies.feature
212
- - features/contract_tests_stubs.feature
213
- - features/fake_objects.feature
214
- - features/return_value_contracts.feature
215
- - features/safe_mocking.feature
216
- - features/safe_stubbing.feature
217
- - features/spies.feature
243
+ - features/contract_tests/contract_tests_mocks.feature
244
+ - features/contract_tests/contract_tests_spies.feature
245
+ - features/contract_tests/contract_tests_stubs.feature
246
+ - features/contract_tests/readme.md
247
+ - features/contract_tests/return_value_contracts.feature
248
+ - features/fakes/anonymous_doubles.feature
249
+ - features/fakes/fake_objects.feature
250
+ - features/fakes/global_fake_configuration.feature
251
+ - features/fakes/readme.md
252
+ - features/fakes/replacing_classes.feature
253
+ - features/getting_started.md
254
+ - features/license.md
255
+ - features/readme.md
256
+ - features/safe_stubbing/argument_matchers.feature
257
+ - features/safe_stubbing/readme.md
258
+ - features/safe_stubbing/safe_mocking.feature
259
+ - features/safe_stubbing/safe_stubbing.feature
260
+ - features/safe_stubbing/spies.feature
218
261
  - features/step_definitions/rspec_steps.rb
219
262
  - features/support/env.rb
220
263
  - lib/bogus.rb
221
264
  - lib/bogus/adds_recording.rb
265
+ - lib/bogus/any_args.rb
266
+ - lib/bogus/anything.rb
222
267
  - lib/bogus/configuration.rb
223
268
  - lib/bogus/contract_not_fulfilled.rb
224
269
  - lib/bogus/converts_name_to_class.rb
225
270
  - lib/bogus/copies_classes.rb
226
- - lib/bogus/creates_anonymous_stubs.rb
227
271
  - lib/bogus/creates_fakes.rb
272
+ - lib/bogus/creates_fakes_with_stubbed_methods.rb
228
273
  - lib/bogus/double.rb
274
+ - lib/bogus/ensures_all_interactions_satisfied.rb
229
275
  - lib/bogus/fake.rb
276
+ - lib/bogus/fake_configuration.rb
230
277
  - lib/bogus/fake_registry.rb
278
+ - lib/bogus/fakes_classes.rb
279
+ - lib/bogus/has_overwritten_methods.rb
280
+ - lib/bogus/have_received_matcher.rb
231
281
  - lib/bogus/injector.rb
232
282
  - lib/bogus/interaction.rb
233
283
  - lib/bogus/interaction_presenter.rb
234
284
  - lib/bogus/interactions_repository.rb
235
- - lib/bogus/invocation_matcher.rb
285
+ - lib/bogus/makes_substitute_methods.rb
236
286
  - lib/bogus/method_stringifier.rb
287
+ - lib/bogus/mocking_dsl.rb
288
+ - lib/bogus/multi_stubber.rb
289
+ - lib/bogus/not_all_expectations_satisfied.rb
290
+ - lib/bogus/overwriten_classes.rb
237
291
  - lib/bogus/overwrites_classes.rb
292
+ - lib/bogus/overwrites_methods.rb
293
+ - lib/bogus/proxies_method_calls.rb
238
294
  - lib/bogus/proxy_class.rb
239
295
  - lib/bogus/public_methods.rb
240
296
  - lib/bogus/record_interactions.rb
241
297
  - lib/bogus/recording_proxy.rb
242
298
  - lib/bogus/records_double_interactions.rb
243
299
  - lib/bogus/registers_created_fakes.rb
244
- - lib/bogus/rr_proxy.rb
300
+ - lib/bogus/resets_overwritten_classes.rb
301
+ - lib/bogus/resets_stubbed_methods.rb
302
+ - lib/bogus/responds_to_everything.rb
245
303
  - lib/bogus/rspec.rb
304
+ - lib/bogus/rspec_adapter.rb
246
305
  - lib/bogus/rspec_extensions.rb
306
+ - lib/bogus/shadow.rb
247
307
  - lib/bogus/takes.rb
248
308
  - lib/bogus/verifies_contracts.rb
249
309
  - lib/bogus/verifies_stub_definition.rb
250
310
  - lib/bogus/version.rb
311
+ - lib/tracks_existence_of_test_doubles.rb
251
312
  - pelusa.sh
252
313
  - rbs.sh
253
314
  - spec/bogus/adds_recording_spec.rb
315
+ - spec/bogus/anything_spec.rb
254
316
  - spec/bogus/configuration_spec.rb
255
317
  - spec/bogus/converts_name_to_class_spec.rb
256
318
  - spec/bogus/copies_classes_spec.rb
257
319
  - spec/bogus/creates_fakes_spec.rb
320
+ - spec/bogus/creates_fakes_with_stubbed_methods_spec.rb
258
321
  - spec/bogus/double_spec.rb
322
+ - spec/bogus/ensures_all_interactions_satisfied_spec.rb
323
+ - spec/bogus/fake_configuration_spec.rb
259
324
  - spec/bogus/fake_registry_spec.rb
325
+ - spec/bogus/fakes_classes_spec.rb
326
+ - spec/bogus/have_received_matcher_spec.rb
260
327
  - spec/bogus/interaction_spec.rb
261
328
  - spec/bogus/interactions_repository_spec.rb
262
- - spec/bogus/invocation_matcher_spec.rb
329
+ - spec/bogus/makes_substitute_methods_spec.rb
263
330
  - spec/bogus/mocking_dsl_spec.rb
331
+ - spec/bogus/multi_stubber_spec.rb
332
+ - spec/bogus/overwriten_classes_spec.rb
264
333
  - spec/bogus/overwrites_classes_spec.rb
334
+ - spec/bogus/overwrites_methods_spec.rb
265
335
  - spec/bogus/proxy_class_spec.rb
266
336
  - spec/bogus/record_interactions_spec.rb
267
337
  - spec/bogus/records_double_interactions_spec.rb
268
338
  - spec/bogus/registers_created_fakes_spec.rb
339
+ - spec/bogus/resets_overwritten_classes_spec.rb
340
+ - spec/bogus/resets_stubbed_methods_spec.rb
341
+ - spec/bogus/shadow_spec.rb
269
342
  - spec/bogus/verifies_contracts_spec.rb
270
343
  - spec/bogus/verifies_stub_definition_spec.rb
271
344
  - spec/spec_helper.rb
345
+ - spec/support/fake_creator_of_fakes.rb
346
+ - spec/support/sample_fake.rb
347
+ - spec/tracks_existence_of_test_doubles_spec.rb
272
348
  homepage: https://github.com/psyho/bogus
273
349
  licenses: []
274
350
  post_install_message:
@@ -283,16 +359,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
283
359
  version: '0'
284
360
  segments:
285
361
  - 0
286
- hash: -343777807
362
+ hash: 1397815823919576770
287
363
  required_rubygems_version: !ruby/object:Gem::Requirement
288
364
  none: false
289
365
  requirements:
290
- - - ! '>='
366
+ - - ! '>'
291
367
  - !ruby/object:Gem::Version
292
- version: '0'
293
- segments:
294
- - 0
295
- hash: -343777807
368
+ version: 1.3.1
296
369
  requirements: []
297
370
  rubyforge_project: bogus
298
371
  rubygems_version: 1.8.24
@@ -1,27 +0,0 @@
1
- module Bogus
2
- class CreatesAnonymousStubs
3
- extend Bogus::Takes
4
-
5
- takes :creates_fakes, :create_stub
6
-
7
- def create(methods = {})
8
- object = RespondsToEverything.new
9
- methods.each do |name, result|
10
- create_stub.call(object).__send__(name) { result }
11
- end
12
- object
13
- end
14
-
15
- class RespondsToEverything
16
- include RecordInteractions
17
-
18
- def respond_to?(method)
19
- true
20
- end
21
-
22
- def method_missing(name, *args, &block)
23
- __record__(name, *args, &block)
24
- end
25
- end
26
- end
27
- end
@@ -1,27 +0,0 @@
1
- require 'rr'
2
-
3
- module Bogus
4
- class InvocationMatcher < RR::Adapters::Rspec::InvocationMatcher
5
- def initialize(method, verifies_stub_definition, records_double_interactions)
6
- super(method)
7
- @verifies_stub_definition = verifies_stub_definition
8
- @records_double_interactions = records_double_interactions
9
- @stubbed_method_calls = []
10
- end
11
-
12
- def matches?(subject)
13
- @stubbed_method_calls.each do |name, args|
14
- @verifies_stub_definition.verify!(subject, name, args)
15
- @records_double_interactions.record(subject, name, args)
16
- end
17
-
18
- return super(subject.__inner_object__) if subject.respond_to?(:__inner_object__)
19
- return super(subject)
20
- end
21
-
22
- def method_missing(name, *args, &block)
23
- @stubbed_method_calls << [name, args]
24
- super
25
- end
26
- end
27
- end