forked from sds/scss-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugins_spec.rb
54 lines (43 loc) · 1.44 KB
/
plugins_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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