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.45.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.44.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.43.2 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.43.1 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.43.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.42.2 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.42.1 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.42.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.41.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.40.1 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.40.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.39.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.38.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.38.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-bliss-1.0.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.37.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.36.1 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.36.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.35.0 spec/scss_lint/linter_registry_spec.rb
scss-lint-0.34.0 spec/scss_lint/linter_registry_spec.rb