Sha256: 7d16f016bdff8547222e425b2872629ca38918c35735f0d5527e8d70bdafa94b

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 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){described_class.new}
  let(:command){instance_double(LintTrap::Command)}

  it_behaves_like 'linter'

  its(:languages){is_expected.to eq([LintTrap::Language::CoffeeScript.new])}

  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)

        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)

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lint_trap-0.0.11 spec/linter/coffeelint_spec.rb
lint_trap-0.0.10 spec/linter/coffeelint_spec.rb
lint_trap-0.0.9 spec/linter/coffeelint_spec.rb