Sha256: ed29f0fc0007b9e00ea92e395f05ab6c33b153e7857c7cef0e50550d5eeacf00

Contents?: true

Size: 1.25 KB

Versions: 50

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe SCSSLint::LinterRegistry do
  context 'when including the LinterRegistry module' do
    after do
      described_class.linters.delete(FakeLinter)
    end

    it 'adds the linter to the set of registered linters' do
      expect do
        class FakeLinter < SCSSLint::Linter
          include SCSSLint::LinterRegistry
        end
      end.to change { described_class.linters.count }.by(1)
    end
  end

  describe '.extract_linters_from' do
    module SCSSLint
      class Linter::SomeLinter < Linter; end
      class Linter::SomeOtherLinter < Linter; end
    end

    let(:linters) do
      [SCSSLint::Linter::SomeLinter, SCSSLint::Linter::SomeOtherLinter]
    end

    before do
      described_class.stub(:linters).and_return(linters)
    end

    context 'when the linters exist' do
      let(:linter_names) { %w[SomeLinter SomeOtherLinter] }

      it 'returns the linters' do
        subject.extract_linters_from(linter_names).should == linters
      end
    end

    context "when the linters don't exist" do
      let(:linter_names) { ['SomeRandomLinter'] }

      it 'raises an error' do
        expect do
          subject.extract_linters_from(linter_names)
        end.to raise_error(SCSSLint::NoSuchLinter)
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 3 rubygems

Version Path
scss-lint-0.33.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.32.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.31.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.30.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.29.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.28.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.27.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.26.2 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.26.1 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.26.0 spec/scss_lint/linter_registry_spec.rb