-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathshould_spec.rb
More file actions
66 lines (57 loc) · 1.77 KB
/
should_spec.rb
File metadata and controls
66 lines (57 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require 'spec_helper'
require 'rbconfig'
describe "MSpec" do
before :all do
path = RbConfig::CONFIG['bindir']
exe = RbConfig::CONFIG['ruby_install_name']
file = File.dirname(__FILE__) + '/should.rb'
@out = `#{path}/#{exe} #{file} 2>&1`
end
describe "#should" do
it "records failures" do
@out.should include <<-EOS
1)
MSpec expectation method #should causes a failure to be recorded FAILED
Expected 1 == 2
to be truthy but was false
EOS
end
it "raises exceptions for examples with no expectations" do
@out.should include <<-EOS
2)
MSpec expectation method #should registers that an expectation has been encountered FAILED
No behavior expectation was found in the example
EOS
end
end
describe "#should_not" do
it "records failures" do
@out.should include <<-EOS
3)
MSpec expectation method #should_not causes a failure to be recorded FAILED
Expected 1 == 1
to be falsy but was true
EOS
end
it "raises exceptions for examples with no expectations" do
@out.should include <<-EOS
4)
MSpec expectation method #should_not registers that an expectation has been encountered FAILED
No behavior expectation was found in the example
EOS
end
it 'prints a deprecation message about using `{}.should_not raise_error`' do
@out.should include "->{}.should_not raise_error is deprecated, use a matcher to verify the result instead."
@out.should =~ /from .+spec\/expectations\/should.rb:75:in `block \(2 levels\) in <main>'/
end
end
it "prints status information" do
@out.should include ".FF..FF."
end
it "prints out a summary" do
@out.should include "0 files, 9 examples, 7 expectations, 4 failures, 0 errors"
end
it "records expectations" do
@out.should include "I was called 7 times"
end
end