|
2 | 2 |
|
3 | 3 | describe Lint do
|
4 | 4 | let(:linter) { Lint.new('./test_files/test_file.css') }
|
5 |
| - let(:test_white1) { ' background-color: whitesmoke ' } |
6 |
| - let(:test_white2) { ' margin: 0px;' } |
7 | 5 |
|
8 | 6 | it 'Checks the trailing white linter - FINDS AN ERROR' do
|
9 |
| - linter.curr_text = test_white1 |
| 7 | + linter.curr_text = ' background-color: whitesmoke ' |
10 | 8 | linter.curr_line = 4
|
11 | 9 | expect(linter.trailing_white_linter.is_a?(File)).to eql(true)
|
12 | 10 | end
|
13 | 11 |
|
14 | 12 | it 'Checks the trailing white linter - NO ERROR' do
|
15 |
| - linter.curr_text = test_white2 |
| 13 | + linter.curr_text = ' margin: 0px;' |
16 | 14 | linter.curr_line = 4
|
17 | 15 | expect(linter.trailing_white_linter).to eql(nil)
|
18 | 16 | end
|
|
121 | 119 | expect(linter.declaration_space_linter).to eql(nil)
|
122 | 120 | end
|
123 | 121 |
|
124 |
| - it 'Checks the line type method' do |
125 |
| - |
| 122 | + it 'Checks the line type method TYPE 1: Comment line' do |
| 123 | + linter.curr_text = test_comment1 |
| 124 | + linter.curr_line = 4 |
| 125 | + expect(linter.type_of_line).to eql('comment') |
| 126 | + end |
| 127 | + |
| 128 | + it 'Checks the line type method TYPE 2: Beginning of block line' do |
| 129 | + linter.curr_text = test_bracket1 |
| 130 | + linter.curr_line = 4 |
| 131 | + expect(linter.type_of_line).to eql('block start') |
| 132 | + end |
| 133 | + |
| 134 | + it 'Checks the line type method TYPE 3: End of block line' do |
| 135 | + linter.curr_text = '}' |
| 136 | + linter.curr_line = 4 |
| 137 | + expect(linter.type_of_line).to eql('block end') |
| 138 | + end |
| 139 | + |
| 140 | + it 'Checks the line type method TYPE 4: Empty line - CASE 1' do |
| 141 | + linter.curr_text = '' |
| 142 | + linter.curr_line = 4 |
| 143 | + expect(linter.type_of_line).to eql('empty line') |
| 144 | + end |
| 145 | + |
| 146 | + it 'Checks the line type method TYPE 4: Empty line - CASE 2' do |
| 147 | + linter.curr_text = ' ' |
| 148 | + linter.curr_line = 4 |
| 149 | + expect(linter.type_of_line).to eql('empty line') |
| 150 | + end |
| 151 | + |
| 152 | + it 'Checks the line type method TYPE 5: Regular line' do |
| 153 | + linter.curr_text = ';' |
| 154 | + linter.curr_line = 4 |
| 155 | + expect(linter.type_of_line).to eql('regular') |
126 | 156 | end
|
127 | 157 | end
|
0 commit comments