Sha256: 6a6b9f86cfea069ba5bd29c39c638c2fc2e70a7f6864f175cd4d5d78569916d9

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

module SCSSLint
  describe Plugins do
    let(:subject) { described_class.new(Config.new(config_options)) }

    describe '#load' do
      context 'when gem plugins are specified' do
        let(:config_options) { { 'plugin_gems' => ['a_gem'] } }
        let(:plugin) { double(load: nil) }

        before do
          Plugins::LinterGem.stub(:new).with('a_gem').and_return(plugin)
        end

        it 'loads the plugin' do
          plugin.should_receive(:load)
          subject.load
        end
      end

      context 'when directory plugins are specified' do
        let(:config_options) { { 'plugin_directories' => ['some_dir'] } }
        let(:plugin) { double(load: nil) }

        before do
          Plugins::LinterDir.stub(:new).with('some_dir').and_return(plugin)
        end

        it 'loads the plugin' do
          plugin.should_receive(:load)
          subject.load
        end
      end

      context 'when plugins options are empty lists' do
        let(:config_options) { { 'plugin_directories' => [], 'plugin_gems' => [] } }

        it 'returns empty array' do
          subject.load.should == []
        end
      end

      context 'when no plugins options are specified' do
        let(:config_options) { {} }

        it 'returns empty array' do
          subject.load.should == []
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
scss_lint-0.44.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.43.2 spec/scss_lint/plugins_spec.rb
scss_lint-0.43.1 spec/scss_lint/plugins_spec.rb
scss_lint-0.43.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.42.2 spec/scss_lint/plugins_spec.rb
scss_lint-0.42.1 spec/scss_lint/plugins_spec.rb
scss_lint-0.42.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.41.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.40.1 spec/scss_lint/plugins_spec.rb
scss_lint-0.40.0 spec/scss_lint/plugins_spec.rb