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.60.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.59.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.58.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.57.1 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.57.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.56.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.55.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.54.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.53.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.52.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.51.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.50.3 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.50.2 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.50.1 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.50.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.49.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.48.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.47.1 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.47.0 spec/scss_lint/linter_registry_spec.rb
scss_lint-0.46.0 spec/scss_lint/linter_registry_spec.rb