+ it 'returns correct number of errors' do
+ expect(run.count).to eql(5)
+ end
+
+ it 'has correct first message' do
+ expect(run.first.msg).to eql("'foo' is not defined.")
+ end
+
+ context(
+ 'with files to lint config that never matches',
+ config: { 'files_to_lint' => 'will never match' }
+ ) do
+ it 'returns zero errors' do
+ expect(run.count).to eql(0)
+ end
+ end
+
+ context(
+ 'with files to lint config that matches only .js',
+ config: { 'files_to_lint' => '\.js$' }
+ ) do
+ it 'returns correct amount of errors' do
+ expect(run.count).to eql(2)
+ end
+ end
+
+ context(
+ 'with different eslint executable',
+ config: { 'eslint_executable' => './custom_eslint.sh' }
+ ) do
+ it 'calls the custom eslint eslint_executable' do
+ expect { run }.to raise_error(JSON::ParserError, /custom eslint called/)
+ end
+ end