mspec 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -7
- data/lib/mspec/commands/mspec.rb +0 -8
- data/lib/mspec/guards/platform.rb +4 -0
- data/lib/mspec/helpers/environment.rb +12 -22
- data/lib/mspec/helpers/io.rb +6 -1
- data/lib/mspec/helpers/mock_to_path.rb +1 -1
- data/lib/mspec/helpers/ruby_exe.rb +8 -3
- data/lib/mspec/runner/actions.rb +0 -1
- data/lib/mspec/utils/options.rb +0 -4
- data/lib/mspec/utils/script.rb +0 -1
- data/lib/mspec/version.rb +1 -1
- data/spec/commands/mkspec_spec.rb +31 -31
- data/spec/commands/mspec_ci_spec.rb +14 -14
- data/spec/commands/mspec_run_spec.rb +4 -4
- data/spec/commands/mspec_spec.rb +33 -56
- data/spec/commands/mspec_tag_spec.rb +26 -26
- data/spec/guards/background_spec.rb +1 -1
- data/spec/guards/block_device_spec.rb +1 -1
- data/spec/guards/bug_spec.rb +4 -4
- data/spec/guards/compliance_spec.rb +2 -2
- data/spec/guards/conflict_spec.rb +5 -5
- data/spec/guards/endian_spec.rb +8 -8
- data/spec/guards/extensions_spec.rb +1 -1
- data/spec/guards/feature_spec.rb +1 -1
- data/spec/guards/guard_spec.rb +20 -20
- data/spec/guards/noncompliance_spec.rb +1 -1
- data/spec/guards/platform_spec.rb +14 -14
- data/spec/guards/quarantine_spec.rb +1 -1
- data/spec/guards/runner_spec.rb +7 -7
- data/spec/guards/specified_spec.rb +7 -7
- data/spec/guards/superuser_spec.rb +3 -3
- data/spec/guards/support_spec.rb +1 -1
- data/spec/guards/tty_spec.rb +1 -1
- data/spec/guards/user_spec.rb +3 -3
- data/spec/guards/version_spec.rb +3 -3
- data/spec/helpers/ducktype_spec.rb +3 -3
- data/spec/helpers/environment_spec.rb +18 -10
- data/spec/helpers/flunk_spec.rb +2 -2
- data/spec/helpers/io_spec.rb +2 -2
- data/spec/helpers/ruby_exe_spec.rb +5 -9
- data/spec/matchers/have_singleton_method_spec.rb +1 -1
- data/spec/matchers/output_spec.rb +1 -1
- data/spec/mocks/mock_spec.rb +41 -41
- data/spec/mocks/proxy_spec.rb +1 -1
- data/spec/runner/actions/filter_spec.rb +1 -1
- data/spec/runner/actions/tag_spec.rb +17 -17
- data/spec/runner/actions/taglist_spec.rb +8 -8
- data/spec/runner/actions/tagpurge_spec.rb +11 -11
- data/spec/runner/actions/timer_spec.rb +4 -4
- data/spec/runner/context_spec.rb +32 -32
- data/spec/runner/example_spec.rb +1 -1
- data/spec/runner/filters/profile_spec.rb +2 -2
- data/spec/runner/filters/tag_spec.rb +6 -6
- data/spec/runner/formatters/describe_spec.rb +6 -6
- data/spec/runner/formatters/dotted_spec.rb +10 -10
- data/spec/runner/formatters/file_spec.rb +2 -2
- data/spec/runner/formatters/html_spec.rb +10 -10
- data/spec/runner/formatters/junit_spec.rb +11 -11
- data/spec/runner/formatters/method_spec.rb +3 -3
- data/spec/runner/formatters/specdoc_spec.rb +1 -1
- data/spec/runner/formatters/spinner_spec.rb +4 -4
- data/spec/runner/formatters/unit_spec.rb +7 -7
- data/spec/runner/formatters/yaml_spec.rb +10 -10
- data/spec/runner/mspec_spec.rb +25 -25
- data/spec/runner/shared_spec.rb +1 -1
- data/spec/utils/options_spec.rb +28 -50
- data/spec/utils/script_spec.rb +15 -24
- metadata +12 -16
- data/lib/mspec/runner/actions/gdb.rb +0 -17
- data/spec/runner/actions/gdb_spec.rb +0 -61
@@ -18,10 +18,10 @@ describe MSpecRun, "#options" do
|
|
18
18
|
|
19
19
|
@argv = ["a", "b"]
|
20
20
|
@options, @config = new_option
|
21
|
-
MSpecOptions.stub
|
21
|
+
MSpecOptions.stub(:new).and_return(@options)
|
22
22
|
|
23
23
|
@script = MSpecRun.new
|
24
|
-
@script.stub
|
24
|
+
@script.stub(:config).and_return(@config)
|
25
25
|
end
|
26
26
|
|
27
27
|
after :each do
|
@@ -142,7 +142,7 @@ end
|
|
142
142
|
describe MSpecRun, "#run" do
|
143
143
|
before :each do
|
144
144
|
@script = MSpecRun.new
|
145
|
-
@script.stub
|
145
|
+
@script.stub(:exit)
|
146
146
|
@spec_dir = File.expand_path(File.dirname(__FILE__)+"/fixtures")
|
147
147
|
@file_patterns = [
|
148
148
|
@spec_dir+"/level2",
|
@@ -179,7 +179,7 @@ describe MSpecRun, "#run" do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it "exits with the exit code registered with MSpec" do
|
182
|
-
MSpec.stub
|
182
|
+
MSpec.stub(:exit_code).and_return(7)
|
183
183
|
@script.should_receive(:exit).with(7)
|
184
184
|
@script.run
|
185
185
|
end
|
data/spec/commands/mspec_spec.rb
CHANGED
@@ -5,11 +5,11 @@ require 'mspec/commands/mspec'
|
|
5
5
|
describe MSpecMain, "#options" do
|
6
6
|
before :each do
|
7
7
|
@options, @config = new_option
|
8
|
-
MSpecOptions.stub
|
8
|
+
MSpecOptions.stub(:new).and_return(@options)
|
9
9
|
|
10
10
|
@script = MSpecMain.new
|
11
|
-
@script.stub
|
12
|
-
@script.stub
|
11
|
+
@script.stub(:config).and_return(@config)
|
12
|
+
@script.stub(:load)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "enables the configure option" do
|
@@ -108,15 +108,15 @@ describe MSpecMain, "#report" do
|
|
108
108
|
before :each do
|
109
109
|
@stdout, $stdout = $stdout, IOStub.new
|
110
110
|
|
111
|
-
@timer =
|
112
|
-
@timer.stub
|
113
|
-
@file =
|
111
|
+
@timer = double("timer").as_null_object
|
112
|
+
@timer.stub(:format).and_return("Finished in 42 seconds")
|
113
|
+
@file = double("file").as_null_object
|
114
114
|
|
115
|
-
File.stub
|
116
|
-
YAML.stub
|
115
|
+
File.stub(:delete)
|
116
|
+
YAML.stub(:load)
|
117
117
|
|
118
118
|
@hash = { "files"=>1, "examples"=>1, "expectations"=>2, "failures"=>0, "errors"=>0 }
|
119
|
-
File.stub
|
119
|
+
File.stub(:open).and_yield(@file).and_return(@hash)
|
120
120
|
|
121
121
|
@script = MSpecMain.new
|
122
122
|
end
|
@@ -182,16 +182,16 @@ end
|
|
182
182
|
describe MSpecMain, "#multi_exec" do
|
183
183
|
before :each do
|
184
184
|
@options, @config = new_option
|
185
|
-
MSpecOptions.stub
|
185
|
+
MSpecOptions.stub(:new).and_return(@options)
|
186
186
|
|
187
187
|
@config[:target] = "target"
|
188
188
|
@config[:ci_files] = ["a", "b"]
|
189
189
|
|
190
190
|
@script = MSpecMain.new
|
191
|
-
@script.stub
|
192
|
-
@script.stub
|
193
|
-
@script.stub
|
194
|
-
Process.stub
|
191
|
+
@script.stub(:config).and_return(@config)
|
192
|
+
@script.stub(:fork)
|
193
|
+
@script.stub(:report)
|
194
|
+
Process.stub(:waitall)
|
195
195
|
end
|
196
196
|
|
197
197
|
it "calls #fork for each entry in config[:ci_files]" do
|
@@ -213,10 +213,10 @@ end
|
|
213
213
|
describe MSpecMain, "#run" do
|
214
214
|
before :each do
|
215
215
|
@options, @config = new_option
|
216
|
-
MSpecOptions.stub
|
216
|
+
MSpecOptions.stub(:new).and_return(@options)
|
217
217
|
@script = MSpecMain.new
|
218
|
-
@script.stub
|
219
|
-
@script.stub
|
218
|
+
@script.stub(:config).and_return(@config)
|
219
|
+
@script.stub(:exec)
|
220
220
|
end
|
221
221
|
|
222
222
|
it "sets MSPEC_RUNNER = '1' in the environment" do
|
@@ -264,39 +264,16 @@ describe MSpecMain, "#run" do
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
describe "The -D, --gdb option" do
|
268
|
-
before :each do
|
269
|
-
@options, @config = new_option
|
270
|
-
MSpecOptions.stub!(:new).and_return(@options)
|
271
|
-
@script = MSpecMain.new
|
272
|
-
@script.stub!(:config).and_return(@config)
|
273
|
-
end
|
274
|
-
|
275
|
-
it "is enabled by #options" do
|
276
|
-
@options.stub!(:on)
|
277
|
-
@options.should_receive(:on).with("-D", "--gdb", an_instance_of(String))
|
278
|
-
@script.options
|
279
|
-
end
|
280
|
-
|
281
|
-
it "sets use_gdb to true" do
|
282
|
-
["-D", "--gdb"].each do |opt|
|
283
|
-
@config[:use_gdb] = false
|
284
|
-
@script.options [opt]
|
285
|
-
@config[:use_gdb].should be_true
|
286
|
-
end
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
267
|
describe "The -A, --valgrind option" do
|
291
268
|
before :each do
|
292
269
|
@options, @config = new_option
|
293
|
-
MSpecOptions.stub
|
270
|
+
MSpecOptions.stub(:new).and_return(@options)
|
294
271
|
@script = MSpecMain.new
|
295
|
-
@script.stub
|
272
|
+
@script.stub(:config).and_return(@config)
|
296
273
|
end
|
297
274
|
|
298
275
|
it "is enabled by #options" do
|
299
|
-
@options.stub
|
276
|
+
@options.stub(:on)
|
300
277
|
@options.should_receive(:on).with("-A", "--valgrind", an_instance_of(String))
|
301
278
|
@script.options
|
302
279
|
end
|
@@ -313,13 +290,13 @@ end
|
|
313
290
|
describe "The --warnings option" do
|
314
291
|
before :each do
|
315
292
|
@options, @config = new_option
|
316
|
-
MSpecOptions.stub
|
293
|
+
MSpecOptions.stub(:new).and_return(@options)
|
317
294
|
@script = MSpecMain.new
|
318
|
-
@script.stub
|
295
|
+
@script.stub(:config).and_return(@config)
|
319
296
|
end
|
320
297
|
|
321
298
|
it "is enabled by #options" do
|
322
|
-
@options.stub
|
299
|
+
@options.stub(:on)
|
323
300
|
@options.should_receive(:on).with("--warnings", an_instance_of(String))
|
324
301
|
@script.options
|
325
302
|
end
|
@@ -340,13 +317,13 @@ end
|
|
340
317
|
describe "The -j, --multi option" do
|
341
318
|
before :each do
|
342
319
|
@options, @config = new_option
|
343
|
-
MSpecOptions.stub
|
320
|
+
MSpecOptions.stub(:new).and_return(@options)
|
344
321
|
@script = MSpecMain.new
|
345
|
-
@script.stub
|
322
|
+
@script.stub(:config).and_return(@config)
|
346
323
|
end
|
347
324
|
|
348
325
|
it "is enabled by #options" do
|
349
|
-
@options.stub
|
326
|
+
@options.stub(:on)
|
350
327
|
@options.should_receive(:on).with("-j", "--multi", an_instance_of(String))
|
351
328
|
@script.options
|
352
329
|
end
|
@@ -371,13 +348,13 @@ end
|
|
371
348
|
describe "The -h, --help option" do
|
372
349
|
before :each do
|
373
350
|
@options, @config = new_option
|
374
|
-
MSpecOptions.stub
|
351
|
+
MSpecOptions.stub(:new).and_return(@options)
|
375
352
|
@script = MSpecMain.new
|
376
|
-
@script.stub
|
353
|
+
@script.stub(:config).and_return(@config)
|
377
354
|
end
|
378
355
|
|
379
356
|
it "is enabled by #options" do
|
380
|
-
@options.stub
|
357
|
+
@options.stub(:on)
|
381
358
|
@options.should_receive(:on).with("-h", "--help", an_instance_of(String))
|
382
359
|
@script.options
|
383
360
|
end
|
@@ -402,13 +379,13 @@ end
|
|
402
379
|
describe "The -v, --version option" do
|
403
380
|
before :each do
|
404
381
|
@options, @config = new_option
|
405
|
-
MSpecOptions.stub
|
382
|
+
MSpecOptions.stub(:new).and_return(@options)
|
406
383
|
@script = MSpecMain.new
|
407
|
-
@script.stub
|
384
|
+
@script.stub(:config).and_return(@config)
|
408
385
|
end
|
409
386
|
|
410
387
|
it "is enabled by #options" do
|
411
|
-
@options.stub
|
388
|
+
@options.stub(:on)
|
412
389
|
@options.should_receive(:on).with("-v", "--version", an_instance_of(String))
|
413
390
|
@script.options
|
414
391
|
end
|
@@ -423,7 +400,7 @@ describe "The -v, --version option" do
|
|
423
400
|
|
424
401
|
it "prints the version and exits if no subscript is invoked" do
|
425
402
|
@config[:command] = nil
|
426
|
-
File.stub
|
403
|
+
File.stub(:basename).and_return("mspec")
|
427
404
|
@script.should_receive(:puts).twice.with("mspec #{MSpec::VERSION}")
|
428
405
|
@script.should_receive(:exit).twice
|
429
406
|
["-v", "--version"].each do |opt|
|
@@ -33,10 +33,10 @@ describe MSpecTag, "#options" do
|
|
33
33
|
|
34
34
|
@argv = ["a", "b"]
|
35
35
|
@options, @config = new_option
|
36
|
-
MSpecOptions.stub
|
36
|
+
MSpecOptions.stub(:new).and_return(@options)
|
37
37
|
|
38
38
|
@script = MSpecTag.new
|
39
|
-
@script.stub
|
39
|
+
@script.stub(:config).and_return(@config)
|
40
40
|
end
|
41
41
|
|
42
42
|
after :each do
|
@@ -114,14 +114,14 @@ end
|
|
114
114
|
describe MSpecTag, "options" do
|
115
115
|
before :each do
|
116
116
|
@options, @config = new_option
|
117
|
-
MSpecOptions.stub
|
117
|
+
MSpecOptions.stub(:new).and_return(@options)
|
118
118
|
@script = MSpecTag.new
|
119
|
-
@script.stub
|
119
|
+
@script.stub(:config).and_return(@config)
|
120
120
|
end
|
121
121
|
|
122
122
|
describe "-N, --add TAG" do
|
123
123
|
it "is enabled with #options" do
|
124
|
-
@options.stub
|
124
|
+
@options.stub(:on)
|
125
125
|
@options.should_receive(:on).with("-N", "--add", "TAG", an_instance_of(String))
|
126
126
|
@script.options ["file.rb"]
|
127
127
|
end
|
@@ -139,7 +139,7 @@ describe MSpecTag, "options" do
|
|
139
139
|
|
140
140
|
describe "-R, --del TAG" do
|
141
141
|
it "is enabled with #options" do
|
142
|
-
@options.stub
|
142
|
+
@options.stub(:on)
|
143
143
|
@options.should_receive(:on).with("-R", "--del", "TAG",
|
144
144
|
an_instance_of(String))
|
145
145
|
@script.options ["file.rb"]
|
@@ -160,7 +160,7 @@ describe MSpecTag, "options" do
|
|
160
160
|
|
161
161
|
describe "-Q, --pass" do
|
162
162
|
it "is enabled with #options" do
|
163
|
-
@options.stub
|
163
|
+
@options.stub(:on)
|
164
164
|
@options.should_receive(:on).with("-Q", "--pass", an_instance_of(String))
|
165
165
|
@script.options ["file.rb"]
|
166
166
|
end
|
@@ -176,7 +176,7 @@ describe MSpecTag, "options" do
|
|
176
176
|
|
177
177
|
describe "-F, --fail" do
|
178
178
|
it "is enabled with #options" do
|
179
|
-
@options.stub
|
179
|
+
@options.stub(:on)
|
180
180
|
@options.should_receive(:on).with("-F", "--fail", an_instance_of(String))
|
181
181
|
@script.options ["file.rb"]
|
182
182
|
end
|
@@ -192,7 +192,7 @@ describe MSpecTag, "options" do
|
|
192
192
|
|
193
193
|
describe "-L, --all" do
|
194
194
|
it "is enabled with #options" do
|
195
|
-
@options.stub
|
195
|
+
@options.stub(:on)
|
196
196
|
@options.should_receive(:on).with("-L", "--all", an_instance_of(String))
|
197
197
|
@script.options ["file.rb"]
|
198
198
|
end
|
@@ -208,7 +208,7 @@ describe MSpecTag, "options" do
|
|
208
208
|
|
209
209
|
describe "--list TAG" do
|
210
210
|
it "is enabled with #options" do
|
211
|
-
@options.stub
|
211
|
+
@options.stub(:on)
|
212
212
|
@options.should_receive(:on).with("--list", "TAG", an_instance_of(String))
|
213
213
|
@script.options ["file.rb"]
|
214
214
|
end
|
@@ -228,7 +228,7 @@ describe MSpecTag, "options" do
|
|
228
228
|
|
229
229
|
describe "--list-all" do
|
230
230
|
it "is enabled with #options" do
|
231
|
-
@options.stub
|
231
|
+
@options.stub(:on)
|
232
232
|
@options.should_receive(:on).with("--list-all", an_instance_of(String))
|
233
233
|
@script.options ["file.rb"]
|
234
234
|
end
|
@@ -242,7 +242,7 @@ describe MSpecTag, "options" do
|
|
242
242
|
|
243
243
|
describe "--purge" do
|
244
244
|
it "is enabled with #options" do
|
245
|
-
@options.stub
|
245
|
+
@options.stub(:on)
|
246
246
|
@options.should_receive(:on).with("--purge", an_instance_of(String))
|
247
247
|
@script.options ["file.rb"]
|
248
248
|
end
|
@@ -257,17 +257,17 @@ end
|
|
257
257
|
|
258
258
|
describe MSpecTag, "#run" do
|
259
259
|
before :each do
|
260
|
-
MSpec.stub
|
260
|
+
MSpec.stub(:process)
|
261
261
|
|
262
|
-
options =
|
263
|
-
options.stub
|
264
|
-
MSpecOptions.stub
|
262
|
+
options = double("MSpecOptions").as_null_object
|
263
|
+
options.stub(:parse).and_return(["one", "two"])
|
264
|
+
MSpecOptions.stub(:new).and_return(options)
|
265
265
|
|
266
266
|
@config = { }
|
267
267
|
@script = MSpecTag.new
|
268
|
-
@script.stub
|
269
|
-
@script.stub
|
270
|
-
@script.stub
|
268
|
+
@script.stub(:exit)
|
269
|
+
@script.stub(:config).and_return(@config)
|
270
|
+
@script.stub(:files).and_return(["one", "two"])
|
271
271
|
@script.options
|
272
272
|
end
|
273
273
|
|
@@ -288,7 +288,7 @@ describe MSpecTag, "#run" do
|
|
288
288
|
end
|
289
289
|
|
290
290
|
it "exits with the exit code registered with MSpec" do
|
291
|
-
MSpec.stub
|
291
|
+
MSpec.stub(:exit_code).and_return(7)
|
292
292
|
@script.should_receive(:exit).with(7)
|
293
293
|
@script.run
|
294
294
|
end
|
@@ -303,14 +303,14 @@ describe MSpecTag, "#register" do
|
|
303
303
|
@config[:astrings] = []
|
304
304
|
@config[:ltags] = ["fails", "unstable"]
|
305
305
|
|
306
|
-
@script.stub
|
306
|
+
@script.stub(:files).and_return([])
|
307
307
|
@script.options "fake"
|
308
308
|
|
309
|
-
@t =
|
310
|
-
@t.stub
|
309
|
+
@t = double("TagAction")
|
310
|
+
@t.stub(:register)
|
311
311
|
|
312
|
-
@tl =
|
313
|
-
@tl.stub
|
312
|
+
@tl = double("TagListAction")
|
313
|
+
@tl.stub(:register)
|
314
314
|
end
|
315
315
|
|
316
316
|
it "raises an ArgumentError if no recognized action is given" do
|
@@ -389,7 +389,7 @@ describe MSpecTag, "#register" do
|
|
389
389
|
describe "when config[:tagger] is :purge" do
|
390
390
|
before :each do
|
391
391
|
TagPurgeAction.should_receive(:new).and_return(@tl)
|
392
|
-
MSpec.stub
|
392
|
+
MSpec.stub(:register_mode)
|
393
393
|
@config[:tagger] = :purge
|
394
394
|
end
|
395
395
|
|
data/spec/guards/bug_spec.rb
CHANGED
@@ -94,7 +94,7 @@ describe BugGuard, "#match? when #implementation? is not 'ruby'" do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
it "returns false when MSpec.mode?(:no_ruby_bug) is true" do
|
97
|
-
MSpec.
|
97
|
+
MSpec.stub(:mode?).and_return(:true)
|
98
98
|
BugGuard.new("#1", "1.8.6").match?.should == false
|
99
99
|
BugGuard.new("#1", "1.8.6.114").match?.should == false
|
100
100
|
BugGuard.new("#1", "1.8.6.115").match?.should == false
|
@@ -104,18 +104,18 @@ end
|
|
104
104
|
describe Object, "#ruby_bug" do
|
105
105
|
before :each do
|
106
106
|
@guard = BugGuard.new "#1234", "x.x.x.x"
|
107
|
-
BugGuard.stub
|
107
|
+
BugGuard.stub(:new).and_return(@guard)
|
108
108
|
ScratchPad.clear
|
109
109
|
end
|
110
110
|
|
111
111
|
it "yields when #match? returns false" do
|
112
|
-
@guard.stub
|
112
|
+
@guard.stub(:match?).and_return(false)
|
113
113
|
ruby_bug("#1234", "1.8.6") { ScratchPad.record :yield }
|
114
114
|
ScratchPad.recorded.should == :yield
|
115
115
|
end
|
116
116
|
|
117
117
|
it "does not yield when #match? returns true" do
|
118
|
-
@guard.stub
|
118
|
+
@guard.stub(:match?).and_return(true)
|
119
119
|
ruby_bug("#1234", "1.8.6") { ScratchPad.record :yield }
|
120
120
|
ScratchPad.recorded.should_not == :yield
|
121
121
|
end
|
@@ -57,7 +57,7 @@ end
|
|
57
57
|
describe Object, "#compliant_on" do
|
58
58
|
before :each do
|
59
59
|
@guard = CompliantOnGuard.new :any
|
60
|
-
CompliantOnGuard.stub
|
60
|
+
CompliantOnGuard.stub(:new).and_return(@guard)
|
61
61
|
end
|
62
62
|
|
63
63
|
it "sets the name of the guard to :compliant_on" do
|
@@ -123,7 +123,7 @@ end
|
|
123
123
|
describe Object, "#not_compliant_on" do
|
124
124
|
before :each do
|
125
125
|
@guard = NotCompliantOnGuard.new :any
|
126
|
-
NotCompliantOnGuard.stub
|
126
|
+
NotCompliantOnGuard.stub(:new).and_return(@guard)
|
127
127
|
end
|
128
128
|
|
129
129
|
it "sets the name of the guard to :not_compliant_on" do
|
@@ -7,25 +7,25 @@ describe Object, "#conflicts_with" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "does not yield if Object.constants includes any of the arguments" do
|
10
|
-
Object.stub
|
10
|
+
Object.stub(:constants).and_return(["SomeClass", "OtherClass"])
|
11
11
|
conflicts_with(:SomeClass, :AClass, :BClass) { ScratchPad.record :yield }
|
12
12
|
ScratchPad.recorded.should_not == :yield
|
13
13
|
end
|
14
14
|
|
15
15
|
it "does not yield if Object.constants (as Symbols) includes any of the arguments" do
|
16
|
-
Object.stub
|
16
|
+
Object.stub(:constants).and_return([:SomeClass, :OtherClass])
|
17
17
|
conflicts_with(:SomeClass, :AClass, :BClass) { ScratchPad.record :yield }
|
18
18
|
ScratchPad.recorded.should_not == :yield
|
19
19
|
end
|
20
20
|
|
21
21
|
it "yields if Object.constants does not include any of the arguments" do
|
22
|
-
Object.stub
|
22
|
+
Object.stub(:constants).and_return(["SomeClass", "OtherClass"])
|
23
23
|
conflicts_with(:AClass, :BClass) { ScratchPad.record :yield }
|
24
24
|
ScratchPad.recorded.should == :yield
|
25
25
|
end
|
26
26
|
|
27
27
|
it "yields if Object.constants (as Symbols) does not include any of the arguments" do
|
28
|
-
Object.stub
|
28
|
+
Object.stub(:constants).and_return([:SomeClass, :OtherClass])
|
29
29
|
conflicts_with(:AClass, :BClass) { ScratchPad.record :yield }
|
30
30
|
ScratchPad.recorded.should == :yield
|
31
31
|
end
|
@@ -34,7 +34,7 @@ end
|
|
34
34
|
describe Object, "#conflicts_with" do
|
35
35
|
before :each do
|
36
36
|
@guard = ConflictsGuard.new
|
37
|
-
ConflictsGuard.stub
|
37
|
+
ConflictsGuard.stub(:new).and_return(@guard)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "sets the name of the guard to :conflicts_with" do
|