Sha256: 046d6d5e7dc47fc65c9b6073d27a2add85a77f506815a26c70119f35dd6ae5a6

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::RuboCop 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?('RUBOCOP_VERSION', linter.version)).to be_truthy
    end
  end

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

      it 'generates lint' do
        expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
          {
            file: file,
            line: '1',
            column: '1',
            length: '5',
            rule: 'Style/Documentation',
            severity: 'convention',
            message: 'Missing top-level class documentation comment.'
          }, {
            file: file,
            line: '2',
            column: '7',
            length: '4',
            rule: 'Style/MethodName',
            severity: 'convention',
            message: 'Use snake_case for method names.'
          }
        )
      end
    end

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

      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/rubocop_spec.rb
lint_trap-0.0.14 spec/integration/rubocop_spec.rb