mspec 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mspec/matchers.rb +1 -0
- data/lib/mspec/matchers/block_caller.rb +34 -0
- data/lib/mspec/runner/actions/timer.rb +6 -2
- data/lib/mspec/runner/context.rb +1 -1
- data/lib/mspec/version.rb +1 -1
- data/spec/commands/mspec_spec.rb +2 -2
- data/spec/commands/mspec_tag_spec.rb +3 -3
- data/spec/guards/background_spec.rb +1 -1
- data/spec/guards/feature_spec.rb +4 -4
- data/spec/guards/guard_spec.rb +2 -2
- data/spec/helpers/fs_spec.rb +12 -12
- data/spec/helpers/numeric_spec.rb +1 -1
- data/spec/matchers/be_an_instance_of_spec.rb +6 -6
- data/spec/matchers/be_computed_by_function_spec.rb +4 -4
- data/spec/matchers/be_computed_by_spec.rb +5 -5
- data/spec/matchers/be_valid_dns_name_spec.rb +8 -8
- data/spec/matchers/block_caller_spec.rb +13 -0
- data/spec/matchers/equal_element_spec.rb +32 -32
- data/spec/matchers/have_class_variable_spec.rb +4 -4
- data/spec/matchers/have_constant_spec.rb +2 -2
- data/spec/matchers/have_data_spec.rb +4 -4
- data/spec/matchers/have_instance_method_spec.rb +4 -4
- data/spec/matchers/have_instance_variable_spec.rb +4 -4
- data/spec/matchers/have_method_spec.rb +6 -6
- data/spec/matchers/have_private_instance_method_spec.rb +4 -4
- data/spec/matchers/have_private_method_spec.rb +2 -2
- data/spec/matchers/have_protected_instance_method_spec.rb +4 -4
- data/spec/matchers/have_public_instance_method_spec.rb +4 -4
- data/spec/matchers/have_singleton_method_spec.rb +2 -2
- data/spec/mocks/mock_spec.rb +5 -5
- data/spec/mocks/proxy_spec.rb +8 -8
- data/spec/runner/actions/tag_spec.rb +7 -7
- data/spec/runner/actions/taglist_spec.rb +3 -3
- data/spec/runner/actions/timer_spec.rb +4 -4
- data/spec/runner/context_spec.rb +17 -17
- data/spec/runner/exception_spec.rb +3 -3
- data/spec/runner/formatters/dotted_spec.rb +15 -15
- data/spec/runner/formatters/file_spec.rb +4 -4
- data/spec/runner/formatters/specdoc_spec.rb +2 -2
- data/spec/runner/mspec_spec.rb +19 -15
- data/spec/utils/options_spec.rb +9 -11
- metadata +6 -3
@@ -6,7 +6,7 @@ require 'mspec/runner/tag'
|
|
6
6
|
|
7
7
|
describe TagListAction, "#include?" do
|
8
8
|
it "returns true" do
|
9
|
-
TagListAction.new.include?(:anything).should
|
9
|
+
TagListAction.new.include?(:anything).should be_truthy
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -22,12 +22,12 @@ describe TagListAction, "#===" do
|
|
22
22
|
|
23
23
|
it "returns true if filter === string returns true" do
|
24
24
|
@filter.should_receive(:===).with("str").and_return(true)
|
25
|
-
@action.===("str").should
|
25
|
+
@action.===("str").should be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it "returns false if filter === string returns false" do
|
29
29
|
@filter.should_receive(:===).with("str").and_return(false)
|
30
|
-
@action.===("str").should
|
30
|
+
@action.===("str").should be_falsey
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -19,17 +19,17 @@ describe TimerAction do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "responds to #elapsed by returning the difference between stop and start" do
|
22
|
-
|
22
|
+
@timer.stub(:current_time).and_return(Time.parse('Mon Mar 30 14:05:19 -0700 2009'))
|
23
23
|
@timer.start
|
24
|
-
|
24
|
+
@timer.stub(:current_time).and_return(Time.parse('Mon Mar 30 14:05:52 -0700 2009'))
|
25
25
|
@timer.finish
|
26
26
|
@timer.elapsed.should == 33
|
27
27
|
end
|
28
28
|
|
29
29
|
it "responds to #format by returning a readable string of elapsed time" do
|
30
|
-
|
30
|
+
@timer.stub(:current_time).and_return(Time.parse('Mon Mar 30 14:05:19 -0700 2009'))
|
31
31
|
@timer.start
|
32
|
-
|
32
|
+
@timer.stub(:current_time).and_return(Time.parse('Mon Mar 30 14:05:52 -0700 2009'))
|
33
33
|
@timer.finish
|
34
34
|
@timer.format.should == "Finished in 33.000000 seconds"
|
35
35
|
end
|
data/spec/runner/context_spec.rb
CHANGED
@@ -39,11 +39,11 @@ end
|
|
39
39
|
|
40
40
|
describe ContextState, "#shared?" do
|
41
41
|
it "returns false when the ContextState is not shared" do
|
42
|
-
ContextState.new("").shared?.should
|
42
|
+
ContextState.new("").shared?.should be_falsey
|
43
43
|
end
|
44
44
|
|
45
45
|
it "returns true when the ContextState is shared" do
|
46
|
-
ContextState.new("", {:shared => true}).shared?.should
|
46
|
+
ContextState.new("", {:shared => true}).shared?.should be_truthy
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -105,7 +105,7 @@ describe ContextState, "#it" do
|
|
105
105
|
ExampleState.should_receive(:new).with(@state, "it", @proc).and_return(@ex)
|
106
106
|
|
107
107
|
add_action = double("add")
|
108
|
-
add_action.should_receive(:add)
|
108
|
+
add_action.should_receive(:add) { ScratchPad.record :add }.with(@ex)
|
109
109
|
MSpec.register :add, add_action
|
110
110
|
|
111
111
|
@state.it("it", &@proc)
|
@@ -224,7 +224,7 @@ describe ContextState, "#protect" do
|
|
224
224
|
|
225
225
|
it "returns true and does execute any blocks if check and MSpec.mode?(:pretend) are true" do
|
226
226
|
MSpec.should_receive(:mode?).with(:pretend).and_return(true)
|
227
|
-
ContextState.new("").protect("message", [@a, @b]).should
|
227
|
+
ContextState.new("").protect("message", [@a, @b]).should be_truthy
|
228
228
|
ScratchPad.recorded.should == []
|
229
229
|
end
|
230
230
|
|
@@ -240,11 +240,11 @@ describe ContextState, "#protect" do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
it "returns true if none of the blocks raise an exception" do
|
243
|
-
ContextState.new("").protect("message", [@a, @b]).should
|
243
|
+
ContextState.new("").protect("message", [@a, @b]).should be_truthy
|
244
244
|
end
|
245
245
|
|
246
246
|
it "returns false if any of the blocks raise an exception" do
|
247
|
-
ContextState.new("").protect("message", [@a, @c, @b]).should
|
247
|
+
ContextState.new("").protect("message", [@a, @c, @b]).should be_falsey
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
@@ -460,7 +460,7 @@ describe ContextState, "#process" do
|
|
460
460
|
MSpec.should_receive(:clear_expectations)
|
461
461
|
@state.it("it") { ScratchPad.record MSpec.expectation? }
|
462
462
|
@state.process
|
463
|
-
ScratchPad.recorded.should
|
463
|
+
ScratchPad.recorded.should be_falsey
|
464
464
|
end
|
465
465
|
|
466
466
|
it "shuffles the spec list if MSpec.randomize? is true" do
|
@@ -595,7 +595,7 @@ describe ContextState, "#process" do
|
|
595
595
|
|
596
596
|
it "calls registered :before actions with the current ExampleState instance" do
|
597
597
|
before = double("before")
|
598
|
-
before.should_receive(:before)
|
598
|
+
before.should_receive(:before) {
|
599
599
|
ScratchPad.record :before
|
600
600
|
@spec_state = @state.state
|
601
601
|
}
|
@@ -607,7 +607,7 @@ describe ContextState, "#process" do
|
|
607
607
|
|
608
608
|
it "calls registered :after actions with the current ExampleState instance" do
|
609
609
|
after = double("after")
|
610
|
-
after.should_receive(:after)
|
610
|
+
after.should_receive(:after) {
|
611
611
|
ScratchPad.record :after
|
612
612
|
@spec_state = @state.state
|
613
613
|
}
|
@@ -635,7 +635,7 @@ describe ContextState, "#process" do
|
|
635
635
|
|
636
636
|
it "calls registered :enter actions with the current #describe string" do
|
637
637
|
enter = double("enter")
|
638
|
-
enter.should_receive(:enter)
|
638
|
+
enter.should_receive(:enter) { ScratchPad.record :enter }.with("C#m")
|
639
639
|
MSpec.register :enter, enter
|
640
640
|
@state.process
|
641
641
|
ScratchPad.recorded.should == :enter
|
@@ -643,7 +643,7 @@ describe ContextState, "#process" do
|
|
643
643
|
|
644
644
|
it "calls registered :leave actions" do
|
645
645
|
leave = double("leave")
|
646
|
-
leave.should_receive(:leave)
|
646
|
+
leave.should_receive(:leave) { ScratchPad.record :leave }
|
647
647
|
MSpec.register :leave, leave
|
648
648
|
@state.process
|
649
649
|
ScratchPad.recorded.should == :leave
|
@@ -776,7 +776,7 @@ describe ContextState, "#process in pretend mode" do
|
|
776
776
|
|
777
777
|
it "calls registered :before actions with the current ExampleState instance" do
|
778
778
|
before = double("before")
|
779
|
-
before.should_receive(:before)
|
779
|
+
before.should_receive(:before) {
|
780
780
|
ScratchPad.record :before
|
781
781
|
@spec_state = @state.state
|
782
782
|
}
|
@@ -788,7 +788,7 @@ describe ContextState, "#process in pretend mode" do
|
|
788
788
|
|
789
789
|
it "calls registered :after actions with the current ExampleState instance" do
|
790
790
|
after = double("after")
|
791
|
-
after.should_receive(:after)
|
791
|
+
after.should_receive(:after) {
|
792
792
|
ScratchPad.record :after
|
793
793
|
@spec_state = @state.state
|
794
794
|
}
|
@@ -899,7 +899,7 @@ describe ContextState, "#process in pretend mode" do
|
|
899
899
|
|
900
900
|
it "calls registered :enter actions with the current #describe string" do
|
901
901
|
enter = double("enter")
|
902
|
-
enter.should_receive(:enter)
|
902
|
+
enter.should_receive(:enter) { ScratchPad.record :enter }
|
903
903
|
MSpec.register :enter, enter
|
904
904
|
@state.process
|
905
905
|
ScratchPad.recorded.should == :enter
|
@@ -907,7 +907,7 @@ describe ContextState, "#process in pretend mode" do
|
|
907
907
|
|
908
908
|
it "calls registered :leave actions" do
|
909
909
|
leave = double("leave")
|
910
|
-
leave.should_receive(:leave)
|
910
|
+
leave.should_receive(:leave) { ScratchPad.record :leave }
|
911
911
|
MSpec.register :leave, leave
|
912
912
|
@state.process
|
913
913
|
ScratchPad.recorded.should == :leave
|
@@ -1030,12 +1030,12 @@ describe ContextState, "#filter_examples" do
|
|
1030
1030
|
|
1031
1031
|
it "returns true if there are remaining examples to evaluate" do
|
1032
1032
|
@state.examples.first.stub(:filtered?).and_return(true)
|
1033
|
-
@state.filter_examples.should
|
1033
|
+
@state.filter_examples.should be_truthy
|
1034
1034
|
end
|
1035
1035
|
|
1036
1036
|
it "returns false if there are no remaining examples to evaluate" do
|
1037
1037
|
@state.examples.first.stub(:filtered?).and_return(true)
|
1038
1038
|
@state.examples.last.stub(:filtered?).and_return(true)
|
1039
|
-
@state.filter_examples.should
|
1039
|
+
@state.filter_examples.should be_falsey
|
1040
1040
|
end
|
1041
1041
|
end
|
@@ -72,17 +72,17 @@ describe ExceptionState, "#failure?" do
|
|
72
72
|
|
73
73
|
it "returns true if the exception is an SpecExpectationNotMetError" do
|
74
74
|
exc = ExceptionState.new @state, "", SpecExpectationNotMetError.new("Fail!")
|
75
|
-
exc.failure?.should
|
75
|
+
exc.failure?.should be_truthy
|
76
76
|
end
|
77
77
|
|
78
78
|
it "returns true if the exception is an SpecExpectationNotFoundError" do
|
79
79
|
exc = ExceptionState.new @state, "", SpecExpectationNotFoundError.new("Fail!")
|
80
|
-
exc.failure?.should
|
80
|
+
exc.failure?.should be_truthy
|
81
81
|
end
|
82
82
|
|
83
83
|
it "returns false if the exception is not an SpecExpectationNotMetError or an SpecExpectationNotFoundError" do
|
84
84
|
exc = ExceptionState.new @state, "", Exception.new("Fail!")
|
85
|
-
exc.failure?.should
|
85
|
+
exc.failure?.should be_falsey
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -85,16 +85,16 @@ describe DottedFormatter, "#exception" do
|
|
85
85
|
|
86
86
|
it "sets the #failure? flag" do
|
87
87
|
@formatter.exception @failure
|
88
|
-
@formatter.failure?.should
|
88
|
+
@formatter.failure?.should be_truthy
|
89
89
|
@formatter.exception @error
|
90
|
-
@formatter.failure?.should
|
90
|
+
@formatter.failure?.should be_falsey
|
91
91
|
end
|
92
92
|
|
93
93
|
it "sets the #exception? flag" do
|
94
94
|
@formatter.exception @error
|
95
|
-
@formatter.exception?.should
|
95
|
+
@formatter.exception?.should be_truthy
|
96
96
|
@formatter.exception @failure
|
97
|
-
@formatter.exception?.should
|
97
|
+
@formatter.exception?.should be_truthy
|
98
98
|
end
|
99
99
|
|
100
100
|
it "addes the exception to the list of exceptions" do
|
@@ -113,25 +113,25 @@ describe DottedFormatter, "#exception?" do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
it "returns false if there have been no exceptions" do
|
116
|
-
@formatter.exception?.should
|
116
|
+
@formatter.exception?.should be_falsey
|
117
117
|
end
|
118
118
|
|
119
119
|
it "returns true if any exceptions are errors" do
|
120
120
|
@formatter.exception @failure
|
121
121
|
@formatter.exception @error
|
122
|
-
@formatter.exception?.should
|
122
|
+
@formatter.exception?.should be_truthy
|
123
123
|
end
|
124
124
|
|
125
125
|
it "returns true if all exceptions are failures" do
|
126
126
|
@formatter.exception @failure
|
127
127
|
@formatter.exception @failure
|
128
|
-
@formatter.exception?.should
|
128
|
+
@formatter.exception?.should be_truthy
|
129
129
|
end
|
130
130
|
|
131
131
|
it "returns true if all exceptions are errors" do
|
132
132
|
@formatter.exception @error
|
133
133
|
@formatter.exception @error
|
134
|
-
@formatter.exception?.should
|
134
|
+
@formatter.exception?.should be_truthy
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -143,19 +143,19 @@ describe DottedFormatter, "#failure?" do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "returns false if there have been no exceptions" do
|
146
|
-
@formatter.failure?.should
|
146
|
+
@formatter.failure?.should be_falsey
|
147
147
|
end
|
148
148
|
|
149
149
|
it "returns false if any exceptions are errors" do
|
150
150
|
@formatter.exception @failure
|
151
151
|
@formatter.exception @error
|
152
|
-
@formatter.failure?.should
|
152
|
+
@formatter.failure?.should be_falsey
|
153
153
|
end
|
154
154
|
|
155
155
|
it "returns true if all exceptions are failures" do
|
156
156
|
@formatter.exception @failure
|
157
157
|
@formatter.exception @failure
|
158
|
-
@formatter.failure?.should
|
158
|
+
@formatter.failure?.should be_truthy
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -167,15 +167,15 @@ describe DottedFormatter, "#before" do
|
|
167
167
|
end
|
168
168
|
|
169
169
|
it "resets the #failure? flag to false" do
|
170
|
-
@formatter.failure?.should
|
170
|
+
@formatter.failure?.should be_truthy
|
171
171
|
@formatter.before @state
|
172
|
-
@formatter.failure?.should
|
172
|
+
@formatter.failure?.should be_falsey
|
173
173
|
end
|
174
174
|
|
175
175
|
it "resets the #exception? flag to false" do
|
176
|
-
@formatter.exception?.should
|
176
|
+
@formatter.exception?.should be_truthy
|
177
177
|
@formatter.before @state
|
178
|
-
@formatter.exception?.should
|
178
|
+
@formatter.exception?.should be_falsey
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -31,15 +31,15 @@ describe FileFormatter, "#load" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "resets the #failure? flag to false" do
|
34
|
-
@formatter.failure?.should
|
34
|
+
@formatter.failure?.should be_truthy
|
35
35
|
@formatter.load @state
|
36
|
-
@formatter.failure?.should
|
36
|
+
@formatter.failure?.should be_falsey
|
37
37
|
end
|
38
38
|
|
39
39
|
it "resets the #exception? flag to false" do
|
40
|
-
@formatter.exception?.should
|
40
|
+
@formatter.exception?.should be_truthy
|
41
41
|
@formatter.load @state
|
42
|
-
@formatter.exception?.should
|
42
|
+
@formatter.exception?.should be_falsey
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -49,9 +49,9 @@ describe SpecdocFormatter, "#before" do
|
|
49
49
|
it "resets the #exception? flag" do
|
50
50
|
exc = ExceptionState.new @state, nil, SpecExpectationNotMetError.new("disappointing")
|
51
51
|
@formatter.exception exc
|
52
|
-
@formatter.exception?.should
|
52
|
+
@formatter.exception?.should be_truthy
|
53
53
|
@formatter.before @state
|
54
|
-
@formatter.exception?.should
|
54
|
+
@formatter.exception?.should be_falsey
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/spec/runner/mspec_spec.rb
CHANGED
@@ -103,11 +103,11 @@ describe MSpec, ".protect" do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it "returns true if no exception is raised" do
|
106
|
-
MSpec.protect("passed") { 1 }.should
|
106
|
+
MSpec.protect("passed") { 1 }.should be_truthy
|
107
107
|
end
|
108
108
|
|
109
109
|
it "returns false if an exception is raised" do
|
110
|
-
MSpec.protect("testing") { raise ScratchPad.recorded }.should
|
110
|
+
MSpec.protect("testing") { raise ScratchPad.recorded }.should be_falsey
|
111
111
|
end
|
112
112
|
|
113
113
|
it "rescues any exceptions raised when evaluating the block argument" do
|
@@ -184,9 +184,9 @@ describe MSpec, ".actions" do
|
|
184
184
|
MSpec.store :start, []
|
185
185
|
ScratchPad.record []
|
186
186
|
start_one = double("one")
|
187
|
-
start_one.stub(:start)
|
187
|
+
start_one.stub(:start) { ScratchPad << :one }
|
188
188
|
start_two = double("two")
|
189
|
-
start_two.stub(:start)
|
189
|
+
start_two.stub(:start) { ScratchPad << :two }
|
190
190
|
MSpec.register :start, start_one
|
191
191
|
MSpec.register :start, start_two
|
192
192
|
end
|
@@ -286,7 +286,11 @@ describe MSpec, ".describe" do
|
|
286
286
|
|
287
287
|
it "invokes the ContextState#describe method" do
|
288
288
|
prc = lambda { }
|
289
|
-
|
289
|
+
|
290
|
+
@cs.should_receive(:describe) do |&block|
|
291
|
+
block.should == prc
|
292
|
+
end
|
293
|
+
|
290
294
|
MSpec.describe(Object, "msg", &prc)
|
291
295
|
end
|
292
296
|
end
|
@@ -300,7 +304,7 @@ describe MSpec, ".process" do
|
|
300
304
|
|
301
305
|
it "calls all start actions" do
|
302
306
|
start = double("start")
|
303
|
-
start.stub(:start)
|
307
|
+
start.stub(:start) { ScratchPad.record :start }
|
304
308
|
MSpec.register :start, start
|
305
309
|
MSpec.process
|
306
310
|
ScratchPad.recorded.should == :start
|
@@ -308,7 +312,7 @@ describe MSpec, ".process" do
|
|
308
312
|
|
309
313
|
it "calls all finish actions" do
|
310
314
|
finish = double("finish")
|
311
|
-
finish.stub(:finish)
|
315
|
+
finish.stub(:finish) { ScratchPad.record :finish }
|
312
316
|
MSpec.register :finish, finish
|
313
317
|
MSpec.process
|
314
318
|
ScratchPad.recorded.should == :finish
|
@@ -330,7 +334,7 @@ describe MSpec, ".files" do
|
|
330
334
|
|
331
335
|
it "calls load actions before each file" do
|
332
336
|
load = double("load")
|
333
|
-
load.stub(:load)
|
337
|
+
load.stub(:load) { ScratchPad.record :load }
|
334
338
|
MSpec.register :load, load
|
335
339
|
MSpec.files
|
336
340
|
ScratchPad.recorded.should == :load
|
@@ -535,37 +539,37 @@ describe MSpec, ".delete_tags" do
|
|
535
539
|
|
536
540
|
it "deletes the tag file" do
|
537
541
|
MSpec.delete_tags
|
538
|
-
File.exist?(@tags).should
|
542
|
+
File.exist?(@tags).should be_falsey
|
539
543
|
end
|
540
544
|
end
|
541
545
|
|
542
546
|
describe MSpec, ".expectation" do
|
543
547
|
it "sets the flag that an expectation has been reported" do
|
544
548
|
MSpec.clear_expectations
|
545
|
-
MSpec.expectation?.should
|
549
|
+
MSpec.expectation?.should be_falsey
|
546
550
|
MSpec.expectation
|
547
|
-
MSpec.expectation?.should
|
551
|
+
MSpec.expectation?.should be_truthy
|
548
552
|
end
|
549
553
|
end
|
550
554
|
|
551
555
|
describe MSpec, ".expectation?" do
|
552
556
|
it "returns true if an expectation has been reported" do
|
553
557
|
MSpec.expectation
|
554
|
-
MSpec.expectation?.should
|
558
|
+
MSpec.expectation?.should be_truthy
|
555
559
|
end
|
556
560
|
|
557
561
|
it "returns false if an expectation has not been reported" do
|
558
562
|
MSpec.clear_expectations
|
559
|
-
MSpec.expectation?.should
|
563
|
+
MSpec.expectation?.should be_falsey
|
560
564
|
end
|
561
565
|
end
|
562
566
|
|
563
567
|
describe MSpec, ".clear_expectations" do
|
564
568
|
it "clears the flag that an expectation has been reported" do
|
565
569
|
MSpec.expectation
|
566
|
-
MSpec.expectation?.should
|
570
|
+
MSpec.expectation?.should be_truthy
|
567
571
|
MSpec.clear_expectations
|
568
|
-
MSpec.expectation?.should
|
572
|
+
MSpec.expectation?.should be_falsey
|
569
573
|
end
|
570
574
|
end
|
571
575
|
|
data/spec/utils/options_spec.rb
CHANGED
@@ -33,11 +33,11 @@ end
|
|
33
33
|
|
34
34
|
describe MSpecOption, "#arg?" do
|
35
35
|
it "returns true if arg attribute is not nil" do
|
36
|
-
MSpecOption.new(nil, nil, "ARG", nil, nil).arg?.should
|
36
|
+
MSpecOption.new(nil, nil, "ARG", nil, nil).arg?.should be_truthy
|
37
37
|
end
|
38
38
|
|
39
39
|
it "returns false if arg attribute is nil" do
|
40
|
-
MSpecOption.new(nil, nil, nil, nil, nil).arg?.should
|
40
|
+
MSpecOption.new(nil, nil, nil, nil, nil).arg?.should be_falsey
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -47,16 +47,16 @@ describe MSpecOption, "#match?" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "returns true if the argument matches the short option" do
|
50
|
-
@opt.match?("-a").should
|
50
|
+
@opt.match?("-a").should be_truthy
|
51
51
|
end
|
52
52
|
|
53
53
|
it "returns true if the argument matches the long option" do
|
54
|
-
@opt.match?("--bdc").should
|
54
|
+
@opt.match?("--bdc").should be_truthy
|
55
55
|
end
|
56
56
|
|
57
57
|
it "returns false if the argument matches neither the short nor long option" do
|
58
|
-
@opt.match?("-b").should
|
59
|
-
@opt.match?("-abdc").should
|
58
|
+
@opt.match?("-b").should be_falsey
|
59
|
+
@opt.match?("-abdc").should be_falsey
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -1227,11 +1227,9 @@ describe "The -O, --report option" do
|
|
1227
1227
|
end
|
1228
1228
|
|
1229
1229
|
describe "The --report-on GUARD option" do
|
1230
|
-
before :
|
1230
|
+
before :each do
|
1231
1231
|
MSpec.stub(:register_mode)
|
1232
|
-
end
|
1233
1232
|
|
1234
|
-
before :each do
|
1235
1233
|
@options, @config = new_option
|
1236
1234
|
@options.verify
|
1237
1235
|
|
@@ -1327,9 +1325,9 @@ describe "The -d, --debug option" do
|
|
1327
1325
|
|
1328
1326
|
it "sets $MSPEC_DEBUG to true" do
|
1329
1327
|
["-d", "--debug"].each do |opt|
|
1330
|
-
$MSPEC_DEBUG.should_not
|
1328
|
+
$MSPEC_DEBUG.should_not be_truthy
|
1331
1329
|
@options.parse opt
|
1332
|
-
$MSPEC_DEBUG.should
|
1330
|
+
$MSPEC_DEBUG.should be_truthy
|
1333
1331
|
$MSPEC_DEBUG = nil
|
1334
1332
|
end
|
1335
1333
|
end
|