bogus 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +19 -1
- data/Guardfile +0 -7
- data/Guardfile.cucumber +9 -0
- data/README.md +42 -6
- data/bogus.gemspec +3 -0
- data/features/.nav +5 -2
- data/features/authors.md +10 -2
- data/features/changelog.md +11 -0
- data/features/configuration/fake_ar_attributes.feature +51 -0
- data/features/configuration/readme.md +7 -0
- data/features/{configuration_options.feature → configuration/search_modules.feature} +2 -2
- data/features/fakes/anonymous_doubles.feature +11 -7
- data/features/fakes/fake_objects.feature +0 -16
- data/lib/bogus/active_record_accessors.rb +41 -0
- data/lib/bogus/class_methods.rb +1 -1
- data/lib/bogus/configuration.rb +1 -0
- data/lib/bogus/constructor_methods.rb +18 -0
- data/lib/bogus/copies_methods.rb +7 -5
- data/lib/bogus/creates_fakes.rb +1 -1
- data/lib/bogus/creates_fakes_with_stubbed_methods.rb +1 -1
- data/lib/bogus/ensures_all_interactions_satisfied.rb +0 -2
- data/lib/bogus/fake.rb +8 -0
- data/lib/bogus/injector.rb +10 -0
- data/lib/bogus/instance_methods.rb +1 -1
- data/lib/bogus/interaction.rb +22 -3
- data/lib/bogus/interaction_presenter.rb +1 -1
- data/lib/bogus/makes_ducks.rb +5 -6
- data/lib/bogus/makes_subtypes.rb +1 -1
- data/lib/bogus/method_stringifier.rb +16 -8
- data/lib/bogus/record_interactions.rb +1 -1
- data/lib/bogus/records_double_interactions.rb +8 -7
- data/lib/bogus/registers_created_fakes.rb +10 -8
- data/lib/bogus/responds_to_everything.rb +8 -1
- data/lib/bogus/shadow.rb +3 -2
- data/lib/bogus/undefined_return_value.rb +11 -0
- data/lib/bogus/verifies_contracts.rb +12 -10
- data/lib/bogus/verifies_stub_definition.rb +37 -41
- data/lib/bogus/version.rb +1 -1
- data/spec/bogus/copies_classes_spec.rb +13 -6
- data/spec/bogus/creates_fakes_spec.rb +1 -1
- data/spec/bogus/fake_ar_attributes_spec.rb +72 -0
- data/spec/bogus/faking_factories_spec.rb +83 -0
- data/spec/bogus/frozen_fakes_spec.rb +59 -0
- data/spec/bogus/interaction_spec.rb +4 -0
- data/spec/bogus/method_copiers_spec.rb +26 -0
- data/spec/bogus/mocking_dsl_spec.rb +7 -3
- data/spec/bogus/overwrites_methods_spec.rb +2 -2
- data/spec/bogus/record_interactions_spec.rb +1 -1
- data/spec/bogus/ruby_2_support_spec.rb +96 -0
- data/spec/bogus/shadow_spec.rb +10 -8
- data/spec/bogus/verifies_stub_definition_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/matchers.rb +3 -0
- metadata +76 -66
data/spec/bogus/shadow_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bogus::Shadow do
|
4
4
|
let(:object) { Samples::FooFake.new }
|
5
|
-
let(:shadow) { Bogus::Shadow.new
|
5
|
+
let(:shadow) { Bogus::Shadow.new }
|
6
6
|
|
7
7
|
shared_examples_for "spying on shadows" do
|
8
8
|
context "spying" do
|
@@ -22,8 +22,10 @@ describe Bogus::Shadow do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
context "unrecorded interactions" do
|
25
|
-
it "returns
|
26
|
-
shadow.run(:foo, "a", "b")
|
25
|
+
it "returns an unstubbed value" do
|
26
|
+
return_value = shadow.run(:foo, "a", "b")
|
27
|
+
|
28
|
+
return_value.should be_a_default_return_value
|
27
29
|
end
|
28
30
|
|
29
31
|
include_examples "spying on shadows"
|
@@ -50,8 +52,8 @@ describe Bogus::Shadow do
|
|
50
52
|
shadow.stubs(:foo, ["a", "b"])
|
51
53
|
end
|
52
54
|
|
53
|
-
it "returns the
|
54
|
-
shadow.run(:foo, ["a", "b"]).should
|
55
|
+
it "returns the default value" do
|
56
|
+
shadow.run(:foo, ["a", "b"]).should be_a_default_return_value
|
55
57
|
end
|
56
58
|
|
57
59
|
include_examples "spying on shadows"
|
@@ -123,8 +125,8 @@ describe Bogus::Shadow do
|
|
123
125
|
end
|
124
126
|
|
125
127
|
it "returns the default value for non-stubbed calls" do
|
126
|
-
shadow.run(:foo, "c", "d").should
|
127
|
-
shadow.run(:bar).should
|
128
|
+
shadow.run(:foo, "c", "d").should be_a_default_return_value
|
129
|
+
shadow.run(:bar).should be_a_default_return_value
|
128
130
|
end
|
129
131
|
|
130
132
|
it "does not contribute towards unsatisfied interactions" do
|
@@ -170,7 +172,7 @@ describe Bogus::Shadow do
|
|
170
172
|
end
|
171
173
|
|
172
174
|
it "returns the default value for non-stubbed calls" do
|
173
|
-
shadow.run(:foo, "a", "c").should
|
175
|
+
shadow.run(:foo, "a", "c").should be_a_default_return_value
|
174
176
|
end
|
175
177
|
|
176
178
|
it "contributes towards unsatisfied interactions" do
|
@@ -17,7 +17,7 @@ describe Bogus::VerifiesStubDefinition do
|
|
17
17
|
|
18
18
|
let(:object) { ExampleForVerify.new }
|
19
19
|
let(:verifies_stub_definition) { Bogus::VerifiesStubDefinition.new(method_stringifier) }
|
20
|
-
let(:method_stringifier) {
|
20
|
+
let(:method_stringifier) { isolate(Bogus::MethodStringifier) }
|
21
21
|
|
22
22
|
def verify(method_name, args)
|
23
23
|
verifies_stub_definition.verify!(object, method_name, args)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,238 +1,237 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bogus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Adam Pohorecki
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: dependor
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.0.4
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.0.4
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: cucumber
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: aruba
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: guard
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: guard-rspec
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: guard-cucumber
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: guard-ctags-bundler
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- -
|
129
|
+
- - '>='
|
148
130
|
- !ruby/object:Gem::Version
|
149
131
|
version: '0'
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- -
|
136
|
+
- - '>='
|
156
137
|
- !ruby/object:Gem::Version
|
157
138
|
version: '0'
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: growl
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
|
-
- -
|
143
|
+
- - '>='
|
164
144
|
- !ruby/object:Gem::Version
|
165
145
|
version: '0'
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- -
|
150
|
+
- - '>='
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: '0'
|
174
153
|
- !ruby/object:Gem::Dependency
|
175
154
|
name: libnotify
|
176
155
|
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
156
|
requirements:
|
179
|
-
- -
|
157
|
+
- - '>='
|
180
158
|
- !ruby/object:Gem::Version
|
181
159
|
version: '0'
|
182
160
|
type: :development
|
183
161
|
prerelease: false
|
184
162
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
163
|
requirements:
|
187
|
-
- -
|
164
|
+
- - '>='
|
188
165
|
- !ruby/object:Gem::Version
|
189
166
|
version: '0'
|
190
167
|
- !ruby/object:Gem::Dependency
|
191
168
|
name: rr
|
192
169
|
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
170
|
requirements:
|
195
|
-
- -
|
171
|
+
- - '>='
|
196
172
|
- !ruby/object:Gem::Version
|
197
173
|
version: '0'
|
198
174
|
type: :development
|
199
175
|
prerelease: false
|
200
176
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
177
|
requirements:
|
203
|
-
- -
|
178
|
+
- - '>='
|
204
179
|
- !ruby/object:Gem::Version
|
205
180
|
version: '0'
|
206
181
|
- !ruby/object:Gem::Dependency
|
207
182
|
name: relish
|
208
183
|
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
184
|
requirements:
|
211
|
-
- -
|
185
|
+
- - '>='
|
212
186
|
- !ruby/object:Gem::Version
|
213
187
|
version: '0'
|
214
188
|
type: :development
|
215
189
|
prerelease: false
|
216
190
|
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
191
|
requirements:
|
219
|
-
- -
|
192
|
+
- - '>='
|
220
193
|
- !ruby/object:Gem::Version
|
221
194
|
version: '0'
|
222
195
|
- !ruby/object:Gem::Dependency
|
223
196
|
name: coveralls
|
224
197
|
requirement: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
198
|
requirements:
|
227
|
-
- -
|
199
|
+
- - '>='
|
228
200
|
- !ruby/object:Gem::Version
|
229
201
|
version: '0'
|
230
202
|
type: :development
|
231
203
|
prerelease: false
|
232
204
|
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
none: false
|
234
205
|
requirements:
|
235
|
-
- -
|
206
|
+
- - '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: activerecord
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - '>='
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - '>='
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: activerecord-nulldb-adapter
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - '>='
|
236
235
|
- !ruby/object:Gem::Version
|
237
236
|
version: '0'
|
238
237
|
description: Decreases the need to write integration tests by ensuring that the things
|
@@ -249,13 +248,16 @@ files:
|
|
249
248
|
- Gemfile
|
250
249
|
- Gemfile.lock
|
251
250
|
- Guardfile
|
251
|
+
- Guardfile.cucumber
|
252
252
|
- README.md
|
253
253
|
- Rakefile
|
254
254
|
- bogus.gemspec
|
255
255
|
- features/.nav
|
256
256
|
- features/authors.md
|
257
257
|
- features/changelog.md
|
258
|
-
- features/
|
258
|
+
- features/configuration/fake_ar_attributes.feature
|
259
|
+
- features/configuration/readme.md
|
260
|
+
- features/configuration/search_modules.feature
|
259
261
|
- features/contract_tests/contract_tests_mocks.feature
|
260
262
|
- features/contract_tests/contract_tests_spies.feature
|
261
263
|
- features/contract_tests/contract_tests_stubs.feature
|
@@ -278,11 +280,13 @@ files:
|
|
278
280
|
- features/step_definitions/rspec_steps.rb
|
279
281
|
- features/support/env.rb
|
280
282
|
- lib/bogus.rb
|
283
|
+
- lib/bogus/active_record_accessors.rb
|
281
284
|
- lib/bogus/adds_recording.rb
|
282
285
|
- lib/bogus/any_args.rb
|
283
286
|
- lib/bogus/anything.rb
|
284
287
|
- lib/bogus/class_methods.rb
|
285
288
|
- lib/bogus/configuration.rb
|
289
|
+
- lib/bogus/constructor_methods.rb
|
286
290
|
- lib/bogus/contract_not_fulfilled.rb
|
287
291
|
- lib/bogus/converts_name_to_class.rb
|
288
292
|
- lib/bogus/copies_classes.rb
|
@@ -329,6 +333,7 @@ files:
|
|
329
333
|
- lib/bogus/shadow.rb
|
330
334
|
- lib/bogus/takes.rb
|
331
335
|
- lib/bogus/tracks_existence_of_test_doubles.rb
|
336
|
+
- lib/bogus/undefined_return_value.rb
|
332
337
|
- lib/bogus/verifies_contracts.rb
|
333
338
|
- lib/bogus/verifies_stub_definition.rb
|
334
339
|
- lib/bogus/version.rb
|
@@ -344,15 +349,19 @@ files:
|
|
344
349
|
- spec/bogus/creates_fakes_with_stubbed_methods_spec.rb
|
345
350
|
- spec/bogus/double_spec.rb
|
346
351
|
- spec/bogus/ensures_all_interactions_satisfied_spec.rb
|
352
|
+
- spec/bogus/fake_ar_attributes_spec.rb
|
347
353
|
- spec/bogus/fake_configuration_spec.rb
|
348
354
|
- spec/bogus/fake_registry_spec.rb
|
349
355
|
- spec/bogus/fakes_classes_spec.rb
|
356
|
+
- spec/bogus/faking_factories_spec.rb
|
357
|
+
- spec/bogus/frozen_fakes_spec.rb
|
350
358
|
- spec/bogus/have_received_matcher_spec.rb
|
351
359
|
- spec/bogus/instance_methods_spec.rb
|
352
360
|
- spec/bogus/interaction_spec.rb
|
353
361
|
- spec/bogus/interactions_repository_spec.rb
|
354
362
|
- spec/bogus/makes_ducks_spec.rb
|
355
363
|
- spec/bogus/makes_substitute_methods_spec.rb
|
364
|
+
- spec/bogus/method_copiers_spec.rb
|
356
365
|
- spec/bogus/mocking_dsl_spec.rb
|
357
366
|
- spec/bogus/multi_stubber_spec.rb
|
358
367
|
- spec/bogus/overwriten_classes_spec.rb
|
@@ -364,35 +373,36 @@ files:
|
|
364
373
|
- spec/bogus/registers_created_fakes_spec.rb
|
365
374
|
- spec/bogus/resets_overwritten_classes_spec.rb
|
366
375
|
- spec/bogus/resets_stubbed_methods_spec.rb
|
376
|
+
- spec/bogus/ruby_2_support_spec.rb
|
367
377
|
- spec/bogus/shadow_spec.rb
|
368
378
|
- spec/bogus/tracks_existence_of_test_doubles_spec.rb
|
369
379
|
- spec/bogus/verifies_contracts_spec.rb
|
370
380
|
- spec/bogus/verifies_stub_definition_spec.rb
|
371
381
|
- spec/spec_helper.rb
|
372
382
|
- spec/support/fake_creator_of_fakes.rb
|
383
|
+
- spec/support/matchers.rb
|
373
384
|
- spec/support/sample_fake.rb
|
374
385
|
homepage: https://github.com/psyho/bogus
|
375
386
|
licenses: []
|
387
|
+
metadata: {}
|
376
388
|
post_install_message:
|
377
389
|
rdoc_options: []
|
378
390
|
require_paths:
|
379
391
|
- lib
|
380
392
|
required_ruby_version: !ruby/object:Gem::Requirement
|
381
|
-
none: false
|
382
393
|
requirements:
|
383
|
-
- -
|
394
|
+
- - '>='
|
384
395
|
- !ruby/object:Gem::Version
|
385
396
|
version: '0'
|
386
397
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
387
|
-
none: false
|
388
398
|
requirements:
|
389
|
-
- -
|
399
|
+
- - '>='
|
390
400
|
- !ruby/object:Gem::Version
|
391
401
|
version: '0'
|
392
402
|
requirements: []
|
393
403
|
rubyforge_project: bogus
|
394
|
-
rubygems_version:
|
404
|
+
rubygems_version: 2.0.0.rc.2
|
395
405
|
signing_key:
|
396
|
-
specification_version:
|
406
|
+
specification_version: 4
|
397
407
|
summary: Create fakes to make your isolated unit tests reliable.
|
398
408
|
test_files: []
|