Sha256: 608921dfd0238a39cf078289c9d64a9551b4ad1e100711ac0790807597b31724

Contents?: true

Size: 1.44 KB

Versions: 21

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

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

    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) }
        let(:plugin_dir) { File.join(File.dirname(Config.user_file), 'some_dir') }

        before do
          Plugins::LinterDir.stub(:new).with(plugin_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

21 entries across 21 versions & 1 rubygems

Version Path
scss_lint-0.60.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.59.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.58.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.57.1 spec/scss_lint/plugins_spec.rb
scss_lint-0.57.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.56.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.55.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.54.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.53.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.52.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.51.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.50.3 spec/scss_lint/plugins_spec.rb
scss_lint-0.50.2 spec/scss_lint/plugins_spec.rb
scss_lint-0.50.1 spec/scss_lint/plugins_spec.rb
scss_lint-0.50.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.49.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.48.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.47.1 spec/scss_lint/plugins_spec.rb
scss_lint-0.47.0 spec/scss_lint/plugins_spec.rb
scss_lint-0.46.0 spec/scss_lint/plugins_spec.rb