forked from troessner/reek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_spec.rb
29 lines (24 loc) · 885 Bytes
/
script_spec.rb
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
require 'reek'
describe 'exit status', 'when reek is used correctly' do
it 'should return non-zero status when smells are reported' do
`echo "def x() 3; end" | ruby -Ilib bin/reek`
$?.exitstatus.should == 2
end
it 'should return zero status with no smells' do
`echo "def simple() @fred = 3 end" | ruby -Ilib bin/reek`
$?.exitstatus.should == 0
end
end
describe 'report format', 'with one source' do
it 'should output nothing with empty source' do
`echo "" | ruby -Ilib bin/reek`.should be_empty
end
it 'should output nothing when no smells' do
`echo "def simple() @fred = 3; end" | ruby -Ilib bin/reek`.should be_empty
end
it 'should not adorn the list of warnings' do
report = `echo "class Turn; def y() @x = 3; end end" | ruby -Ilib bin/reek`
report.split(/\n/).length.should == 2
report.should_not match(/\n\n/)
end
end