mspec 1.5.10 → 1.5.11
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.
- data/Rakefile +1 -1
- data/lib/mspec/commands/mkspec.rb +1 -1
- data/lib/mspec/expectations/expectations.rb +4 -4
- data/lib/mspec/expectations/should.rb +4 -4
- data/lib/mspec/guards/endian.rb +5 -8
- data/lib/mspec/guards/guard.rb +1 -1
- data/lib/mspec/helpers/const_lookup.rb +2 -1
- data/lib/mspec/helpers/flunk.rb +1 -1
- data/lib/mspec/helpers/io.rb +2 -2
- data/lib/mspec/helpers/ruby_exe.rb +6 -3
- data/lib/mspec/matchers/base.rb +14 -14
- data/lib/mspec/matchers/be_an_instance_of.rb +26 -0
- data/lib/mspec/mocks/mock.rb +5 -5
- data/lib/mspec/runner/context.rb +1 -1
- data/lib/mspec/runner/exception.rb +3 -3
- data/lib/mspec/runner/formatters/dotted.rb +2 -2
- data/lib/mspec/utils/name_map.rb +2 -1
- data/lib/mspec/utils/options.rb +3 -1
- data/lib/mspec/utils/script.rb +3 -2
- data/lib/mspec/version.rb +1 -1
- data/spec/commands/mkspec_spec.rb +2 -1
- data/spec/expectations/expectations_spec.rb +10 -10
- data/spec/expectations/should.rb +71 -0
- data/spec/expectations/should_spec.rb +58 -126
- data/spec/guards/endian_spec.rb +6 -6
- data/spec/helpers/flunk_spec.rb +3 -3
- data/spec/matchers/base_spec.rb +99 -90
- data/spec/matchers/be_an_instance_of_spec.rb +50 -0
- data/spec/matchers/be_close_spec.rb +2 -2
- data/spec/matchers/be_kind_of_spec.rb +5 -3
- data/spec/matchers/equal_utf16_spec.rb +12 -2
- data/spec/matchers/respond_to_spec.rb +5 -3
- data/spec/mocks/mock_spec.rb +22 -21
- data/spec/runner/actions/tally_spec.rb +2 -2
- data/spec/runner/actions/timer_spec.rb +4 -4
- data/spec/runner/context_spec.rb +4 -4
- data/spec/runner/exception_spec.rb +10 -10
- data/spec/runner/formatters/dotted_spec.rb +6 -6
- data/spec/runner/formatters/file_spec.rb +3 -3
- data/spec/runner/formatters/html_spec.rb +3 -3
- data/spec/runner/formatters/method_spec.rb +2 -2
- data/spec/runner/formatters/specdoc_spec.rb +5 -5
- data/spec/runner/formatters/summary_spec.rb +1 -1
- data/spec/utils/options_spec.rb +10 -9
- data/spec/utils/script_spec.rb +7 -6
- metadata +5 -2
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'mspec/expectations/expectations'
|
3
|
+
require 'mspec/matchers/be_an_instance_of'
|
4
|
+
|
5
|
+
module BeAnInOfSpecs
|
6
|
+
class A
|
7
|
+
end
|
8
|
+
|
9
|
+
class B < A
|
10
|
+
end
|
11
|
+
|
12
|
+
class C < B
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe BeAnInstanceOfMatcher do
|
17
|
+
it "matches when actual is an instance_of? expected" do
|
18
|
+
a = BeAnInOfSpecs::A.new
|
19
|
+
BeAnInstanceOfMatcher.new(BeAnInOfSpecs::A).matches?(a).should be_true
|
20
|
+
|
21
|
+
b = BeAnInOfSpecs::B.new
|
22
|
+
BeAnInstanceOfMatcher.new(BeAnInOfSpecs::B).matches?(b).should be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
it "does not match when actual is not an instance_of? expected" do
|
26
|
+
a = BeAnInOfSpecs::A.new
|
27
|
+
BeAnInstanceOfMatcher.new(BeAnInOfSpecs::B).matches?(a).should be_false
|
28
|
+
|
29
|
+
b = BeAnInOfSpecs::B.new
|
30
|
+
BeAnInstanceOfMatcher.new(BeAnInOfSpecs::A).matches?(b).should be_false
|
31
|
+
|
32
|
+
c = BeAnInOfSpecs::C.new
|
33
|
+
BeAnInstanceOfMatcher.new(BeAnInOfSpecs::A).matches?(c).should be_false
|
34
|
+
BeAnInstanceOfMatcher.new(BeAnInOfSpecs::B).matches?(c).should be_false
|
35
|
+
end
|
36
|
+
|
37
|
+
it "provides a useful failure message" do
|
38
|
+
matcher = BeAnInstanceOfMatcher.new(Numeric)
|
39
|
+
matcher.matches?("string")
|
40
|
+
matcher.failure_message.should == [
|
41
|
+
"Expected \"string\" (String)", "to be an instance of Numeric"]
|
42
|
+
end
|
43
|
+
|
44
|
+
it "provides a useful negative failure message" do
|
45
|
+
matcher = BeAnInstanceOfMatcher.new(Numeric)
|
46
|
+
matcher.matches?(4.0)
|
47
|
+
matcher.negative_failure_message.should == [
|
48
|
+
"Expected 4.0 (Float)", "not to be an instance of Numeric"]
|
49
|
+
end
|
50
|
+
end
|
@@ -34,8 +34,8 @@ describe BeCloseMatcher do
|
|
34
34
|
|
35
35
|
it "provides a useful failure message" do
|
36
36
|
matcher = BeCloseMatcher.new(5.0, 0.5)
|
37
|
-
matcher.matches?(5.
|
38
|
-
matcher.failure_message.should == ["Expected 5.0", "to be within +/- 0.5 of 5.
|
37
|
+
matcher.matches?(5.5)
|
38
|
+
matcher.failure_message.should == ["Expected 5.0", "to be within +/- 0.5 of 5.5"]
|
39
39
|
end
|
40
40
|
|
41
41
|
it "provides a useful negative failure message" do
|
@@ -18,12 +18,14 @@ describe BeKindOfMatcher do
|
|
18
18
|
it "provides a useful failure message" do
|
19
19
|
matcher = BeKindOfMatcher.new(Numeric)
|
20
20
|
matcher.matches?('string')
|
21
|
-
matcher.failure_message.should == [
|
21
|
+
matcher.failure_message.should == [
|
22
|
+
"Expected \"string\" (String)", "to be kind of Numeric"]
|
22
23
|
end
|
23
24
|
|
24
25
|
it "provides a useful negative failure message" do
|
25
26
|
matcher = BeKindOfMatcher.new(Numeric)
|
26
|
-
matcher.matches?(4.
|
27
|
-
matcher.negative_failure_message.should == [
|
27
|
+
matcher.matches?(4.0)
|
28
|
+
matcher.negative_failure_message.should == [
|
29
|
+
"Expected 4.0 (Float)", "not to be kind of Numeric"]
|
28
30
|
end
|
29
31
|
end
|
@@ -3,6 +3,12 @@ require 'mspec/expectations/expectations'
|
|
3
3
|
require 'mspec/matchers/equal_utf16'
|
4
4
|
|
5
5
|
describe EqualUtf16Matcher do
|
6
|
+
before :all do
|
7
|
+
# this is a neutral way to covert a NULL character to a
|
8
|
+
# string representation on 1.8 (\000) and 1.9 (\x00)
|
9
|
+
@null = "\0".inspect[1..-2]
|
10
|
+
end
|
11
|
+
|
6
12
|
it "when given strings, matches when actual == expected" do
|
7
13
|
EqualUtf16Matcher.new("abcd").matches?("abcd").should == true
|
8
14
|
end
|
@@ -36,12 +42,16 @@ describe EqualUtf16Matcher do
|
|
36
42
|
it "provides a useful failure message" do
|
37
43
|
matcher = EqualUtf16Matcher.new("a\0b\0")
|
38
44
|
matcher.matches?("a\0b\0c\0")
|
39
|
-
matcher.failure_message.should == [
|
45
|
+
matcher.failure_message.should == [
|
46
|
+
"Expected \"a#{@null}b#{@null}c#{@null}\"\n",
|
47
|
+
"to equal \"a#{@null}b#{@null}\"\n or \"#{@null}a#{@null}b\"\n"]
|
40
48
|
end
|
41
49
|
|
42
50
|
it "provides a useful negative failure message" do
|
43
51
|
matcher = EqualUtf16Matcher.new("a\0b\0")
|
44
52
|
matcher.matches?("\0a\0b")
|
45
|
-
matcher.negative_failure_message.should == [
|
53
|
+
matcher.negative_failure_message.should == [
|
54
|
+
"Expected \"#{@null}a#{@null}b\"\n",
|
55
|
+
"not to equal \"a#{@null}b#{@null}\"\n nor \"#{@null}a#{@null}b\"\n"]
|
46
56
|
end
|
47
57
|
end
|
@@ -20,12 +20,14 @@ describe RespondToMatcher do
|
|
20
20
|
it "provides a useful failure message" do
|
21
21
|
matcher = RespondToMatcher.new(:non_existent_method)
|
22
22
|
matcher.matches?('string')
|
23
|
-
matcher.failure_message.should == [
|
23
|
+
matcher.failure_message.should == [
|
24
|
+
"Expected \"string\" (String)", "to respond to non_existent_method"]
|
24
25
|
end
|
25
26
|
|
26
27
|
it "provides a useful negative failure message" do
|
27
28
|
matcher = RespondToMatcher.new(:to_i)
|
28
|
-
matcher.matches?(4.
|
29
|
-
matcher.negative_failure_message.should == [
|
29
|
+
matcher.matches?(4.0)
|
30
|
+
matcher.negative_failure_message.should == [
|
31
|
+
"Expected 4.0 (Float)", "not to respond to to_i"]
|
30
32
|
end
|
31
33
|
end
|
data/spec/mocks/mock_spec.rb
CHANGED
@@ -88,7 +88,7 @@ describe Mock, ".install_method for mocks" do
|
|
88
88
|
Mock.install_method(@mock, :method_call).with(:c).and_return(2)
|
89
89
|
@mock.method_call(:a, :b)
|
90
90
|
@mock.method_call(:c)
|
91
|
-
lambda { @mock.method_call(:d) }.should raise_error(
|
91
|
+
lambda { @mock.method_call(:d) }.should raise_error(SpecExpectationNotMetError)
|
92
92
|
end
|
93
93
|
|
94
94
|
# This illustrates RSpec's behavior. This spec fails in mock call count verification
|
@@ -110,7 +110,7 @@ describe Mock, ".install_method for mocks" do
|
|
110
110
|
@mock.method_call(:a).should == true
|
111
111
|
Mock.install_method(@mock, :method_call).with(:a).and_return(false)
|
112
112
|
@mock.method_call(:a).should == true
|
113
|
-
lambda { Mock.verify_count }.should raise_error(
|
113
|
+
lambda { Mock.verify_count }.should raise_error(SpecExpectationNotMetError)
|
114
114
|
end
|
115
115
|
|
116
116
|
it "properly sends #respond_to? calls to the aliased respond_to? method when not matching mock expectations" do
|
@@ -226,25 +226,25 @@ describe Mock, ".verify_call" do
|
|
226
226
|
Mock.verify_call @mock, :method_call, 1, 'two', :three
|
227
227
|
end
|
228
228
|
|
229
|
-
it "raises an
|
229
|
+
it "raises an SpecExpectationNotMetError when the mock method does not receive the expected arguments" do
|
230
230
|
@proxy.with(4, 2)
|
231
231
|
lambda {
|
232
232
|
Mock.verify_call @mock, :method_call, 42
|
233
|
-
}.should raise_error(
|
233
|
+
}.should raise_error(SpecExpectationNotMetError)
|
234
234
|
end
|
235
235
|
|
236
|
-
it "raises an
|
236
|
+
it "raises an SpecExpectationNotMetError when the mock method is called with arguments but expects none" do
|
237
237
|
lambda {
|
238
238
|
@proxy.with(:no_args)
|
239
239
|
Mock.verify_call @mock, :method_call, "hello"
|
240
|
-
}.should raise_error(
|
240
|
+
}.should raise_error(SpecExpectationNotMetError)
|
241
241
|
end
|
242
242
|
|
243
|
-
it "raises an
|
243
|
+
it "raises an SpecExpectationNotMetError when the mock method is called with no arguments but expects some" do
|
244
244
|
@proxy.with("hello", "beautiful", "world")
|
245
245
|
lambda {
|
246
246
|
Mock.verify_call @mock, :method_call
|
247
|
-
}.should raise_error(
|
247
|
+
}.should raise_error(SpecExpectationNotMetError)
|
248
248
|
end
|
249
249
|
|
250
250
|
it "does not raise an exception when the mock method is called with arguments and is expecting :any_args" do
|
@@ -288,21 +288,21 @@ describe Mock, ".verify_call" do
|
|
288
288
|
@proxy.and_yield(1, 2, 3)
|
289
289
|
lambda {
|
290
290
|
Mock.verify_call(@mock, :method_call)
|
291
|
-
}.should raise_error(
|
291
|
+
}.should raise_error(SpecExpectationNotMetError)
|
292
292
|
end
|
293
293
|
|
294
294
|
it "raises an expection when it is expected to yield more arguments than the block can take" do
|
295
295
|
@proxy.and_yield(1, 2, 3)
|
296
296
|
lambda {
|
297
297
|
Mock.verify_call(@mock, :method_call) {|a, b|}
|
298
|
-
}.should raise_error(
|
298
|
+
}.should raise_error(SpecExpectationNotMetError)
|
299
299
|
end
|
300
300
|
|
301
301
|
it "does not raise an expection when it is expected to yield to a block that can take any number of arguments" do
|
302
302
|
@proxy.and_yield(1, 2, 3)
|
303
303
|
lambda {
|
304
304
|
Mock.verify_call(@mock, :method_call) {|*a|}
|
305
|
-
}.should_not raise_error(
|
305
|
+
}.should_not raise_error(SpecExpectationNotMetError)
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
@@ -326,10 +326,10 @@ describe Mock, ".verify_count" do
|
|
326
326
|
Mock.verify_count
|
327
327
|
end
|
328
328
|
|
329
|
-
it "raises an
|
329
|
+
it "raises an SpecExpectationNotMetError when the mock receives less than at least the expected number of calls" do
|
330
330
|
@proxy.at_least(2)
|
331
331
|
@mock.method_call
|
332
|
-
lambda { Mock.verify_count }.should raise_error(
|
332
|
+
lambda { Mock.verify_count }.should raise_error(SpecExpectationNotMetError)
|
333
333
|
end
|
334
334
|
|
335
335
|
it "does not raise an exception when the mock receives at most the expected number of calls" do
|
@@ -339,12 +339,12 @@ describe Mock, ".verify_count" do
|
|
339
339
|
Mock.verify_count
|
340
340
|
end
|
341
341
|
|
342
|
-
it "raises an
|
342
|
+
it "raises an SpecExpectationNotMetError when the mock receives more than at most the expected number of calls" do
|
343
343
|
@proxy.at_most(2)
|
344
344
|
@mock.method_call
|
345
345
|
@mock.method_call
|
346
346
|
@mock.method_call
|
347
|
-
lambda { Mock.verify_count }.should raise_error(
|
347
|
+
lambda { Mock.verify_count }.should raise_error(SpecExpectationNotMetError)
|
348
348
|
end
|
349
349
|
|
350
350
|
it "does not raise an exception when the mock receives exactly the expected number of calls" do
|
@@ -354,18 +354,18 @@ describe Mock, ".verify_count" do
|
|
354
354
|
Mock.verify_count
|
355
355
|
end
|
356
356
|
|
357
|
-
it "raises an
|
357
|
+
it "raises an SpecExpectationNotMetError when the mock receives less than exactly the expected number of calls" do
|
358
358
|
@proxy.exactly(2)
|
359
359
|
@mock.method_call
|
360
|
-
lambda { Mock.verify_count }.should raise_error(
|
360
|
+
lambda { Mock.verify_count }.should raise_error(SpecExpectationNotMetError)
|
361
361
|
end
|
362
362
|
|
363
|
-
it "raises an
|
363
|
+
it "raises an SpecExpectationNotMetError when the mock receives more than exactly the expected number of calls" do
|
364
364
|
@proxy.exactly(2)
|
365
365
|
@mock.method_call
|
366
366
|
@mock.method_call
|
367
367
|
@mock.method_call
|
368
|
-
lambda { Mock.verify_count }.should raise_error(
|
368
|
+
lambda { Mock.verify_count }.should raise_error(SpecExpectationNotMetError)
|
369
369
|
end
|
370
370
|
end
|
371
371
|
|
@@ -425,11 +425,12 @@ describe Mock, ".cleanup" do
|
|
425
425
|
it "removes the replaced method if the mock method overrides an existing method" do
|
426
426
|
def @mock.already_here() :hey end
|
427
427
|
@mock.should respond_to(:already_here)
|
428
|
+
replaced_name = Mock.replaced_name(@mock, :already_here)
|
428
429
|
Mock.install_method @mock, :already_here
|
429
|
-
@mock.should respond_to(
|
430
|
+
@mock.should respond_to(replaced_name)
|
430
431
|
|
431
432
|
Mock.cleanup
|
432
|
-
@mock.should_not respond_to(
|
433
|
+
@mock.should_not respond_to(replaced_name)
|
433
434
|
@mock.should respond_to(:already_here)
|
434
435
|
@mock.already_here.should == :hey
|
435
436
|
end
|
@@ -274,7 +274,7 @@ describe TallyAction, "#exception" do
|
|
274
274
|
end
|
275
275
|
|
276
276
|
it "increments counts returned by Tally#failures" do
|
277
|
-
exc = ExceptionState.new nil, nil,
|
277
|
+
exc = ExceptionState.new nil, nil, SpecExpectationNotMetError.new("Failed!")
|
278
278
|
@tally.exception exc
|
279
279
|
@tally.counter.examples.should == 0
|
280
280
|
@tally.counter.expectations.should == 0
|
@@ -310,7 +310,7 @@ describe TallyAction, "#format" do
|
|
310
310
|
@tally.example @state, nil
|
311
311
|
@tally.expectation @state
|
312
312
|
@tally.expectation @state
|
313
|
-
exc = ExceptionState.new nil, nil,
|
313
|
+
exc = ExceptionState.new nil, nil, SpecExpectationNotMetError.new("Failed!")
|
314
314
|
@tally.exception exc
|
315
315
|
@tally.format.should == "1 file, 1 example, 2 expectations, 1 failure, 0 errors"
|
316
316
|
end
|
@@ -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!(:now).and_return(Time.parse('
|
22
|
+
Time.stub!(:now).and_return(Time.parse('Mon Mar 30 14:05:19 -0700 2009'))
|
23
23
|
@timer.start
|
24
|
-
Time.stub!(:now).and_return(Time.parse('
|
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!(:now).and_return(Time.parse('
|
30
|
+
Time.stub!(:now).and_return(Time.parse('Mon Mar 30 14:05:19 -0700 2009'))
|
31
31
|
@timer.start
|
32
|
-
Time.stub!(:now).and_return(Time.parse('
|
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
@@ -506,7 +506,7 @@ describe ContextState, "#process" do
|
|
506
506
|
|
507
507
|
action = mock("action")
|
508
508
|
def action.exception(exc)
|
509
|
-
ScratchPad.record :exception if exc.exception.is_a?
|
509
|
+
ScratchPad.record :exception if exc.exception.is_a? SpecExpectationNotFoundError
|
510
510
|
end
|
511
511
|
MSpec.register :exception, action
|
512
512
|
|
@@ -518,19 +518,19 @@ describe ContextState, "#process" do
|
|
518
518
|
MSpec.store :exception, nil
|
519
519
|
end
|
520
520
|
|
521
|
-
it "raises an
|
521
|
+
it "raises an SpecExpectationNotFoundError if an #it block does not contain an expectation" do
|
522
522
|
@state.it("it") { }
|
523
523
|
@state.process
|
524
524
|
ScratchPad.recorded.should == :exception
|
525
525
|
end
|
526
526
|
|
527
|
-
it "does not raise an
|
527
|
+
it "does not raise an SpecExpectationNotFoundError if an #it block does contain an expectation" do
|
528
528
|
@state.it("it") { MSpec.expectation }
|
529
529
|
@state.process
|
530
530
|
ScratchPad.recorded.should be_nil
|
531
531
|
end
|
532
532
|
|
533
|
-
it "does not raise an
|
533
|
+
it "does not raise an SpecExpectationNotFoundError if the #it block causes a failure" do
|
534
534
|
@state.it("it") { raise Exception, "Failed!" }
|
535
535
|
@state.process
|
536
536
|
ScratchPad.recorded.should be_nil
|
@@ -69,17 +69,17 @@ describe ExceptionState, "#failure?" do
|
|
69
69
|
@state = ExampleState.new ContextState.new("C#m"), "works"
|
70
70
|
end
|
71
71
|
|
72
|
-
it "returns true if the exception is an
|
73
|
-
exc = ExceptionState.new @state, "",
|
72
|
+
it "returns true if the exception is an SpecExpectationNotMetError" do
|
73
|
+
exc = ExceptionState.new @state, "", SpecExpectationNotMetError.new("Fail!")
|
74
74
|
exc.failure?.should be_true
|
75
75
|
end
|
76
76
|
|
77
|
-
it "returns true if the exception is an
|
78
|
-
exc = ExceptionState.new @state, "",
|
77
|
+
it "returns true if the exception is an SpecExpectationNotFoundError" do
|
78
|
+
exc = ExceptionState.new @state, "", SpecExpectationNotFoundError.new("Fail!")
|
79
79
|
exc.failure?.should be_true
|
80
80
|
end
|
81
81
|
|
82
|
-
it "returns false if the exception is not an
|
82
|
+
it "returns false if the exception is not an SpecExpectationNotMetError or an SpecExpectationNotFoundError" do
|
83
83
|
exc = ExceptionState.new @state, "", Exception.new("Fail!")
|
84
84
|
exc.failure?.should be_false
|
85
85
|
end
|
@@ -91,18 +91,18 @@ describe ExceptionState, "#message" do
|
|
91
91
|
exc.message.should == "<No message>"
|
92
92
|
end
|
93
93
|
|
94
|
-
it "returns the message without exception class when the exception is an
|
95
|
-
exc = ExceptionState.new @state, "",
|
94
|
+
it "returns the message without exception class when the exception is an SpecExpectationNotMetError" do
|
95
|
+
exc = ExceptionState.new @state, "", SpecExpectationNotMetError.new("Fail!")
|
96
96
|
exc.message.should == "Fail!"
|
97
97
|
end
|
98
98
|
|
99
|
-
it "returns
|
100
|
-
e =
|
99
|
+
it "returns SpecExpectationNotFoundError#message when the exception is an SpecExpectationNotFoundError" do
|
100
|
+
e = SpecExpectationNotFoundError.new
|
101
101
|
exc = ExceptionState.new @state, "", e
|
102
102
|
exc.message.should == e.message
|
103
103
|
end
|
104
104
|
|
105
|
-
it "returns the message with exception class when the exception is not an
|
105
|
+
it "returns the message with exception class when the exception is not an SpecExpectationNotMetError or an SpecExpectationNotFoundError" do
|
106
106
|
exc = ExceptionState.new @state, "", Exception.new("Fail!")
|
107
107
|
exc.message.should == "Exception: Fail!"
|
108
108
|
end
|
@@ -78,7 +78,7 @@ end
|
|
78
78
|
describe DottedFormatter, "#exception" do
|
79
79
|
before :each do
|
80
80
|
@formatter = DottedFormatter.new
|
81
|
-
@failure = ExceptionState.new nil, nil,
|
81
|
+
@failure = ExceptionState.new nil, nil, SpecExpectationNotMetError.new("failed")
|
82
82
|
@error = ExceptionState.new nil, nil, MSpecExampleError.new("boom!")
|
83
83
|
end
|
84
84
|
|
@@ -107,7 +107,7 @@ end
|
|
107
107
|
describe DottedFormatter, "#exception?" do
|
108
108
|
before :each do
|
109
109
|
@formatter = DottedFormatter.new
|
110
|
-
@failure = ExceptionState.new nil, nil,
|
110
|
+
@failure = ExceptionState.new nil, nil, SpecExpectationNotMetError.new("failed")
|
111
111
|
@error = ExceptionState.new nil, nil, MSpecExampleError.new("boom!")
|
112
112
|
end
|
113
113
|
|
@@ -137,7 +137,7 @@ end
|
|
137
137
|
describe DottedFormatter, "#failure?" do
|
138
138
|
before :each do
|
139
139
|
@formatter = DottedFormatter.new
|
140
|
-
@failure = ExceptionState.new nil, nil,
|
140
|
+
@failure = ExceptionState.new nil, nil, SpecExpectationNotMetError.new("failed")
|
141
141
|
@error = ExceptionState.new nil, nil, MSpecExampleError.new("boom!")
|
142
142
|
end
|
143
143
|
|
@@ -162,7 +162,7 @@ describe DottedFormatter, "#before" do
|
|
162
162
|
before :each do
|
163
163
|
@state = ExampleState.new ContextState.new("describe"), "it"
|
164
164
|
@formatter = DottedFormatter.new
|
165
|
-
@formatter.exception ExceptionState.new(nil, nil,
|
165
|
+
@formatter.exception ExceptionState.new(nil, nil, SpecExpectationNotMetError.new("Failed!"))
|
166
166
|
end
|
167
167
|
|
168
168
|
it "resets the #failure? flag to false" do
|
@@ -195,7 +195,7 @@ describe DottedFormatter, "#after" do
|
|
195
195
|
end
|
196
196
|
|
197
197
|
it "prints an 'F' if there was an expectation failure" do
|
198
|
-
exc =
|
198
|
+
exc = SpecExpectationNotMetError.new "failed"
|
199
199
|
@formatter.exception ExceptionState.new(@state, nil, exc)
|
200
200
|
@formatter.after(@state)
|
201
201
|
@out.should == "F"
|
@@ -209,7 +209,7 @@ describe DottedFormatter, "#after" do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
it "prints an 'E' if there are mixed exceptions and exepctation failures" do
|
212
|
-
exc =
|
212
|
+
exc = SpecExpectationNotMetError.new "failed"
|
213
213
|
@formatter.exception ExceptionState.new(@state, nil, exc)
|
214
214
|
exc = MSpecExampleError.new("boom!")
|
215
215
|
@formatter.exception ExceptionState.new(@state, nil, exc)
|
@@ -27,7 +27,7 @@ describe FileFormatter, "#load" do
|
|
27
27
|
before :each do
|
28
28
|
@state = ExampleState.new ContextState.new("describe"), "it"
|
29
29
|
@formatter = FileFormatter.new
|
30
|
-
@formatter.exception ExceptionState.new(nil, nil,
|
30
|
+
@formatter.exception ExceptionState.new(nil, nil, SpecExpectationNotMetError.new("Failed!"))
|
31
31
|
end
|
32
32
|
|
33
33
|
it "resets the #failure? flag to false" do
|
@@ -60,7 +60,7 @@ describe FileFormatter, "#unload" do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "prints an 'F' if there was an expectation failure" do
|
63
|
-
exc =
|
63
|
+
exc = SpecExpectationNotMetError.new "failed"
|
64
64
|
@formatter.exception ExceptionState.new(@state, nil, exc)
|
65
65
|
@formatter.unload(@state)
|
66
66
|
@out.should == "F"
|
@@ -74,7 +74,7 @@ describe FileFormatter, "#unload" do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "prints an 'E' if there are mixed exceptions and exepctation failures" do
|
77
|
-
exc =
|
77
|
+
exc = SpecExpectationNotMetError.new "failed"
|
78
78
|
@formatter.exception ExceptionState.new(@state, nil, exc)
|
79
79
|
exc = MSpecExampleError.new("boom!")
|
80
80
|
@formatter.exception ExceptionState.new(@state, nil, exc)
|