Sha256: 938b4af87bb254669c798e31e8d0080f5b37599bb97290cf6ffd6c84e903532c

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::SCSSLint do
  let(:container){LintTrap::Container::Fake.new}
  let(:config){nil}
  let(:files){%w(good.scss bad.scss)}
  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){'.scss-lint.yml'}

      it 'runs the lint command with the correct arguments' do
        expect(LintTrap::Command).to receive(:new).with(
          container.config_path(described_class::COMMAND),
          [
            '--format=LintTrap',
            '--config', '.scss-lint.yml'
          ],
          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(
          container.config_path(described_class::COMMAND),
          [
            '--format=LintTrap'
          ],
          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/scsslint_spec.rb
lint_trap-0.0.5 spec/linter/scsslint_spec.rb
lint_trap-0.0.4 spec/linter/scsslint_spec.rb
lint_trap-0.0.3 spec/linter/scsslint_spec.rb