aboutsummaryrefslogtreecommitdiffhomepage
path: root/spec/pronto
diff options
context:
space:
mode:
authorMarkus Doits <markus.doits@stellenticket.de>2018-03-31 18:34:01 +0200
committerMarkus Doits <markus.doits@stellenticket.de>2018-03-31 18:42:20 +0200
commitc89a62b8e91dc1329aee92392eb32a51a25a8315 (patch)
tree199de267f89a7d17752a8540eeee0922c40700ce /spec/pronto
parented98da4ce890259abc2d82006325be9f37e69908 (diff)
downloadpronto-hlint-c89a62b8e91dc1329aee92392eb32a51a25a8315.tar.gz
pronto-hlint-c89a62b8e91dc1329aee92392eb32a51a25a8315.tar.zst
pronto-hlint-c89a62b8e91dc1329aee92392eb32a51a25a8315.zip
refactor config handling and specs a little bit
Diffstat (limited to 'spec/pronto')
-rw-r--r--spec/pronto/eslint_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/pronto/eslint_spec.rb b/spec/pronto/eslint_spec.rb
index 52e52f2..a00a05b 100644
--- a/spec/pronto/eslint_spec.rb
+++ b/spec/pronto/eslint_spec.rb
@@ -100,6 +100,45 @@ module Pronto
100 it 'is `eslint` by default' do 100 it 'is `eslint` by default' do
101 expect(eslint_executable).to eql('eslint') 101 expect(eslint_executable).to eql('eslint')
102 end 102 end
103
104 context(
105 'with different eslint executable config',
106 config: { 'eslint_executable' => 'custom_eslint' }
107 ) do
108 it 'is correct' do
109 eslint.read_config
110 expect(eslint_executable).to eql('custom_eslint')
111 end
112 end
113 end
114
115 describe '#eslint_command_line' do
116 subject(:eslint_command_line) { eslint.send(:eslint_command_line, path) }
117 let(:path) { '/some/path.rb' }
118
119 it 'adds json output flag' do
120 expect(eslint_command_line).to include('-f json')
121 end
122
123 it 'adds path' do
124 expect(eslint_command_line).to include(path)
125 end
126
127 it 'starts with eslint executable' do
128 expect(eslint_command_line).to start_with(eslint.eslint_executable)
129 end
130
131 context 'with path that should be escaped' do
132 let(:path) { '/must be/$escaped' }
133
134 it 'escapes the path correctly' do
135 expect(eslint_command_line).to include('/must\\ be/\\$escaped')
136 end
137
138 it 'does not include unescaped path' do
139 expect(eslint_command_line).not_to include(path)
140 end
141 end
103 end 142 end
104 end 143 end
105end 144end