mspec 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -6,7 +6,7 @@ require 'mspec/runner/tag'
|
|
6
6
|
|
7
7
|
describe TagAction, ".new" do
|
8
8
|
it "creates an MatchFilter with its tag and desc arguments" do
|
9
|
-
filter =
|
9
|
+
filter = double('action filter').as_null_object
|
10
10
|
MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
|
11
11
|
TagAction.new :add, :all, nil, nil, ["tag", "key"], ["some", "thing"]
|
12
12
|
end
|
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
describe TagAction, "#===" do
|
16
16
|
before :each do
|
17
|
-
MSpec.stub
|
17
|
+
MSpec.stub(:read_tags).and_return(["match"])
|
18
18
|
@action = TagAction.new :add, :fail, nil, nil, nil, ["catch", "if you"]
|
19
19
|
end
|
20
20
|
|
@@ -51,7 +51,7 @@ end
|
|
51
51
|
|
52
52
|
describe TagAction, "#outcome?" do
|
53
53
|
before :each do
|
54
|
-
MSpec.stub
|
54
|
+
MSpec.stub(:read_tags).and_return([])
|
55
55
|
@exception = ExceptionState.new nil, nil, Exception.new("failed")
|
56
56
|
end
|
57
57
|
|
@@ -106,11 +106,11 @@ end
|
|
106
106
|
|
107
107
|
describe TagAction, "#after when action is :add" do
|
108
108
|
before :each do
|
109
|
-
MSpec.stub
|
109
|
+
MSpec.stub(:read_tags).and_return([])
|
110
110
|
context = ContextState.new "Catch#me"
|
111
111
|
@state = ExampleState.new context, "if you can"
|
112
112
|
@tag = SpecTag.new "tag(comment):Catch#me if you can"
|
113
|
-
SpecTag.stub
|
113
|
+
SpecTag.stub(:new).and_return(@tag)
|
114
114
|
@exception = ExceptionState.new nil, nil, Exception.new("failed")
|
115
115
|
end
|
116
116
|
|
@@ -155,11 +155,11 @@ end
|
|
155
155
|
|
156
156
|
describe TagAction, "#after when action is :del" do
|
157
157
|
before :each do
|
158
|
-
MSpec.stub
|
158
|
+
MSpec.stub(:read_tags).and_return([])
|
159
159
|
context = ContextState.new "Catch#me"
|
160
160
|
@state = ExampleState.new context, "if you can"
|
161
161
|
@tag = SpecTag.new "tag(comment):Catch#me if you can"
|
162
|
-
SpecTag.stub
|
162
|
+
SpecTag.stub(:new).and_return(@tag)
|
163
163
|
@exception = ExceptionState.new nil, nil, Exception.new("failed")
|
164
164
|
end
|
165
165
|
|
@@ -207,8 +207,8 @@ describe TagAction, "#finish" do
|
|
207
207
|
$stdout = @out = IOStub.new
|
208
208
|
context = ContextState.new "Catch#me"
|
209
209
|
@state = ExampleState.new context, "if you can"
|
210
|
-
MSpec.stub
|
211
|
-
MSpec.stub
|
210
|
+
MSpec.stub(:write_tag).and_return(true)
|
211
|
+
MSpec.stub(:delete_tag).and_return(true)
|
212
212
|
end
|
213
213
|
|
214
214
|
after :each do
|
@@ -217,7 +217,7 @@ describe TagAction, "#finish" do
|
|
217
217
|
|
218
218
|
it "reports no specs tagged if none where tagged" do
|
219
219
|
action = TagAction.new :add, :fail, "tag", "comment", nil, "can"
|
220
|
-
action.stub
|
220
|
+
action.stub(:outcome?).and_return(false)
|
221
221
|
action.after @state
|
222
222
|
action.finish
|
223
223
|
@out.should == "\nTagAction: no specs were tagged with 'tag'\n"
|
@@ -225,7 +225,7 @@ describe TagAction, "#finish" do
|
|
225
225
|
|
226
226
|
it "reports no specs tagged if none where tagged" do
|
227
227
|
action = TagAction.new :del, :fail, "tag", "comment", nil, "can"
|
228
|
-
action.stub
|
228
|
+
action.stub(:outcome?).and_return(false)
|
229
229
|
action.after @state
|
230
230
|
action.finish
|
231
231
|
@out.should == "\nTagAction: no tags 'tag' were deleted\n"
|
@@ -233,7 +233,7 @@ describe TagAction, "#finish" do
|
|
233
233
|
|
234
234
|
it "reports the spec descriptions that were tagged" do
|
235
235
|
action = TagAction.new :add, :fail, "tag", "comment", nil, "can"
|
236
|
-
action.stub
|
236
|
+
action.stub(:outcome?).and_return(true)
|
237
237
|
action.after @state
|
238
238
|
action.finish
|
239
239
|
@out.should ==
|
@@ -246,7 +246,7 @@ Catch#me if you can
|
|
246
246
|
|
247
247
|
it "reports the spec descriptions for the tags that were deleted" do
|
248
248
|
action = TagAction.new :del, :fail, "tag", "comment", nil, "can"
|
249
|
-
action.stub
|
249
|
+
action.stub(:outcome?).and_return(true)
|
250
250
|
action.after @state
|
251
251
|
action.finish
|
252
252
|
@out.should ==
|
@@ -260,8 +260,8 @@ end
|
|
260
260
|
|
261
261
|
describe TagAction, "#register" do
|
262
262
|
before :each do
|
263
|
-
MSpec.stub
|
264
|
-
MSpec.stub
|
263
|
+
MSpec.stub(:register)
|
264
|
+
MSpec.stub(:read_tags).and_return([])
|
265
265
|
@action = TagAction.new :add, :all, nil, nil, nil, nil
|
266
266
|
end
|
267
267
|
|
@@ -288,8 +288,8 @@ end
|
|
288
288
|
|
289
289
|
describe TagAction, "#unregister" do
|
290
290
|
before :each do
|
291
|
-
MSpec.stub
|
292
|
-
MSpec.stub
|
291
|
+
MSpec.stub(:unregister)
|
292
|
+
MSpec.stub(:read_tags).and_return([])
|
293
293
|
@action = TagAction.new :add, :all, nil, nil, nil, nil
|
294
294
|
end
|
295
295
|
|
@@ -13,9 +13,9 @@ end
|
|
13
13
|
describe TagListAction, "#===" do
|
14
14
|
before :each do
|
15
15
|
tag = SpecTag.new "fails:description"
|
16
|
-
MSpec.stub
|
17
|
-
@filter =
|
18
|
-
MatchFilter.stub
|
16
|
+
MSpec.stub(:read_tags).and_return([tag])
|
17
|
+
@filter = double("MatchFilter").as_null_object
|
18
|
+
MatchFilter.stub(:new).and_return(@filter)
|
19
19
|
@action = TagListAction.new
|
20
20
|
@action.load
|
21
21
|
end
|
@@ -73,7 +73,7 @@ describe TagListAction, "#load" do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "does not create a MatchFilter if there are no matching tags" do
|
76
|
-
MSpec.stub
|
76
|
+
MSpec.stub(:read_tags).and_return([])
|
77
77
|
MatchFilter.should_not_receive(:new)
|
78
78
|
TagListAction.new(["fails"]).load
|
79
79
|
end
|
@@ -84,8 +84,8 @@ describe TagListAction, "#after" do
|
|
84
84
|
@stdout = $stdout
|
85
85
|
$stdout = IOStub.new
|
86
86
|
|
87
|
-
@state =
|
88
|
-
@state.stub
|
87
|
+
@state = double("ExampleState")
|
88
|
+
@state.stub(:description).and_return("str")
|
89
89
|
|
90
90
|
@action = TagListAction.new
|
91
91
|
end
|
@@ -109,7 +109,7 @@ end
|
|
109
109
|
|
110
110
|
describe TagListAction, "#register" do
|
111
111
|
before :each do
|
112
|
-
MSpec.stub
|
112
|
+
MSpec.stub(:register)
|
113
113
|
@action = TagListAction.new
|
114
114
|
end
|
115
115
|
|
@@ -131,7 +131,7 @@ end
|
|
131
131
|
|
132
132
|
describe TagListAction, "#unregister" do
|
133
133
|
before :each do
|
134
|
-
MSpec.stub
|
134
|
+
MSpec.stub(:unregister)
|
135
135
|
@action = TagListAction.new
|
136
136
|
end
|
137
137
|
|
@@ -36,8 +36,8 @@ end
|
|
36
36
|
|
37
37
|
describe TagPurgeAction, "#after" do
|
38
38
|
before :each do
|
39
|
-
@state =
|
40
|
-
@state.stub
|
39
|
+
@state = double("ExampleState")
|
40
|
+
@state.stub(:description).and_return("str")
|
41
41
|
|
42
42
|
@action = TagPurgeAction.new
|
43
43
|
end
|
@@ -64,11 +64,11 @@ describe TagPurgeAction, "#unload" do
|
|
64
64
|
@t2 = SpecTag.new "unstable:I'm unstable"
|
65
65
|
@t3 = SpecTag.new "fails:I'm unstable"
|
66
66
|
|
67
|
-
MSpec.stub
|
68
|
-
MSpec.stub
|
67
|
+
MSpec.stub(:read_tags).and_return([@t1, @t2, @t3])
|
68
|
+
MSpec.stub(:write_tags)
|
69
69
|
|
70
|
-
@state =
|
71
|
-
@state.stub
|
70
|
+
@state = double("ExampleState")
|
71
|
+
@state.stub(:description).and_return("I'm unstable")
|
72
72
|
|
73
73
|
@action = TagPurgeAction.new
|
74
74
|
@action.load
|
@@ -107,10 +107,10 @@ describe TagPurgeAction, "#unload" do
|
|
107
107
|
@stdout = $stdout
|
108
108
|
$stdout = IOStub.new
|
109
109
|
|
110
|
-
MSpec.stub
|
110
|
+
MSpec.stub(:read_tags).and_return([])
|
111
111
|
|
112
|
-
@state =
|
113
|
-
@state.stub
|
112
|
+
@state = double("ExampleState")
|
113
|
+
@state.stub(:description).and_return("I'm unstable")
|
114
114
|
|
115
115
|
@action = TagPurgeAction.new
|
116
116
|
@action.load
|
@@ -131,7 +131,7 @@ end
|
|
131
131
|
|
132
132
|
describe TagPurgeAction, "#register" do
|
133
133
|
before :each do
|
134
|
-
MSpec.stub
|
134
|
+
MSpec.stub(:register)
|
135
135
|
@action = TagPurgeAction.new
|
136
136
|
end
|
137
137
|
|
@@ -143,7 +143,7 @@ end
|
|
143
143
|
|
144
144
|
describe TagPurgeAction, "#unregister" do
|
145
145
|
before :each do
|
146
|
-
MSpec.stub
|
146
|
+
MSpec.stub(:unregister)
|
147
147
|
@action = TagPurgeAction.new
|
148
148
|
end
|
149
149
|
|
@@ -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
|
-
Time.stub
|
22
|
+
Time.stub(:now).and_return(Time.parse('Mon Mar 30 14:05:19 -0700 2009'))
|
23
23
|
@timer.start
|
24
|
-
Time.stub
|
24
|
+
Time.stub(:now).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
|
-
Time.stub
|
30
|
+
Time.stub(:now).and_return(Time.parse('Mon Mar 30 14:05:19 -0700 2009'))
|
31
31
|
@timer.start
|
32
|
-
Time.stub
|
32
|
+
Time.stub(:now).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
@@ -104,7 +104,7 @@ describe ContextState, "#it" do
|
|
104
104
|
it "calls registered :add actions" do
|
105
105
|
ExampleState.should_receive(:new).with(@state, "it", @proc).and_return(@ex)
|
106
106
|
|
107
|
-
add_action =
|
107
|
+
add_action = double("add")
|
108
108
|
add_action.should_receive(:add).with(@ex).and_return { ScratchPad.record :add }
|
109
109
|
MSpec.register :add, add_action
|
110
110
|
|
@@ -251,9 +251,9 @@ end
|
|
251
251
|
describe ContextState, "#parent=" do
|
252
252
|
before :each do
|
253
253
|
@state = ContextState.new ""
|
254
|
-
@parent =
|
255
|
-
@parent.stub
|
256
|
-
@parent.stub
|
254
|
+
@parent = double("describe")
|
255
|
+
@parent.stub(:parent).and_return(nil)
|
256
|
+
@parent.stub(:child)
|
257
257
|
end
|
258
258
|
|
259
259
|
it "does not set self as a child of parent if shared" do
|
@@ -282,9 +282,9 @@ end
|
|
282
282
|
describe ContextState, "#parent" do
|
283
283
|
before :each do
|
284
284
|
@state = ContextState.new ""
|
285
|
-
@parent =
|
286
|
-
@parent.stub
|
287
|
-
@parent.stub
|
285
|
+
@parent = double("describe")
|
286
|
+
@parent.stub(:parent).and_return(nil)
|
287
|
+
@parent.stub(:child)
|
288
288
|
end
|
289
289
|
|
290
290
|
it "returns nil if parent has not been set" do
|
@@ -301,9 +301,9 @@ describe ContextState, "#parents" do
|
|
301
301
|
before :each do
|
302
302
|
@first = ContextState.new ""
|
303
303
|
@second = ContextState.new ""
|
304
|
-
@parent =
|
305
|
-
@parent.stub
|
306
|
-
@parent.stub
|
304
|
+
@parent = double("describe")
|
305
|
+
@parent.stub(:parent).and_return(nil)
|
306
|
+
@parent.stub(:child)
|
307
307
|
end
|
308
308
|
|
309
309
|
it "returns a list of all enclosing ContextState instances" do
|
@@ -317,9 +317,9 @@ describe ContextState, "#child" do
|
|
317
317
|
before :each do
|
318
318
|
@first = ContextState.new ""
|
319
319
|
@second = ContextState.new ""
|
320
|
-
@parent =
|
321
|
-
@parent.stub
|
322
|
-
@parent.stub
|
320
|
+
@parent = double("describe")
|
321
|
+
@parent.stub(:parent).and_return(nil)
|
322
|
+
@parent.stub(:child)
|
323
323
|
end
|
324
324
|
|
325
325
|
it "adds the ContextState to the list of contained ContextStates" do
|
@@ -369,7 +369,7 @@ describe ContextState, "#process" do
|
|
369
369
|
before :each do
|
370
370
|
MSpec.store :before, []
|
371
371
|
MSpec.store :after, []
|
372
|
-
MSpec.stub
|
372
|
+
MSpec.stub(:register_current)
|
373
373
|
|
374
374
|
@state = ContextState.new ""
|
375
375
|
@state.describe { }
|
@@ -405,7 +405,7 @@ describe ContextState, "#process" do
|
|
405
405
|
it "does not call the #it block if #filtered? returns true" do
|
406
406
|
@state.it("one", &@a)
|
407
407
|
@state.it("two", &@b)
|
408
|
-
@state.examples.first.stub
|
408
|
+
@state.examples.first.stub(:filtered?).and_return(true)
|
409
409
|
@state.process
|
410
410
|
ScratchPad.recorded.should == [:b]
|
411
411
|
end
|
@@ -510,7 +510,7 @@ describe ContextState, "#process" do
|
|
510
510
|
@state = ContextState.new ""
|
511
511
|
@state.describe { }
|
512
512
|
|
513
|
-
action =
|
513
|
+
action = double("action")
|
514
514
|
def action.exception(exc)
|
515
515
|
ScratchPad.record :exception if exc.exception.is_a? SpecExpectationNotFoundError
|
516
516
|
end
|
@@ -550,7 +550,7 @@ describe ContextState, "#process" do
|
|
550
550
|
@state = ContextState.new ""
|
551
551
|
@state.describe { }
|
552
552
|
|
553
|
-
example =
|
553
|
+
example = double("example")
|
554
554
|
def example.example(state, spec)
|
555
555
|
ScratchPad << state << spec
|
556
556
|
end
|
@@ -594,7 +594,7 @@ describe ContextState, "#process" do
|
|
594
594
|
end
|
595
595
|
|
596
596
|
it "calls registered :before actions with the current ExampleState instance" do
|
597
|
-
before =
|
597
|
+
before = double("before")
|
598
598
|
before.should_receive(:before).and_return {
|
599
599
|
ScratchPad.record :before
|
600
600
|
@spec_state = @state.state
|
@@ -606,7 +606,7 @@ describe ContextState, "#process" do
|
|
606
606
|
end
|
607
607
|
|
608
608
|
it "calls registered :after actions with the current ExampleState instance" do
|
609
|
-
after =
|
609
|
+
after = double("after")
|
610
610
|
after.should_receive(:after).and_return {
|
611
611
|
ScratchPad.record :after
|
612
612
|
@spec_state = @state.state
|
@@ -634,7 +634,7 @@ describe ContextState, "#process" do
|
|
634
634
|
end
|
635
635
|
|
636
636
|
it "calls registered :enter actions with the current #describe string" do
|
637
|
-
enter =
|
637
|
+
enter = double("enter")
|
638
638
|
enter.should_receive(:enter).with("C#m").and_return { ScratchPad.record :enter }
|
639
639
|
MSpec.register :enter, enter
|
640
640
|
@state.process
|
@@ -642,7 +642,7 @@ describe ContextState, "#process" do
|
|
642
642
|
end
|
643
643
|
|
644
644
|
it "calls registered :leave actions" do
|
645
|
-
leave =
|
645
|
+
leave = double("leave")
|
646
646
|
leave.should_receive(:leave).and_return { ScratchPad.record :leave }
|
647
647
|
MSpec.register :leave, leave
|
648
648
|
@state.process
|
@@ -775,7 +775,7 @@ describe ContextState, "#process in pretend mode" do
|
|
775
775
|
end
|
776
776
|
|
777
777
|
it "calls registered :before actions with the current ExampleState instance" do
|
778
|
-
before =
|
778
|
+
before = double("before")
|
779
779
|
before.should_receive(:before).and_return {
|
780
780
|
ScratchPad.record :before
|
781
781
|
@spec_state = @state.state
|
@@ -787,7 +787,7 @@ describe ContextState, "#process in pretend mode" do
|
|
787
787
|
end
|
788
788
|
|
789
789
|
it "calls registered :after actions with the current ExampleState instance" do
|
790
|
-
after =
|
790
|
+
after = double("after")
|
791
791
|
after.should_receive(:after).and_return {
|
792
792
|
ScratchPad.record :after
|
793
793
|
@spec_state = @state.state
|
@@ -898,7 +898,7 @@ describe ContextState, "#process in pretend mode" do
|
|
898
898
|
end
|
899
899
|
|
900
900
|
it "calls registered :enter actions with the current #describe string" do
|
901
|
-
enter =
|
901
|
+
enter = double("enter")
|
902
902
|
enter.should_receive(:enter).and_return { ScratchPad.record :enter }
|
903
903
|
MSpec.register :enter, enter
|
904
904
|
@state.process
|
@@ -906,7 +906,7 @@ describe ContextState, "#process in pretend mode" do
|
|
906
906
|
end
|
907
907
|
|
908
908
|
it "calls registered :leave actions" do
|
909
|
-
leave =
|
909
|
+
leave = double("leave")
|
910
910
|
leave.should_receive(:leave).and_return { ScratchPad.record :leave }
|
911
911
|
MSpec.register :leave, leave
|
912
912
|
@state.process
|
@@ -918,7 +918,7 @@ describe ContextState, "#it_should_behave_like" do
|
|
918
918
|
before :each do
|
919
919
|
@shared_desc = :shared_context
|
920
920
|
@shared = ContextState.new(@shared_desc, :shared => true)
|
921
|
-
MSpec.stub
|
921
|
+
MSpec.stub(:retrieve_shared).and_return(@shared)
|
922
922
|
|
923
923
|
@state = ContextState.new "Top level"
|
924
924
|
@a = lambda {|*| }
|
@@ -938,7 +938,7 @@ describe ContextState, "#it_should_behave_like" do
|
|
938
938
|
@shared.children << @nested
|
939
939
|
|
940
940
|
@nested_dup = @nested.dup
|
941
|
-
@nested.stub
|
941
|
+
@nested.stub(:dup).and_return(@nested_dup)
|
942
942
|
end
|
943
943
|
|
944
944
|
it "duplicates the nested ContextState" do
|
@@ -972,7 +972,7 @@ describe ContextState, "#it_should_behave_like" do
|
|
972
972
|
it "adds duped examples from the shared ContextState" do
|
973
973
|
@shared.it "some method", &@a
|
974
974
|
ex_dup = @shared.examples.first.dup
|
975
|
-
@shared.examples.first.stub
|
975
|
+
@shared.examples.first.stub(:dup).and_return(ex_dup)
|
976
976
|
|
977
977
|
@state.it_should_behave_like @shared_desc
|
978
978
|
@state.examples.should == [ex_dup]
|
@@ -1022,20 +1022,20 @@ describe ContextState, "#filter_examples" do
|
|
1022
1022
|
end
|
1023
1023
|
|
1024
1024
|
it "removes examples that are filtered" do
|
1025
|
-
@state.examples.first.stub
|
1025
|
+
@state.examples.first.stub(:filtered?).and_return(true)
|
1026
1026
|
@state.examples.size.should == 2
|
1027
1027
|
@state.filter_examples
|
1028
1028
|
@state.examples.size.should == 1
|
1029
1029
|
end
|
1030
1030
|
|
1031
1031
|
it "returns true if there are remaining examples to evaluate" do
|
1032
|
-
@state.examples.first.stub
|
1032
|
+
@state.examples.first.stub(:filtered?).and_return(true)
|
1033
1033
|
@state.filter_examples.should be_true
|
1034
1034
|
end
|
1035
1035
|
|
1036
1036
|
it "returns false if there are no remaining examples to evaluate" do
|
1037
|
-
@state.examples.first.stub
|
1038
|
-
@state.examples.last.stub
|
1037
|
+
@state.examples.first.stub(:filtered?).and_return(true)
|
1038
|
+
@state.examples.last.stub(:filtered?).and_return(true)
|
1039
1039
|
@state.filter_examples.should be_false
|
1040
1040
|
end
|
1041
1041
|
end
|