Sha256: ff1918b7c1ae66264e29f406a39f29231c62cef504b0a2c31b8fd798e7c3a0e5

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::PyLint do
  let(:container){LintTrap::Container::Fake.new}
  let(:options){{}}
  let(:files){%w(good.py bad.py)}
  subject(:linter){LintTrap::Linter.find('PyLint')}
  let(:command){instance_double(LintTrap::Command)}

  it_behaves_like 'linter'

  its(:languages){is_expected.to eq([LintTrap::Language::Python.new])}
  its(:version){is_expected.to eq('1.3.1-3')}
  its(:image){is_expected.to eq('lintci/pylint')}
  its(:image_version){is_expected.to eq('lintci/pylint:1.3.1-3')}

  describe '#lint' do
    context 'when config is provided' do
      let(:options){{config: '.pylintrc'}}

      it 'runs the lint command with the correct arguments' do
        expect(LintTrap::Command).to receive(:new).with(
          'pylint',
          [
            '-r', 'no',
            '--msg-template', '"{abspath}:{line}:{column}::{symbol}:{category}:{msg}"',
            '--rcfile', options[:config]
          ],
          files
        ).and_return(command)
        expect(command).to receive(:run).with(container).and_return(true)

        linter.lint(files, container, options)
      end
    end

    context 'when config is not provided' do
      it 'runs the lint command with the correct arguments' do
        expect(LintTrap::Command).to receive(:new).with(
          'pylint',
          [
            '-r', 'no',
            '--msg-template', '"{abspath}:{line}:{column}::{symbol}:{category}:{msg}"'
          ],
          files
        ).and_return(command)
        expect(command).to receive(:run).with(container).and_return(true)

        linter.lint(files, container, options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.19 spec/linter/pylint_spec.rb
lint_trap-0.0.18 spec/linter/pylint_spec.rb
lint_trap-0.0.17 spec/linter/pylint_spec.rb
lint_trap-0.0.16 spec/linter/pylint_spec.rb