Sha256: 2a0454356fd24cc5a9627ce0157e9d1095efe1870a3181a138ebc9c526b8f7e3

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

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

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

      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: 'com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck',
            severity: 'error',
            message: 'Missing a Javadoc comment.'
          }, {
            file: file,
            line: '1',
            column: '14',
            length: nil,
            rule: 'com.puppycrawl.tools.checkstyle.checks.naming.TypeNameCheck',
            severity: 'error',
            message: "Name 'bad' must match pattern '^[A-Z][a-zA-Z0-9]*$'."
          }
        )
      end
    end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lint_trap-0.0.19 spec/integration/checkstyle_spec.rb
lint_trap-0.0.18 spec/integration/checkstyle_spec.rb
lint_trap-0.0.17 spec/integration/checkstyle_spec.rb
lint_trap-0.0.16 spec/integration/checkstyle_spec.rb