aboutsummaryrefslogblamecommitdiffhomepage
path: root/spec/pronto/eslint_spec.rb
blob: 63d0d684727f3f37de0ea7e86cdcd41f0df449fa (plain) (tree)
1
2
3
4
5
6
7
8


                     

                                           

                      
                            










                                  
                                                         



                                             

                                                               
         
 
                                                                                   



                                             
                                   
                                                                                 
         


       
require 'spec_helper'

module Pronto
  describe ESLintNpm do
    let(:eslint) { ESLintNpm.new(patches) }

    describe '#run' do
      subject { eslint.run }

      context 'patches are nil' do
        let(:patches) { nil }
        it { should == [] }
      end

      context 'no patches' do
        let(:patches) { [] }
        it { should == [] }
      end

      context 'patches with a one and a four warnings' do
        include_context 'test repo'

        let(:patches) { repo.diff('master') }

        its(:count) { should == 5 }
        its(:'first.msg') { should == "'foo' is not defined." }
      end

      context 'repo with ignored and not ignored file, each with three warnings' do
        include_context 'eslintignore repo'

        let(:patches) { repo.diff('master') }

        its(:count) { should == 3 }
        its(:'first.msg') { should == "'HelloWorld' is defined but never used." }
      end
    end
  end
end