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



                     
                                        

                      
                            










                                  
                                                          



                                             
                                   

                                                                          








                                                                                  


       
require 'spec_helper'

module Pronto
  describe ESLint do
    let(:eslint) { ESLint.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 four and a five warnings' do
        include_context 'test repo'

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

        its(:count) { should == 9 }
        its(:'first.msg') { should == "Expected { after 'if' condition." }
      end

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

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

        its(:count) { should == 5 }
        its(:'first.msg') { should == "Use the function form of 'use strict'." }
      end
    end
  end
end