let(:eslint) { ESLintNpm.new(patches) }
describe '#run' do
- subject { eslint.run }
+ subject(:run) { eslint.run }
context 'patches are nil' do
let(:patches) { nil }
- it { should == [] }
+
+ it 'returns an empty array' do
+ expect(run).to eql([])
+ end
end
context 'no patches' do
let(:patches) { [] }
- it { should == [] }
+
+ it 'returns an empty array' do
+ expect(run).to eql([])
+ end
end
context 'patches with a one and a four warnings' do
let(:patches) { repo.diff('master') }
- its(:count) { should == 5 }
- its(:'first.msg') { should == "'foo' is not defined." }
+ 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
end
context 'repo with ignored and not ignored file, each with three warnings' do
let(:patches) { repo.diff('master') }
- its(:count) { should == 3 }
- its(:'first.msg') { should == "'HelloWorld' is defined but never used." }
+ it 'returns correct number of errors' do
+ expect(run.count).to eql(3)
+ end
+
+ it 'has correct first message' do
+ expect(run.first.msg).to eql("'HelloWorld' is defined but never used.")
+ end
end
end
end
+require 'fileutils'
require 'rspec'
require 'rspec/its'
require 'pronto/eslint_npm'
after { FileUtils.mv(dot_git, git) }
end
end
-
-RSpec.configure do |config|
- config.expect_with(:rspec) { |c| c.syntax = :should }
- config.mock_with(:rspec) { |c| c.syntax = :should }
-end