|
15 | 15 | before do
|
16 | 16 | result = double('result')
|
17 | 17 | result.stub(:success?).and_return(true)
|
| 18 | + result.stub(:stderr).and_return('') |
18 | 19 | result.stub(:stdout).and_return('')
|
19 | 20 | subject.stub(:execute).and_return(result)
|
20 | 21 | end
|
21 | 22 |
|
22 | 23 | it { should pass }
|
23 | 24 | end
|
24 | 25 |
|
25 |
| - context 'when stylelint exits unsucessfully' do |
| 26 | + context 'when stylelint exits unsucessfully with messages on stdout (stylelint < 16)' do |
26 | 27 | let(:result) { double('result') }
|
27 | 28 |
|
28 | 29 | before do
|
|
32 | 33 | context 'and it reports an error' do
|
33 | 34 | before do
|
34 | 35 | result.stub(:success?).and_return(false)
|
| 36 | + result.stub(:stderr).and_return('') |
35 | 37 | result.stub(:stdout).and_return([
|
36 | 38 | 'index.css: line 4, col 4, error - Expected indentation of 2 spaces (indentation)',
|
37 | 39 | 'form.css: line 10, col 6, error - Expected indentation of 4 spaces (indentation)',
|
|
45 | 47 | end
|
46 | 48 | end
|
47 | 49 | end
|
| 50 | + |
| 51 | + context 'when stylelint exits unsucessfully with messages on stderr (stylelint >= 16)' do |
| 52 | + let(:result) { double('result') } |
| 53 | + |
| 54 | + before do |
| 55 | + subject.stub(:execute).and_return(result) |
| 56 | + end |
| 57 | + |
| 58 | + context 'and it reports an error' do |
| 59 | + before do |
| 60 | + result.stub(:success?).and_return(false) |
| 61 | + result.stub(:stdout).and_return('') |
| 62 | + result.stub(:stderr).and_return([ |
| 63 | + 'index.css: line 4, col 4, error - Expected indentation of 2 spaces (indentation)', |
| 64 | + 'form.css: line 10, col 6, error - Expected indentation of 4 spaces (indentation)', |
| 65 | + ].join("\n")) |
| 66 | + end |
| 67 | + |
| 68 | + it { should fail_hook } |
| 69 | + |
| 70 | + it 'extracts lines numbers correctly from output' do |
| 71 | + expect(subject.run.map(&:line)).to eq([4, 10]) |
| 72 | + end |
| 73 | + end |
| 74 | + end |
48 | 75 | end
|
0 commit comments