Sha256: 5f3d4ccb4ac761c0da4aa586ffe18404a7d66d0e7d60869675010abcfebef68d

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::PyLint do
  let(:container){LintTrap::Container::Fake.new}
  let(:config){nil}
  let(:files){%w(good.py bad.py)}
  subject(:linter){described_class.new(container: container, config: config)}
  let(:command){instance_double(LintTrap::Command)}

  describe '#lint' do
    context 'when config is provided' do
      let(: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', config
          ],
          files
        ).and_return(command)
        expect(command).to receive(:run).with(container)

        linter.lint(files)
      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)

        linter.lint(files)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.6 spec/linter/pylint_spec.rb
lint_trap-0.0.5 spec/linter/pylint_spec.rb
lint_trap-0.0.4 spec/linter/pylint_spec.rb
lint_trap-0.0.3 spec/linter/pylint_spec.rb