Sha256: 70a10a996c57c1c38d73c199d9d6b0f57b2eea68382dad0d135f3e8b35f08f6e

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'

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

  it_behaves_like 'linter'

  its(:languages){is_expected.to eq([LintTrap::Language::CoffeeScript.new])}
  its(:version){is_expected.to eq('1.9.7')}
  its(:image){is_expected.to eq('lintci/coffeelint')}
  its(:image_version){is_expected.to eq('lintci/coffeelint:1.9.7')}

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

      it 'runs the lint command with the correct arguments' do
        expect(LintTrap::Command).to receive(:new).with(
          'coffeelint',
          [
            "--reporter=#{container.config_path(described_class::REPORTER)}",
            '--nocolor',
            '--file=coffeelint.json'
          ],
          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(
          'coffeelint',
          [
            "--reporter=#{container.config_path(described_class::REPORTER)}",
            '--nocolor'
          ],
          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/coffeelint_spec.rb
lint_trap-0.0.18 spec/linter/coffeelint_spec.rb
lint_trap-0.0.17 spec/linter/coffeelint_spec.rb
lint_trap-0.0.16 spec/linter/coffeelint_spec.rb