Sha256: 2480f30b5f8615269b1f3aee855cc848370ba7acb34cb0db2e622de3eebcd8aa

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe SCSSLint::Plugins::LinterDir do
  let(:plugin_directory) { File.expand_path('../../fixtures/plugins', __FILE__) }
  let(:subject) { described_class.new(plugin_directory) }

  describe '#load' do
    let(:config_file) { File.join(plugin_directory, '.scss-lint.yml') }
    let(:config_file_exists) { false }

    before do
      File.stub(:exist?).with(config_file).and_return(config_file_exists)
    end

    it 'requires each file in the plugin directory' do
      subject.should_receive(:require)
             .with(File.join(plugin_directory, 'linter_plugin.rb')).once

      subject.load
    end

    context 'when the dir does not include a configuration file' do
      it 'loads an empty configuration' do
        subject.load
        subject.config.should == SCSSLint::Config.new({})
      end
    end

    context 'when a config file exists in the dir' do
      let(:config_file_exists) { true }
      let(:fake_config) { SCSSLint::Config.new('linters' => { 'FakeLinter' => {} }) }

      before do
        SCSSLint::Config.should_receive(:load)
                        .with(config_file, merge_with_default: false)
                        .and_return(fake_config)
      end

      it 'loads the configuration' do
        subject.load
        subject.config.should == fake_config
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scss_lint-0.57.1 spec/scss_lint/plugins/linter_dir_spec.rb
scss_lint-0.57.0 spec/scss_lint/plugins/linter_dir_spec.rb
scss_lint-0.56.0 spec/scss_lint/plugins/linter_dir_spec.rb
scss_lint-0.55.0 spec/scss_lint/plugins/linter_dir_spec.rb
scss_lint-0.54.0 spec/scss_lint/plugins/linter_dir_spec.rb
scss_lint-0.53.0 spec/scss_lint/plugins/linter_dir_spec.rb
scss_lint-0.52.0 spec/scss_lint/plugins/linter_dir_spec.rb