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
data/spec/runner/example_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require 'mspec/runner/filters/profile'
|
|
5
5
|
describe ProfileFilter, "#find" do
|
6
6
|
before :each do
|
7
7
|
@filter = ProfileFilter.new nil
|
8
|
-
File.stub
|
8
|
+
File.stub(:exist?).and_return(false)
|
9
9
|
@file = "rails.yaml"
|
10
10
|
end
|
11
11
|
|
@@ -79,7 +79,7 @@ end
|
|
79
79
|
describe ProfileFilter, "#===" do
|
80
80
|
before :each do
|
81
81
|
@filter = ProfileFilter.new nil
|
82
|
-
@filter.stub
|
82
|
+
@filter.stub(:load).and_return({ "A#" => ["[]=", "a", "a!", "a?", "aa="]})
|
83
83
|
@filter.send :initialize, nil
|
84
84
|
end
|
85
85
|
|
@@ -5,11 +5,11 @@ require 'mspec/runner/filters/tag'
|
|
5
5
|
|
6
6
|
describe TagFilter, "#load" do
|
7
7
|
before :each do
|
8
|
-
@match =
|
8
|
+
@match = double("match filter").as_null_object
|
9
9
|
@filter = TagFilter.new :include, "tag", "key"
|
10
10
|
@tag = SpecTag.new "tag(comment):description"
|
11
|
-
MSpec.stub
|
12
|
-
MSpec.stub
|
11
|
+
MSpec.stub(:read_tags).and_return([@tag])
|
12
|
+
MSpec.stub(:register)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "loads tags from the tag file" do
|
@@ -46,13 +46,13 @@ describe TagFilter, "#unload" do
|
|
46
46
|
before :each do
|
47
47
|
@filter = TagFilter.new :include, "tag", "key"
|
48
48
|
@tag = SpecTag.new "tag(comment):description"
|
49
|
-
MSpec.stub
|
49
|
+
MSpec.stub(:read_tags).and_return([@tag])
|
50
50
|
end
|
51
51
|
|
52
52
|
it "unregisters the MatchFilter if one was registered" do
|
53
|
-
match =
|
53
|
+
match = double("match filter").as_null_object
|
54
54
|
match.should_receive(:unregister)
|
55
|
-
MatchFilter.stub
|
55
|
+
MatchFilter.stub(:new).with(:include, "description").and_return(match)
|
56
56
|
@filter.load
|
57
57
|
@filter.unload
|
58
58
|
end
|
@@ -4,12 +4,12 @@ require 'mspec/runner/example'
|
|
4
4
|
|
5
5
|
describe DescribeFormatter, "#finish" do
|
6
6
|
before :each do
|
7
|
-
MSpec.stub
|
8
|
-
MSpec.stub
|
7
|
+
MSpec.stub(:register)
|
8
|
+
MSpec.stub(:unregister)
|
9
9
|
|
10
|
-
@timer =
|
11
|
-
TimerAction.stub
|
12
|
-
@timer.stub
|
10
|
+
@timer = double("timer").as_null_object
|
11
|
+
TimerAction.stub(:new).and_return(@timer)
|
12
|
+
@timer.stub(:format).and_return("Finished in 2.0 seconds")
|
13
13
|
|
14
14
|
$stdout = @out = IOStub.new
|
15
15
|
context = ContextState.new "Class#method"
|
@@ -52,7 +52,7 @@ Finished in 2.0 seconds
|
|
52
52
|
|
53
53
|
it "prints a summary of failures and errors for each describe block" do
|
54
54
|
exc = ExceptionState.new @state, nil, MSpecExampleError.new("broken")
|
55
|
-
exc.stub
|
55
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
56
56
|
@formatter.exception exc
|
57
57
|
@formatter.finish
|
58
58
|
@out.should == %[
|
@@ -17,7 +17,7 @@ end
|
|
17
17
|
describe DottedFormatter, "#register" do
|
18
18
|
before :each do
|
19
19
|
@formatter = DottedFormatter.new
|
20
|
-
MSpec.stub
|
20
|
+
MSpec.stub(:register)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "registers self with MSpec for appropriate actions" do
|
@@ -29,8 +29,8 @@ describe DottedFormatter, "#register" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "creates TimerAction and TallyAction" do
|
32
|
-
timer =
|
33
|
-
tally =
|
32
|
+
timer = double("timer")
|
33
|
+
tally = double("tally")
|
34
34
|
timer.should_receive(:register)
|
35
35
|
tally.should_receive(:register)
|
36
36
|
tally.should_receive(:counter)
|
@@ -221,15 +221,15 @@ end
|
|
221
221
|
|
222
222
|
describe DottedFormatter, "#finish" do
|
223
223
|
before :each do
|
224
|
-
@tally =
|
225
|
-
TallyAction.stub
|
226
|
-
@timer =
|
227
|
-
TimerAction.stub
|
224
|
+
@tally = double("tally").as_null_object
|
225
|
+
TallyAction.stub(:new).and_return(@tally)
|
226
|
+
@timer = double("timer").as_null_object
|
227
|
+
TimerAction.stub(:new).and_return(@timer)
|
228
228
|
|
229
229
|
$stdout = @out = IOStub.new
|
230
230
|
context = ContextState.new "Class#method"
|
231
231
|
@state = ExampleState.new(context, "runs")
|
232
|
-
MSpec.stub
|
232
|
+
MSpec.stub(:register)
|
233
233
|
@formatter = DottedFormatter.new
|
234
234
|
@formatter.register
|
235
235
|
end
|
@@ -248,7 +248,7 @@ describe DottedFormatter, "#finish" do
|
|
248
248
|
|
249
249
|
it "prints a backtrace for an exception" do
|
250
250
|
exc = ExceptionState.new @state, nil, MSpecExampleError.new("broken")
|
251
|
-
exc.stub
|
251
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
252
252
|
@formatter.exception exc
|
253
253
|
@formatter.after @state
|
254
254
|
@formatter.finish
|
@@ -269,7 +269,7 @@ describe DottedFormatter, "#finish" do
|
|
269
269
|
|
270
270
|
it "prints errors, backtraces, elapsed time, and tallies" do
|
271
271
|
exc = ExceptionState.new @state, nil, MSpecExampleError.new("broken")
|
272
|
-
exc.stub
|
272
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
273
273
|
@formatter.exception exc
|
274
274
|
@timer.should_receive(:format).and_return("Finished in 2.0 seconds")
|
275
275
|
@tally.should_receive(:format).and_return("1 example, 1 failure")
|
@@ -6,8 +6,8 @@ require 'mspec/runner/example'
|
|
6
6
|
describe FileFormatter, "#register" do
|
7
7
|
before :each do
|
8
8
|
@formatter = FileFormatter.new
|
9
|
-
MSpec.stub
|
10
|
-
MSpec.stub
|
9
|
+
MSpec.stub(:register)
|
10
|
+
MSpec.stub(:unregister)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "registers self with MSpec for :load, :unload actions" do
|
@@ -12,7 +12,7 @@ describe HtmlFormatter do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "responds to #register by registering itself with MSpec for appropriate actions" do
|
15
|
-
MSpec.stub
|
15
|
+
MSpec.stub(:register)
|
16
16
|
MSpec.should_receive(:register).with(:start, @formatter)
|
17
17
|
MSpec.should_receive(:register).with(:enter, @formatter)
|
18
18
|
MSpec.should_receive(:register).with(:leave, @formatter)
|
@@ -33,7 +33,7 @@ describe HtmlFormatter, "#start" do
|
|
33
33
|
it "prints the HTML head" do
|
34
34
|
@formatter.start
|
35
35
|
ruby_name = RUBY_NAME
|
36
|
-
ruby_name.should =~
|
36
|
+
ruby_name.should =~ /^#{ruby_name}/
|
37
37
|
@out.should ==
|
38
38
|
%[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
39
39
|
"http://www.w3.org/TR/html4/strict.dtd">
|
@@ -144,19 +144,19 @@ end
|
|
144
144
|
|
145
145
|
describe HtmlFormatter, "#finish" do
|
146
146
|
before :each do
|
147
|
-
@tally =
|
148
|
-
TallyAction.stub
|
149
|
-
@timer =
|
150
|
-
TimerAction.stub
|
147
|
+
@tally = double("tally").as_null_object
|
148
|
+
TallyAction.stub(:new).and_return(@tally)
|
149
|
+
@timer = double("timer").as_null_object
|
150
|
+
TimerAction.stub(:new).and_return(@timer)
|
151
151
|
|
152
152
|
$stdout = @out = IOStub.new
|
153
153
|
context = ContextState.new "describe"
|
154
154
|
@state = ExampleState.new(context, "it")
|
155
|
-
MSpec.stub
|
155
|
+
MSpec.stub(:register)
|
156
156
|
@formatter = HtmlFormatter.new
|
157
157
|
@formatter.register
|
158
158
|
@exception = MSpecExampleError.new("broken")
|
159
|
-
@exception.stub
|
159
|
+
@exception.stub(:backtrace).and_return(["file.rb:1", "file.rb:2"])
|
160
160
|
end
|
161
161
|
|
162
162
|
after :each do
|
@@ -172,7 +172,7 @@ describe HtmlFormatter, "#finish" do
|
|
172
172
|
|
173
173
|
it "prints a backtrace for an exception" do
|
174
174
|
exc = ExceptionState.new @state, nil, @exception
|
175
|
-
exc.stub
|
175
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
176
176
|
@formatter.exception exc
|
177
177
|
@formatter.finish
|
178
178
|
@out.should =~ %r[<pre>.*path/to/some/file.rb:35:in method.*</pre>]m
|
@@ -192,7 +192,7 @@ describe HtmlFormatter, "#finish" do
|
|
192
192
|
|
193
193
|
it "prints errors, backtraces, elapsed time, and tallies" do
|
194
194
|
exc = ExceptionState.new @state, nil, @exception
|
195
|
-
exc.stub
|
195
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
196
196
|
@formatter.exception exc
|
197
197
|
|
198
198
|
@timer.should_receive(:format).and_return("Finished in 2.0 seconds")
|
@@ -17,7 +17,7 @@ describe JUnitFormatter, "#print" do
|
|
17
17
|
before :each do
|
18
18
|
$stdout = IOStub.new
|
19
19
|
@out = IOStub.new
|
20
|
-
File.stub
|
20
|
+
File.stub(:open).and_return(@out)
|
21
21
|
@formatter = JUnitFormatter.new "some/file"
|
22
22
|
end
|
23
23
|
|
@@ -49,25 +49,25 @@ end
|
|
49
49
|
|
50
50
|
describe JUnitFormatter, "#finish" do
|
51
51
|
before :each do
|
52
|
-
@tally =
|
53
|
-
@counter =
|
54
|
-
@tally.stub
|
55
|
-
TallyAction.stub
|
52
|
+
@tally = double("tally").as_null_object
|
53
|
+
@counter = double("counter").as_null_object
|
54
|
+
@tally.stub(:counter).and_return(@counter)
|
55
|
+
TallyAction.stub(:new).and_return(@tally)
|
56
56
|
|
57
|
-
@timer =
|
58
|
-
TimerAction.stub
|
57
|
+
@timer = double("timer").as_null_object
|
58
|
+
TimerAction.stub(:new).and_return(@timer)
|
59
59
|
|
60
60
|
$stdout = IOStub.new
|
61
61
|
context = ContextState.new "describe"
|
62
62
|
@state = ExampleState.new(context, "it")
|
63
63
|
|
64
64
|
@formatter = JUnitFormatter.new
|
65
|
-
@formatter.stub
|
66
|
-
MSpec.stub
|
65
|
+
@formatter.stub(:backtrace).and_return("")
|
66
|
+
MSpec.stub(:register)
|
67
67
|
@formatter.register
|
68
68
|
|
69
69
|
exc = ExceptionState.new @state, nil, MSpecExampleError.new("broken")
|
70
|
-
exc.stub
|
70
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
71
71
|
@formatter.exception exc
|
72
72
|
@formatter.after @state
|
73
73
|
end
|
@@ -90,7 +90,7 @@ describe JUnitFormatter, "#finish" do
|
|
90
90
|
|
91
91
|
it "encodes message and backtrace in latin1 for jenkins" do
|
92
92
|
exc = ExceptionState.new @state, nil, MSpecExampleError.new("broken…")
|
93
|
-
exc.stub
|
93
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in methød")
|
94
94
|
@formatter.exception exc
|
95
95
|
@formatter.finish
|
96
96
|
$stdout.should =~ /MSpecExampleError: broken((\.\.\.)|\?)\n/
|
@@ -26,7 +26,7 @@ end
|
|
26
26
|
describe MethodFormatter, "#before" do
|
27
27
|
before :each do
|
28
28
|
@formatter = MethodFormatter.new
|
29
|
-
MSpec.stub
|
29
|
+
MSpec.stub(:register)
|
30
30
|
@formatter.register
|
31
31
|
end
|
32
32
|
|
@@ -94,7 +94,7 @@ end
|
|
94
94
|
describe MethodFormatter, "#after" do
|
95
95
|
before :each do
|
96
96
|
@formatter = MethodFormatter.new
|
97
|
-
MSpec.stub
|
97
|
+
MSpec.stub(:register)
|
98
98
|
@formatter.register
|
99
99
|
end
|
100
100
|
|
@@ -138,7 +138,7 @@ describe MethodFormatter, "#after" do
|
|
138
138
|
context = ContextState.new "Class#method"
|
139
139
|
@state = ExampleState.new(context, "runs")
|
140
140
|
@formatter = MethodFormatter.new
|
141
|
-
MSpec.stub
|
141
|
+
MSpec.stub(:register)
|
142
142
|
@formatter.register
|
143
143
|
end
|
144
144
|
|
@@ -8,7 +8,7 @@ describe SpecdocFormatter do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "responds to #register by registering itself with MSpec for appropriate actions" do
|
11
|
-
MSpec.stub
|
11
|
+
MSpec.stub(:register)
|
12
12
|
MSpec.should_receive(:register).with(:enter, @formatter)
|
13
13
|
@formatter.register
|
14
14
|
end
|
@@ -16,7 +16,7 @@ end
|
|
16
16
|
describe SpinnerFormatter, "#register" do
|
17
17
|
before :each do
|
18
18
|
@formatter = SpinnerFormatter.new
|
19
|
-
MSpec.stub
|
19
|
+
MSpec.stub(:register)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "registers self with MSpec for appropriate actions" do
|
@@ -28,8 +28,8 @@ describe SpinnerFormatter, "#register" do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "creates TimerAction and TallyAction" do
|
31
|
-
timer =
|
32
|
-
tally =
|
31
|
+
timer = double("timer")
|
32
|
+
tally = double("tally")
|
33
33
|
timer.should_receive(:register)
|
34
34
|
tally.should_receive(:register)
|
35
35
|
tally.should_receive(:counter)
|
@@ -55,7 +55,7 @@ end
|
|
55
55
|
describe SpinnerFormatter, "#after" do
|
56
56
|
before :each do
|
57
57
|
$stdout = IOStub.new
|
58
|
-
MSpec.stub
|
58
|
+
MSpec.stub(:retrieve).and_return(["a", "b"])
|
59
59
|
@formatter = SpinnerFormatter.new
|
60
60
|
@formatter.register
|
61
61
|
@state = ExampleState.new("describe", "it")
|
@@ -5,15 +5,15 @@ require 'mspec/utils/script'
|
|
5
5
|
|
6
6
|
describe UnitdiffFormatter, "#finish" do
|
7
7
|
before :each do
|
8
|
-
@tally =
|
9
|
-
TallyAction.stub
|
10
|
-
@timer =
|
11
|
-
TimerAction.stub
|
8
|
+
@tally = double("tally").as_null_object
|
9
|
+
TallyAction.stub(:new).and_return(@tally)
|
10
|
+
@timer = double("timer").as_null_object
|
11
|
+
TimerAction.stub(:new).and_return(@timer)
|
12
12
|
|
13
13
|
$stdout = @out = IOStub.new
|
14
14
|
context = ContextState.new "describe"
|
15
15
|
@state = ExampleState.new(context, "it")
|
16
|
-
MSpec.stub
|
16
|
+
MSpec.stub(:register)
|
17
17
|
@formatter = UnitdiffFormatter.new
|
18
18
|
@formatter.register
|
19
19
|
end
|
@@ -32,7 +32,7 @@ describe UnitdiffFormatter, "#finish" do
|
|
32
32
|
|
33
33
|
it "prints a backtrace for an exception" do
|
34
34
|
exc = ExceptionState.new @state, nil, Exception.new("broken")
|
35
|
-
exc.stub
|
35
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
36
36
|
@formatter.exception exc
|
37
37
|
@formatter.finish
|
38
38
|
@out.should =~ %r[path/to/some/file.rb:35:in method$]
|
@@ -52,7 +52,7 @@ describe UnitdiffFormatter, "#finish" do
|
|
52
52
|
|
53
53
|
it "prints errors, backtraces, elapsed time, and tallies" do
|
54
54
|
exc = ExceptionState.new @state, nil, Exception.new("broken")
|
55
|
-
exc.stub
|
55
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
56
56
|
@formatter.exception exc
|
57
57
|
@formatter.after @state
|
58
58
|
@timer.should_receive(:format).and_return("Finished in 2.0 seconds")
|
@@ -16,7 +16,7 @@ describe YamlFormatter, "#print" do
|
|
16
16
|
before :each do
|
17
17
|
$stdout = IOStub.new
|
18
18
|
@out = IOStub.new
|
19
|
-
File.stub
|
19
|
+
File.stub(:open).and_return(@out)
|
20
20
|
@formatter = YamlFormatter.new "some/file"
|
21
21
|
end
|
22
22
|
|
@@ -48,25 +48,25 @@ end
|
|
48
48
|
|
49
49
|
describe YamlFormatter, "#finish" do
|
50
50
|
before :each do
|
51
|
-
@tally =
|
52
|
-
@counter =
|
53
|
-
@tally.stub
|
54
|
-
TallyAction.stub
|
51
|
+
@tally = double("tally").as_null_object
|
52
|
+
@counter = double("counter").as_null_object
|
53
|
+
@tally.stub(:counter).and_return(@counter)
|
54
|
+
TallyAction.stub(:new).and_return(@tally)
|
55
55
|
|
56
|
-
@timer =
|
57
|
-
TimerAction.stub
|
56
|
+
@timer = double("timer").as_null_object
|
57
|
+
TimerAction.stub(:new).and_return(@timer)
|
58
58
|
|
59
59
|
$stdout = IOStub.new
|
60
60
|
context = ContextState.new "describe"
|
61
61
|
@state = ExampleState.new(context, "it")
|
62
62
|
|
63
63
|
@formatter = YamlFormatter.new
|
64
|
-
@formatter.stub
|
65
|
-
MSpec.stub
|
64
|
+
@formatter.stub(:backtrace).and_return("")
|
65
|
+
MSpec.stub(:register)
|
66
66
|
@formatter.register
|
67
67
|
|
68
68
|
exc = ExceptionState.new @state, nil, MSpecExampleError.new("broken")
|
69
|
-
exc.stub
|
69
|
+
exc.stub(:backtrace).and_return("path/to/some/file.rb:35:in method")
|
70
70
|
@formatter.exception exc
|
71
71
|
@formatter.after @state
|
72
72
|
end
|
data/spec/runner/mspec_spec.rb
CHANGED
@@ -95,7 +95,7 @@ describe MSpec, ".protect" do
|
|
95
95
|
before :each do
|
96
96
|
MSpec.clear_current
|
97
97
|
@cs = ContextState.new "C#m"
|
98
|
-
@cs.stub
|
98
|
+
@cs.stub(:state).and_return(@es)
|
99
99
|
@cs.parent = MSpec.current
|
100
100
|
|
101
101
|
@es = ExampleState.new @cs, "runs"
|
@@ -125,8 +125,8 @@ describe MSpec, ".protect" do
|
|
125
125
|
|
126
126
|
it "calls all the exception actions" do
|
127
127
|
exc = ExceptionState.new @es, "testing", ScratchPad.recorded
|
128
|
-
ExceptionState.stub
|
129
|
-
action =
|
128
|
+
ExceptionState.stub(:new).and_return(exc)
|
129
|
+
action = double("exception")
|
130
130
|
action.should_receive(:exception).with(exc)
|
131
131
|
MSpec.register :exception, action
|
132
132
|
MSpec.protect("testing") { raise ScratchPad.recorded }
|
@@ -183,10 +183,10 @@ describe MSpec, ".actions" do
|
|
183
183
|
before :each do
|
184
184
|
MSpec.store :start, []
|
185
185
|
ScratchPad.record []
|
186
|
-
start_one =
|
187
|
-
start_one.stub
|
188
|
-
start_two =
|
189
|
-
start_two.stub
|
186
|
+
start_one = double("one")
|
187
|
+
start_one.stub(:start).and_return { ScratchPad << :one }
|
188
|
+
start_two = double("two")
|
189
|
+
start_two.stub(:start).and_return { ScratchPad << :two }
|
190
190
|
MSpec.register :start, start_one
|
191
191
|
MSpec.register :start, start_two
|
192
192
|
end
|
@@ -264,9 +264,9 @@ describe MSpec, ".describe" do
|
|
264
264
|
before :each do
|
265
265
|
MSpec.clear_current
|
266
266
|
@cs = ContextState.new ""
|
267
|
-
ContextState.stub
|
268
|
-
MSpec.stub
|
269
|
-
MSpec.stub
|
267
|
+
ContextState.stub(:new).and_return(@cs)
|
268
|
+
MSpec.stub(:current).and_return(nil)
|
269
|
+
MSpec.stub(:register_current)
|
270
270
|
end
|
271
271
|
|
272
272
|
it "creates a new ContextState for the block" do
|
@@ -293,22 +293,22 @@ end
|
|
293
293
|
|
294
294
|
describe MSpec, ".process" do
|
295
295
|
before :each do
|
296
|
-
MSpec.stub
|
296
|
+
MSpec.stub(:files)
|
297
297
|
MSpec.store :start, []
|
298
298
|
MSpec.store :finish, []
|
299
299
|
end
|
300
300
|
|
301
301
|
it "calls all start actions" do
|
302
|
-
start =
|
303
|
-
start.stub
|
302
|
+
start = double("start")
|
303
|
+
start.stub(:start).and_return { ScratchPad.record :start }
|
304
304
|
MSpec.register :start, start
|
305
305
|
MSpec.process
|
306
306
|
ScratchPad.recorded.should == :start
|
307
307
|
end
|
308
308
|
|
309
309
|
it "calls all finish actions" do
|
310
|
-
finish =
|
311
|
-
finish.stub
|
310
|
+
finish = double("finish")
|
311
|
+
finish.stub(:finish).and_return { ScratchPad.record :finish }
|
312
312
|
MSpec.register :finish, finish
|
313
313
|
MSpec.process
|
314
314
|
ScratchPad.recorded.should == :finish
|
@@ -325,12 +325,12 @@ describe MSpec, ".files" do
|
|
325
325
|
MSpec.store :load, []
|
326
326
|
MSpec.store :unload, []
|
327
327
|
MSpec.register_files [:one, :two, :three]
|
328
|
-
Kernel.stub
|
328
|
+
Kernel.stub(:load)
|
329
329
|
end
|
330
330
|
|
331
331
|
it "calls load actions before each file" do
|
332
|
-
load =
|
333
|
-
load.stub
|
332
|
+
load = double("load")
|
333
|
+
load.stub(:load).and_return { ScratchPad.record :load }
|
334
334
|
MSpec.register :load, load
|
335
335
|
MSpec.files
|
336
336
|
ScratchPad.recorded.should == :load
|
@@ -403,7 +403,7 @@ end
|
|
403
403
|
|
404
404
|
describe MSpec, ".read_tags" do
|
405
405
|
before :each do
|
406
|
-
MSpec.stub
|
406
|
+
MSpec.stub(:tags_file).and_return(File.dirname(__FILE__) + '/tags.txt')
|
407
407
|
end
|
408
408
|
|
409
409
|
it "returns a list of tag instances for matching tag names found" do
|
@@ -424,7 +424,7 @@ describe MSpec, ".read_tags" do
|
|
424
424
|
f.puts @tag
|
425
425
|
f.puts ""
|
426
426
|
end
|
427
|
-
MSpec.stub
|
427
|
+
MSpec.stub(:tags_file).and_return(tmp("tags.txt", false))
|
428
428
|
end
|
429
429
|
|
430
430
|
it "does not return a tag object for empty lines" do
|
@@ -435,7 +435,7 @@ end
|
|
435
435
|
describe MSpec, ".write_tags" do
|
436
436
|
before :each do
|
437
437
|
FileUtils.cp File.dirname(__FILE__) + "/tags.txt", tmp("tags.txt", false)
|
438
|
-
MSpec.stub
|
438
|
+
MSpec.stub(:tags_file).and_return(tmp("tags.txt", false))
|
439
439
|
@tag1 = SpecTag.new "check(broken):Tag#rewrite works"
|
440
440
|
@tag2 = SpecTag.new "broken:Tag#write_tags fails"
|
441
441
|
end
|
@@ -459,8 +459,8 @@ end
|
|
459
459
|
|
460
460
|
describe MSpec, ".write_tag" do
|
461
461
|
before :each do
|
462
|
-
FileUtils.stub
|
463
|
-
MSpec.stub
|
462
|
+
FileUtils.stub(:mkdir_p)
|
463
|
+
MSpec.stub(:tags_file).and_return(tmp("tags.txt", false))
|
464
464
|
@tag = SpecTag.new "fail(broken):Some#method works"
|
465
465
|
end
|
466
466
|
|
@@ -483,7 +483,7 @@ end
|
|
483
483
|
describe MSpec, ".delete_tag" do
|
484
484
|
before :each do
|
485
485
|
FileUtils.cp File.dirname(__FILE__) + "/tags.txt", tmp("tags.txt", false)
|
486
|
-
MSpec.stub
|
486
|
+
MSpec.stub(:tags_file).and_return(tmp("tags.txt", false))
|
487
487
|
@tag = SpecTag.new "fail(Comments don't matter):Some#method? works"
|
488
488
|
end
|
489
489
|
|
@@ -530,7 +530,7 @@ describe MSpec, ".delete_tags" do
|
|
530
530
|
before :each do
|
531
531
|
@tags = tmp("tags.txt", false)
|
532
532
|
FileUtils.cp File.dirname(__FILE__) + "/tags.txt", @tags
|
533
|
-
MSpec.stub
|
533
|
+
MSpec.stub(:tags_file).and_return(@tags)
|
534
534
|
end
|
535
535
|
|
536
536
|
it "deletes the tag file" do
|