Sha256: 815c4ccaa8c7a1ea40fef2a8618a27348a69b6d962b7a819e0d79ceded405c46

Contents?: true

Size: 1.65 KB

Versions: 5

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::JSHint do
  let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
  let(:options){{}}
  subject(:linter){described_class.new}

  describe '#lint' do
    context 'when linting a bad file' do
      let(:file){fixture_path('bad.js')}

      it 'generates lint' do
        expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
          {
            file: file,
            line: '2',
            column: '13',
            length: nil,
            rule: 'E031',
            severity: 'error',
            message: 'Bad assignment.'
          }, {
            file: file,
            line: '2',
            column: '13',
            length: nil,
            rule: 'W030',
            severity: 'warning',
            message:
             'Expected an assignment or function call and instead saw an expression.'
          }, {
            file: file,
            line: '2',
            column: '14',
            length: nil,
            rule: 'W033',
            severity: 'warning',
            message: 'Missing semicolon.'
          }, {
            file: file,
            line: '2',
            column: '15',
            length: nil,
            rule: 'W030',
            severity: 'warning',
            message:
             'Expected an assignment or function call and instead saw an expression.'
          }
        )
      end
    end

    context 'when linting a good file' do
      let(:file){fixture_path('good.js')}

      it 'generates no lint' do
        expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lint_trap-0.0.11 spec/integration/jshint_spec.rb
lint_trap-0.0.10 spec/integration/jshint_spec.rb
lint_trap-0.0.9 spec/integration/jshint_spec.rb
lint_trap-0.0.8 spec/integration/jshint_spec.rb
lint_trap-0.0.7 spec/integration/jshint_spec.rb