]>
Commit | Line | Data |
---|---|---|
9be00a32 MM |
1 | require 'spec_helper' |
2 | ||
3 | module Pronto | |
5001cb27 MD |
4 | describe ESLintNpm do |
5 | let(:eslint) { ESLintNpm.new(patches) } | |
9be00a32 MM |
6 | |
7 | describe '#run' do | |
b338a7ad | 8 | subject { eslint.run } |
9be00a32 MM |
9 | |
10 | context 'patches are nil' do | |
11 | let(:patches) { nil } | |
12 | it { should == [] } | |
13 | end | |
14 | ||
15 | context 'no patches' do | |
16 | let(:patches) { [] } | |
17 | it { should == [] } | |
18 | end | |
19 | ||
29509625 | 20 | context 'patches with a one and a four warnings' do |
9be00a32 MM |
21 | include_context 'test repo' |
22 | ||
23 | let(:patches) { repo.diff('master') } | |
24 | ||
29509625 MD |
25 | its(:count) { should == 5 } |
26 | its(:'first.msg') { should == "'foo' is not defined." } | |
9be00a32 | 27 | end |
fb94b0e6 | 28 | |
29509625 | 29 | context 'repo with ignored and not ignored file, each with three warnings' do |
fb94b0e6 MD |
30 | include_context 'eslintignore repo' |
31 | ||
32 | let(:patches) { repo.diff('master') } | |
33 | ||
29509625 | 34 | its(:count) { should == 3 } |
ca6d2bf5 | 35 | its(:'first.msg') { should == "'HelloWorld' is defined but never used." } |
fb94b0e6 | 36 | end |
9be00a32 MM |
37 | end |
38 | end | |
39 | end |