Skip to content

Commit e5b0cdd

Browse files
committed
Add line type method tests in rspec
1 parent 9c75951 commit e5b0cdd

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

spec/lint_spec.rb

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
describe Lint do
44
let(:linter) { Lint.new('./test_files/test_file.css') }
5-
let(:test_white1) { ' background-color: whitesmoke ' }
6-
let(:test_white2) { ' margin: 0px;' }
75

86
it 'Checks the trailing white linter - FINDS AN ERROR' do
9-
linter.curr_text = test_white1
7+
linter.curr_text = ' background-color: whitesmoke '
108
linter.curr_line = 4
119
expect(linter.trailing_white_linter.is_a?(File)).to eql(true)
1210
end
1311

1412
it 'Checks the trailing white linter - NO ERROR' do
15-
linter.curr_text = test_white2
13+
linter.curr_text = ' margin: 0px;'
1614
linter.curr_line = 4
1715
expect(linter.trailing_white_linter).to eql(nil)
1816
end
@@ -121,7 +119,39 @@
121119
expect(linter.declaration_space_linter).to eql(nil)
122120
end
123121

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')
126156
end
127157
end

0 commit comments

Comments
 (0)