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
data/spec/guards/endian_spec.rb
CHANGED
@@ -4,18 +4,18 @@ require 'mspec/guards'
|
|
4
4
|
describe Object, "#big_endian" do
|
5
5
|
before :each do
|
6
6
|
@guard = BigEndianGuard.new
|
7
|
-
BigEndianGuard.stub
|
7
|
+
BigEndianGuard.stub(:new).and_return(@guard)
|
8
8
|
ScratchPad.clear
|
9
9
|
end
|
10
10
|
|
11
11
|
it "yields on big-endian platforms" do
|
12
|
-
@guard.stub
|
12
|
+
@guard.stub(:pattern).and_return([?\001])
|
13
13
|
big_endian { ScratchPad.record :yield }
|
14
14
|
ScratchPad.recorded.should == :yield
|
15
15
|
end
|
16
16
|
|
17
17
|
it "does not yield on little-endian platforms" do
|
18
|
-
@guard.stub
|
18
|
+
@guard.stub(:pattern).and_return([?\000])
|
19
19
|
big_endian { ScratchPad.record :yield }
|
20
20
|
ScratchPad.recorded.should_not == :yield
|
21
21
|
end
|
@@ -26,7 +26,7 @@ describe Object, "#big_endian" do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "calls #unregister even when an exception is raised in the guard block" do
|
29
|
-
@guard.stub
|
29
|
+
@guard.stub(:pattern).and_return([?\001])
|
30
30
|
@guard.should_receive(:unregister)
|
31
31
|
lambda do
|
32
32
|
big_endian { raise Exception }
|
@@ -37,18 +37,18 @@ end
|
|
37
37
|
describe Object, "#little_endian" do
|
38
38
|
before :each do
|
39
39
|
@guard = LittleEndianGuard.new
|
40
|
-
LittleEndianGuard.stub
|
40
|
+
LittleEndianGuard.stub(:new).and_return(@guard)
|
41
41
|
ScratchPad.clear
|
42
42
|
end
|
43
43
|
|
44
44
|
it "yields on little-endian platforms" do
|
45
|
-
@guard.stub
|
45
|
+
@guard.stub(:pattern).and_return([?\000])
|
46
46
|
little_endian { ScratchPad.record :yield }
|
47
47
|
ScratchPad.recorded.should == :yield
|
48
48
|
end
|
49
49
|
|
50
50
|
it "does not yield on big-endian platforms" do
|
51
|
-
@guard.stub
|
51
|
+
@guard.stub(:pattern).and_return([?\001])
|
52
52
|
little_endian { ScratchPad.record :yield }
|
53
53
|
ScratchPad.recorded.should_not == :yield
|
54
54
|
end
|
@@ -59,7 +59,7 @@ describe Object, "#little_endian" do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "calls #unregister even when an exception is raised in the guard block" do
|
62
|
-
@guard.stub
|
62
|
+
@guard.stub(:pattern).and_return([?\000])
|
63
63
|
@guard.should_receive(:unregister)
|
64
64
|
lambda do
|
65
65
|
little_endian { raise Exception }
|
data/spec/guards/feature_spec.rb
CHANGED
data/spec/guards/guard_spec.rb
CHANGED
@@ -146,23 +146,23 @@ describe SpecGuard, "#yield?" do
|
|
146
146
|
end
|
147
147
|
|
148
148
|
it "returns #match? if neither report nor verify mode are true" do
|
149
|
-
@guard.stub
|
149
|
+
@guard.stub(:match?).and_return(false)
|
150
150
|
@guard.yield?.should == false
|
151
|
-
@guard.stub
|
151
|
+
@guard.stub(:match?).and_return(true)
|
152
152
|
@guard.yield?.should == true
|
153
153
|
end
|
154
154
|
|
155
155
|
it "returns #match? if invert is true and neither report nor verify mode are true" do
|
156
|
-
@guard.stub
|
156
|
+
@guard.stub(:match?).and_return(false)
|
157
157
|
@guard.yield?(true).should == true
|
158
|
-
@guard.stub
|
158
|
+
@guard.stub(:match?).and_return(true)
|
159
159
|
@guard.yield?(true).should == false
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
describe SpecGuard, "#===" do
|
164
164
|
it "returns true" do
|
165
|
-
anything =
|
165
|
+
anything = double("anything")
|
166
166
|
SpecGuard.new.===(anything).should == true
|
167
167
|
end
|
168
168
|
end
|
@@ -331,12 +331,12 @@ describe SpecGuard, "#platform? on JRuby" do
|
|
331
331
|
end
|
332
332
|
|
333
333
|
it "returns true when arg is :windows and RUBY_PLATFORM contains 'java' and os?(:windows) is true" do
|
334
|
-
RbConfig::CONFIG.stub
|
334
|
+
RbConfig::CONFIG.stub(:[]).and_return('mswin32')
|
335
335
|
@guard.platform?(:windows).should == true
|
336
336
|
end
|
337
337
|
|
338
338
|
it "returns true when RUBY_PLATFORM contains 'java' and os?(argument) is true" do
|
339
|
-
RbConfig::CONFIG.stub
|
339
|
+
RbConfig::CONFIG.stub(:[]).and_return('amiga')
|
340
340
|
@guard.platform?(:amiga).should == true
|
341
341
|
end
|
342
342
|
end
|
@@ -358,7 +358,7 @@ end
|
|
358
358
|
describe SpecGuard, "#os?" do
|
359
359
|
before :each do
|
360
360
|
@guard = SpecGuard.new
|
361
|
-
RbConfig::CONFIG.stub
|
361
|
+
RbConfig::CONFIG.stub(:[]).and_return('unreal')
|
362
362
|
end
|
363
363
|
|
364
364
|
it "returns true if argument matches RbConfig::CONFIG['host_os']" do
|
@@ -378,22 +378,22 @@ describe SpecGuard, "#os?" do
|
|
378
378
|
end
|
379
379
|
|
380
380
|
it "returns true when arg is :windows and RbConfig::CONFIG['host_os'] contains 'mswin'" do
|
381
|
-
RbConfig::CONFIG.stub
|
381
|
+
RbConfig::CONFIG.stub(:[]).and_return('i386-mswin32')
|
382
382
|
@guard.os?(:windows).should == true
|
383
383
|
end
|
384
384
|
|
385
385
|
it "returns true when arg is :windows and RbConfig::CONFIG['host_os'] contains 'mingw'" do
|
386
|
-
RbConfig::CONFIG.stub
|
386
|
+
RbConfig::CONFIG.stub(:[]).and_return('i386-mingw32')
|
387
387
|
@guard.os?(:windows).should == true
|
388
388
|
end
|
389
389
|
|
390
390
|
it "returns false when arg is not :windows and RbConfig::CONFIG['host_os'] contains 'mswin'" do
|
391
|
-
RbConfig::CONFIG.stub
|
391
|
+
RbConfig::CONFIG.stub(:[]).and_return('i386-mingw32')
|
392
392
|
@guard.os?(:linux).should == false
|
393
393
|
end
|
394
394
|
|
395
395
|
it "returns false when arg is not :windows and RbConfig::CONFIG['host_os'] contains 'mingw'" do
|
396
|
-
RbConfig::CONFIG.stub
|
396
|
+
RbConfig::CONFIG.stub(:[]).and_return('i386-mingw32')
|
397
397
|
@guard.os?(:linux).should == false
|
398
398
|
end
|
399
399
|
end
|
@@ -422,29 +422,29 @@ end
|
|
422
422
|
describe SpecGuard, "#match?" do
|
423
423
|
before :each do
|
424
424
|
@guard = SpecGuard.new
|
425
|
-
SpecGuard.stub
|
425
|
+
SpecGuard.stub(:new).and_return(@guard)
|
426
426
|
end
|
427
427
|
|
428
428
|
it "returns true if #platform? or #implementation? return true" do
|
429
|
-
@guard.stub
|
430
|
-
@guard.stub
|
429
|
+
@guard.stub(:implementation?).and_return(true)
|
430
|
+
@guard.stub(:platform?).and_return(false)
|
431
431
|
@guard.match?.should == true
|
432
432
|
|
433
|
-
@guard.stub
|
434
|
-
@guard.stub
|
433
|
+
@guard.stub(:implementation?).and_return(false)
|
434
|
+
@guard.stub(:platform?).and_return(true)
|
435
435
|
@guard.match?.should == true
|
436
436
|
end
|
437
437
|
|
438
438
|
it "returns false if #platform? and #implementation? return false" do
|
439
|
-
@guard.stub
|
440
|
-
@guard.stub
|
439
|
+
@guard.stub(:implementation?).and_return(false)
|
440
|
+
@guard.stub(:platform?).and_return(false)
|
441
441
|
@guard.match?.should == false
|
442
442
|
end
|
443
443
|
end
|
444
444
|
|
445
445
|
describe SpecGuard, "#unregister" do
|
446
446
|
before :each do
|
447
|
-
MSpec.stub
|
447
|
+
MSpec.stub(:unregister)
|
448
448
|
@guard = SpecGuard.new
|
449
449
|
end
|
450
450
|
|
@@ -51,7 +51,7 @@ end
|
|
51
51
|
describe Object, "#deviates_on" do
|
52
52
|
before :each do
|
53
53
|
@guard = NonComplianceGuard.new
|
54
|
-
NonComplianceGuard.stub
|
54
|
+
NonComplianceGuard.stub(:new).and_return(@guard)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "sets the name of the guard to :deviates_on" do
|
@@ -4,18 +4,18 @@ require 'mspec/guards'
|
|
4
4
|
describe Object, "#platform_is" do
|
5
5
|
before :each do
|
6
6
|
@guard = PlatformGuard.new :dummy
|
7
|
-
PlatformGuard.stub
|
7
|
+
PlatformGuard.stub(:new).and_return(@guard)
|
8
8
|
ScratchPad.clear
|
9
9
|
end
|
10
10
|
|
11
11
|
it "does not yield when #platform? returns false" do
|
12
|
-
@guard.stub
|
12
|
+
@guard.stub(:platform?).and_return(false)
|
13
13
|
platform_is(:ruby) { ScratchPad.record :yield }
|
14
14
|
ScratchPad.recorded.should_not == :yield
|
15
15
|
end
|
16
16
|
|
17
17
|
it "yields when #platform? returns true" do
|
18
|
-
@guard.stub
|
18
|
+
@guard.stub(:platform?).and_return(true)
|
19
19
|
platform_is(:solarce) { ScratchPad.record :yield }
|
20
20
|
ScratchPad.recorded.should == :yield
|
21
21
|
end
|
@@ -37,18 +37,18 @@ end
|
|
37
37
|
describe Object, "#platform_is_not" do
|
38
38
|
before :each do
|
39
39
|
@guard = PlatformGuard.new :dummy
|
40
|
-
PlatformGuard.stub
|
40
|
+
PlatformGuard.stub(:new).and_return(@guard)
|
41
41
|
ScratchPad.clear
|
42
42
|
end
|
43
43
|
|
44
44
|
it "does not yield when #platform? returns true" do
|
45
|
-
@guard.stub
|
45
|
+
@guard.stub(:platform?).and_return(true)
|
46
46
|
platform_is_not(:ruby) { ScratchPad.record :yield }
|
47
47
|
ScratchPad.recorded.should_not == :yield
|
48
48
|
end
|
49
49
|
|
50
50
|
it "yields when #platform? returns false" do
|
51
|
-
@guard.stub
|
51
|
+
@guard.stub(:platform?).and_return(false)
|
52
52
|
platform_is_not(:solarce) { ScratchPad.record :yield }
|
53
53
|
ScratchPad.recorded.should == :yield
|
54
54
|
end
|
@@ -70,19 +70,19 @@ end
|
|
70
70
|
describe Object, "#platform_is :wordsize => SIZE_SPEC" do
|
71
71
|
before :each do
|
72
72
|
@guard = PlatformGuard.new :darwin, :wordsize => 32
|
73
|
-
@guard.stub
|
74
|
-
PlatformGuard.stub
|
73
|
+
@guard.stub(:platform?).and_return(true)
|
74
|
+
PlatformGuard.stub(:new).and_return(@guard)
|
75
75
|
ScratchPad.clear
|
76
76
|
end
|
77
77
|
|
78
78
|
it "yields when #wordsize? returns true" do
|
79
|
-
@guard.stub
|
79
|
+
@guard.stub(:wordsize?).and_return(true)
|
80
80
|
platform_is(:wordsize => 32) { ScratchPad.record :yield }
|
81
81
|
ScratchPad.recorded.should == :yield
|
82
82
|
end
|
83
83
|
|
84
84
|
it "doesn not yield when #wordsize? returns false" do
|
85
|
-
@guard.stub
|
85
|
+
@guard.stub(:wordsize?).and_return(false)
|
86
86
|
platform_is(:wordsize => 32) { ScratchPad.record :yield }
|
87
87
|
ScratchPad.recorded.should_not == :yield
|
88
88
|
end
|
@@ -91,19 +91,19 @@ end
|
|
91
91
|
describe Object, "#platform_is_not :wordsize => SIZE_SPEC" do
|
92
92
|
before :each do
|
93
93
|
@guard = PlatformGuard.new :darwin, :wordsize => 32
|
94
|
-
@guard.stub
|
95
|
-
PlatformGuard.stub
|
94
|
+
@guard.stub(:platform?).and_return(true)
|
95
|
+
PlatformGuard.stub(:new).and_return(@guard)
|
96
96
|
ScratchPad.clear
|
97
97
|
end
|
98
98
|
|
99
99
|
it "yields when #wordsize? returns false" do
|
100
|
-
@guard.stub
|
100
|
+
@guard.stub(:wordsize?).and_return(false)
|
101
101
|
platform_is_not(:wordsize => 32) { ScratchPad.record :yield }
|
102
102
|
ScratchPad.recorded.should == :yield
|
103
103
|
end
|
104
104
|
|
105
105
|
it "doesn not yield when #wordsize? returns true" do
|
106
|
-
@guard.stub
|
106
|
+
@guard.stub(:wordsize?).and_return(true)
|
107
107
|
platform_is_not(:wordsize => 32) { ScratchPad.record :yield }
|
108
108
|
ScratchPad.recorded.should_not == :yield
|
109
109
|
end
|
data/spec/guards/runner_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe RunnerGuard, "#match?" do
|
|
29
29
|
|
30
30
|
it "returns true when passed :rspec and ENV['RSPEC_RUNNER'] is true but the constant Spec does not exist" do
|
31
31
|
ENV['RSPEC_RUNNER'] = '1'
|
32
|
-
Object.
|
32
|
+
Object.stub(:const_defined?).and_return(false)
|
33
33
|
RunnerGuard.new(:rspec).match?.should == true
|
34
34
|
end
|
35
35
|
end
|
@@ -37,18 +37,18 @@ end
|
|
37
37
|
describe Object, "#runner_is" do
|
38
38
|
before :each do
|
39
39
|
@guard = RunnerGuard.new
|
40
|
-
RunnerGuard.stub
|
40
|
+
RunnerGuard.stub(:new).and_return(@guard)
|
41
41
|
ScratchPad.clear
|
42
42
|
end
|
43
43
|
|
44
44
|
it "yields when #match? returns true" do
|
45
|
-
@guard.stub
|
45
|
+
@guard.stub(:match?).and_return(true)
|
46
46
|
runner_is(:mspec) { ScratchPad.record :yield }
|
47
47
|
ScratchPad.recorded.should == :yield
|
48
48
|
end
|
49
49
|
|
50
50
|
it "does not yield when #match? returns false" do
|
51
|
-
@guard.stub
|
51
|
+
@guard.stub(:match?).and_return(false)
|
52
52
|
runner_is(:mspec) { ScratchPad.record :yield }
|
53
53
|
ScratchPad.recorded.should_not == :yield
|
54
54
|
end
|
@@ -70,18 +70,18 @@ end
|
|
70
70
|
describe Object, "#runner_is_not" do
|
71
71
|
before :each do
|
72
72
|
@guard = RunnerGuard.new
|
73
|
-
RunnerGuard.stub
|
73
|
+
RunnerGuard.stub(:new).and_return(@guard)
|
74
74
|
ScratchPad.clear
|
75
75
|
end
|
76
76
|
|
77
77
|
it "does not yield when #match? returns true" do
|
78
|
-
@guard.stub
|
78
|
+
@guard.stub(:match?).and_return(true)
|
79
79
|
runner_is_not(:mspec) { ScratchPad.record :yield }
|
80
80
|
ScratchPad.recorded.should_not == :yield
|
81
81
|
end
|
82
82
|
|
83
83
|
it "yields when #match? returns false" do
|
84
|
-
@guard.stub
|
84
|
+
@guard.stub(:match?).and_return(false)
|
85
85
|
runner_is_not(:mspec) { ScratchPad.record :yield }
|
86
86
|
ScratchPad.recorded.should == :yield
|
87
87
|
end
|
@@ -6,7 +6,7 @@ describe Object, "#unspecified" do
|
|
6
6
|
ScratchPad.clear
|
7
7
|
|
8
8
|
@guard = UnspecifiedGuard.new
|
9
|
-
UnspecifiedGuard.stub
|
9
|
+
UnspecifiedGuard.stub(:new).and_return(@guard)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "does not yield if #standard? returns true" do
|
@@ -29,7 +29,7 @@ describe Object, "#unspecified" do
|
|
29
29
|
|
30
30
|
it "calls #unregister even when an exception is raised in the guard block" do
|
31
31
|
guard = UnspecifiedGuard.new :rubinius
|
32
|
-
UnspecifiedGuard.stub
|
32
|
+
UnspecifiedGuard.stub(:new).and_return(guard)
|
33
33
|
guard.should_receive(:match?).and_return(true)
|
34
34
|
guard.should_receive(:unregister)
|
35
35
|
|
@@ -53,7 +53,7 @@ describe Object, "#specified_on" do
|
|
53
53
|
|
54
54
|
it "does not yield when #standard? returns true" do
|
55
55
|
guard = SpecifiedOnGuard.new
|
56
|
-
SpecifiedOnGuard.stub
|
56
|
+
SpecifiedOnGuard.stub(:new).and_return(guard)
|
57
57
|
guard.should_receive(:standard?).and_return(true)
|
58
58
|
|
59
59
|
specified_on(:rubinius) { ScratchPad.record :yield }
|
@@ -62,7 +62,7 @@ describe Object, "#specified_on" do
|
|
62
62
|
|
63
63
|
it "does not yield when #standard? returns false and #implementation? returns false" do
|
64
64
|
guard = SpecifiedOnGuard.new :rubinius
|
65
|
-
SpecifiedOnGuard.stub
|
65
|
+
SpecifiedOnGuard.stub(:new).and_return(guard)
|
66
66
|
guard.should_receive(:standard?).and_return(false)
|
67
67
|
guard.should_receive(:implementation?).with(:rubinius).and_return(false)
|
68
68
|
|
@@ -72,7 +72,7 @@ describe Object, "#specified_on" do
|
|
72
72
|
|
73
73
|
it "yields when #standard? returns false and #implementation? returns true" do
|
74
74
|
guard = SpecifiedOnGuard.new :rubinius
|
75
|
-
SpecifiedOnGuard.stub
|
75
|
+
SpecifiedOnGuard.stub(:new).and_return(guard)
|
76
76
|
guard.should_receive(:standard?).and_return(false)
|
77
77
|
guard.should_receive(:implementation?).with(:rubinius).and_return(true)
|
78
78
|
|
@@ -82,7 +82,7 @@ describe Object, "#specified_on" do
|
|
82
82
|
|
83
83
|
it "sets the name of the guard to :specified_on" do
|
84
84
|
guard = SpecifiedOnGuard.new :rubinius
|
85
|
-
SpecifiedOnGuard.stub
|
85
|
+
SpecifiedOnGuard.stub(:new).and_return(guard)
|
86
86
|
guard.should_receive(:match?).and_return(false)
|
87
87
|
|
88
88
|
specified_on(:rubinius) { }
|
@@ -91,7 +91,7 @@ describe Object, "#specified_on" do
|
|
91
91
|
|
92
92
|
it "calls #unregister even when an exception is raised in the guard block" do
|
93
93
|
guard = SpecifiedOnGuard.new :rubinius
|
94
|
-
SpecifiedOnGuard.stub
|
94
|
+
SpecifiedOnGuard.stub(:new).and_return(guard)
|
95
95
|
guard.should_receive(:match?).and_return(true)
|
96
96
|
guard.should_receive(:unregister)
|
97
97
|
|
@@ -4,18 +4,18 @@ require 'mspec/guards'
|
|
4
4
|
describe Object, "#as_superuser" do
|
5
5
|
before :each do
|
6
6
|
@guard = SuperUserGuard.new
|
7
|
-
SuperUserGuard.stub
|
7
|
+
SuperUserGuard.stub(:new).and_return(@guard)
|
8
8
|
ScratchPad.clear
|
9
9
|
end
|
10
10
|
|
11
11
|
it "does not yield when Process.euid is not 0" do
|
12
|
-
Process.stub
|
12
|
+
Process.stub(:euid).and_return(501)
|
13
13
|
as_superuser { ScratchPad.record :yield }
|
14
14
|
ScratchPad.recorded.should_not == :yield
|
15
15
|
end
|
16
16
|
|
17
17
|
it "yields when Process.euid is 0" do
|
18
|
-
Process.stub
|
18
|
+
Process.stub(:euid).and_return(0)
|
19
19
|
as_superuser { ScratchPad.record :yield }
|
20
20
|
ScratchPad.recorded.should == :yield
|
21
21
|
end
|
data/spec/guards/support_spec.rb
CHANGED
@@ -51,7 +51,7 @@ end
|
|
51
51
|
describe Object, "#not_supported_on" do
|
52
52
|
before :each do
|
53
53
|
@guard = SupportedGuard.new
|
54
|
-
SupportedGuard.stub
|
54
|
+
SupportedGuard.stub(:new).and_return(@guard)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "sets the name of the guard to :not_supported_on" do
|