Sha256: e4d0d42fe48c186ecf0f352721ddd60992df27a7e9f8bfad50c3805f3a13e004

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::PyLint do
  let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
  let(:options){{}}
  subject(:linter){described_class.new}

  describe '#version' do
    subject(:dockerfile){Dockerfile.new(linter.name)}

    it 'matches the linters version' do
      expect(dockerfile.include_env?('PYLINT_VERSION', linter.version)).to be_truthy
    end
  end

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

      it 'generates lint' do
        expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
          {
            file: file,
            line: '1',
            column: '0',
            length: nil,
            rule: 'missing-docstring',
            severity: 'convention',
            message: 'Missing module docstring'
          }, {
            file: file,
            line: '1',
            column: '0',
            length: nil,
            rule: 'missing-docstring',
            severity: 'convention',
            message: 'Missing function docstring'}
        )
      end
    end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lint_trap-0.0.15 spec/integration/pylint_spec.rb
lint_trap-0.0.14 spec/integration/pylint_spec.rb