lint_trap 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lint_trap/command.rb +2 -2
  3. data/lib/lint_trap/language/base.rb +5 -5
  4. data/lib/lint_trap/language/coffeescript.rb +1 -1
  5. data/lib/lint_trap/language/cpp.rb +2 -2
  6. data/lib/lint_trap/language/css.rb +1 -1
  7. data/lib/lint_trap/language/go.rb +1 -1
  8. data/lib/lint_trap/language/java.rb +1 -1
  9. data/lib/lint_trap/language/javascript.rb +1 -1
  10. data/lib/lint_trap/language/json.rb +1 -1
  11. data/lib/lint_trap/language/python.rb +1 -1
  12. data/lib/lint_trap/language/ruby.rb +1 -1
  13. data/lib/lint_trap/language/scss.rb +1 -1
  14. data/lib/lint_trap/language.rb +3 -2
  15. data/lib/lint_trap/linter/base.rb +8 -11
  16. data/lib/lint_trap/linter.rb +4 -2
  17. data/lib/lint_trap/version.rb +1 -1
  18. data/spec/command_spec.rb +8 -21
  19. data/spec/integration/checkstyle_spec.rb +6 -15
  20. data/spec/integration/coffeelint_spec.rb +6 -15
  21. data/spec/integration/cppcheck_spec.rb +6 -15
  22. data/spec/integration/csslint_spec.rb +6 -15
  23. data/spec/integration/golint_spec.rb +6 -15
  24. data/spec/integration/jshint_spec.rb +6 -15
  25. data/spec/integration/jsonlint_spec.rb +6 -15
  26. data/spec/integration/pylint_spec.rb +6 -15
  27. data/spec/integration/rubocop_spec.rb +6 -15
  28. data/spec/integration/scsslint_spec.rb +6 -15
  29. data/spec/language/coffeescript_spec.rb +1 -1
  30. data/spec/language/cpp_spec.rb +1 -1
  31. data/spec/language/css_spec.rb +1 -1
  32. data/spec/language/go_spec.rb +1 -1
  33. data/spec/language/java_spec.rb +1 -1
  34. data/spec/language/javascript_spec.rb +1 -1
  35. data/spec/language/json_spec.rb +1 -1
  36. data/spec/language/python_spec.rb +1 -1
  37. data/spec/language/ruby_spec.rb +1 -1
  38. data/spec/language/scss_spec.rb +1 -1
  39. data/spec/language_spec.rb +20 -20
  40. data/spec/linter/checkstyle_spec.rb +6 -6
  41. data/spec/linter/coffeelint_spec.rb +5 -5
  42. data/spec/linter/cppcheck_spec.rb +3 -3
  43. data/spec/linter/csslint_spec.rb +5 -5
  44. data/spec/linter/golint_spec.rb +3 -3
  45. data/spec/linter/jshint_spec.rb +6 -6
  46. data/spec/linter/jsonlint_spec.rb +3 -3
  47. data/spec/linter/pylint_spec.rb +6 -6
  48. data/spec/linter/rubocop_spec.rb +6 -6
  49. data/spec/linter/scsslint_spec.rb +5 -5
  50. data/spec/linter_spec.rb +16 -10
  51. data/spec/spec_helper.rb +1 -0
  52. metadata +2 -2
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::SCSSLint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.scss')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '2',
@@ -27,18 +28,8 @@ describe LintTrap::Linter::SCSSLint do
27
28
  let(:file){fixture_path('good.scss')}
28
29
 
29
30
  it 'generates no lint' do
30
- expect{|b| linter.lint([file], &b)}.to_not yield_control
31
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
31
32
  end
32
33
  end
33
34
  end
34
-
35
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
36
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
37
-
38
- it_behaves_like '#lint'
39
- end
40
-
41
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
42
- it_behaves_like '#lint'
43
- end
44
35
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::CoffeeScript do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('CoffeeScript')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::CoffeeLint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::CoffeeLint.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::CPP do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('C++')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::CPPCheck])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::CPPCheck.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::CSS do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('CSS')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::CSSLint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::CSSLint.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::Go do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('Go')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::GoLint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::GoLint.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::Java do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('Java')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::CheckStyle])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::CheckStyle.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::JavaScript do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('JavaScript')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::JSHint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::JSHint.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::JSON do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('JSON')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::JSONLint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::JSONLint.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::Python do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('Python')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::PyLint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::PyLint.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::Ruby do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('Ruby')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::RuboCop])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::RuboCop.new])}
8
8
  end
@@ -4,5 +4,5 @@ describe LintTrap::Language::SCSS do
4
4
  subject(:language){described_class.new}
5
5
 
6
6
  its(:name){is_expected.to eq('SCSS')}
7
- its(:linters){is_expected.to eq([LintTrap::Linter::SCSSLint])}
7
+ its(:linters){is_expected.to eq([LintTrap::Linter::SCSSLint.new])}
8
8
  end
@@ -7,61 +7,61 @@ describe LintTrap::Language do
7
7
  context 'when given a CoffeeScript file' do
8
8
  let(:file){fixture_path('good.coffee')}
9
9
 
10
- it{is_expected.to eq(described_class::CoffeeScript)}
10
+ it{is_expected.to be_a(described_class::CoffeeScript)}
11
11
  end
12
12
 
13
13
  context 'when given a C++ file' do
14
14
  let(:file){fixture_path('good.cpp')}
15
15
 
16
- it{is_expected.to eq(described_class::CPP)}
16
+ it{is_expected.to be_a(described_class::CPP)}
17
17
  end
18
18
 
19
19
  context 'when given a CSS file' do
20
20
  let(:file){fixture_path('good.css')}
21
21
 
22
- it{is_expected.to eq(described_class::CSS)}
22
+ it{is_expected.to be_a(described_class::CSS)}
23
23
  end
24
24
 
25
25
  context 'when given a Go file' do
26
26
  let(:file){fixture_path('good.go')}
27
27
 
28
- it{is_expected.to eq(described_class::Go)}
28
+ it{is_expected.to be_a(described_class::Go)}
29
29
  end
30
30
 
31
31
  context 'when given a Java file' do
32
32
  let(:file){fixture_path('Good.java')}
33
33
 
34
- it{is_expected.to eq(described_class::Java)}
34
+ it{is_expected.to be_a(described_class::Java)}
35
35
  end
36
36
 
37
37
  context 'when given a JavaScript file' do
38
38
  let(:file){fixture_path('good.js')}
39
39
 
40
- it{is_expected.to eq(described_class::JavaScript)}
40
+ it{is_expected.to be_a(described_class::JavaScript)}
41
41
  end
42
42
 
43
43
  context 'when given a JSON file' do
44
44
  let(:file){fixture_path('good.json')}
45
45
 
46
- it{is_expected.to eq(described_class::JSON)}
46
+ it{is_expected.to be_a(described_class::JSON)}
47
47
  end
48
48
 
49
49
  context 'when given a Python file' do
50
50
  let(:file){fixture_path('good.py')}
51
51
 
52
- it{is_expected.to eq(described_class::Python)}
52
+ it{is_expected.to be_a(described_class::Python)}
53
53
  end
54
54
 
55
55
  context 'when given a Ruby file' do
56
56
  let(:file){fixture_path('good.rb')}
57
57
 
58
- it{is_expected.to eq(described_class::Ruby)}
58
+ it{is_expected.to be_a(described_class::Ruby)}
59
59
  end
60
60
 
61
61
  context 'when given a SCSS file' do
62
62
  let(:file){fixture_path('good.scss')}
63
63
 
64
- it{is_expected.to eq(described_class::SCSS)}
64
+ it{is_expected.to be_a(described_class::SCSS)}
65
65
  end
66
66
 
67
67
  context 'when given an unknown language file' do
@@ -77,61 +77,61 @@ describe LintTrap::Language do
77
77
  context 'when given CoffeeScript' do
78
78
  let(:language_name){'CoffeeScript'}
79
79
 
80
- it{is_expected.to eq(described_class::CoffeeScript)}
80
+ it{is_expected.to be_a(described_class::CoffeeScript)}
81
81
  end
82
82
 
83
83
  context 'when given C++' do
84
84
  let(:language_name){'C++'}
85
85
 
86
- it{is_expected.to eq(described_class::CPP)}
86
+ it{is_expected.to be_a(described_class::CPP)}
87
87
  end
88
88
 
89
89
  context 'when given CSS' do
90
90
  let(:language_name){'CSS'}
91
91
 
92
- it{is_expected.to eq(described_class::CSS)}
92
+ it{is_expected.to be_a(described_class::CSS)}
93
93
  end
94
94
 
95
95
  context 'when given Go' do
96
96
  let(:language_name){'Go'}
97
97
 
98
- it{is_expected.to eq(described_class::Go)}
98
+ it{is_expected.to be_a(described_class::Go)}
99
99
  end
100
100
 
101
101
  context 'when given Java' do
102
102
  let(:language_name){'Java'}
103
103
 
104
- it{is_expected.to eq(described_class::Java)}
104
+ it{is_expected.to be_a(described_class::Java)}
105
105
  end
106
106
 
107
107
  context 'when given JavaScript' do
108
108
  let(:language_name){'JavaScript'}
109
109
 
110
- it{is_expected.to eq(described_class::JavaScript)}
110
+ it{is_expected.to be_a(described_class::JavaScript)}
111
111
  end
112
112
 
113
113
  context 'when given JSON' do
114
114
  let(:language_name){'JSON'}
115
115
 
116
- it{is_expected.to eq(described_class::JSON)}
116
+ it{is_expected.to be_a(described_class::JSON)}
117
117
  end
118
118
 
119
119
  context 'when given Python' do
120
120
  let(:language_name){'Python'}
121
121
 
122
- it{is_expected.to eq(described_class::Python)}
122
+ it{is_expected.to be_a(described_class::Python)}
123
123
  end
124
124
 
125
125
  context 'when given Ruby' do
126
126
  let(:language_name){'Ruby'}
127
127
 
128
- it{is_expected.to eq(described_class::Ruby)}
128
+ it{is_expected.to be_a(described_class::Ruby)}
129
129
  end
130
130
 
131
131
  context 'when given SCSS' do
132
132
  let(:language_name){'SCSS'}
133
133
 
134
- it{is_expected.to eq(described_class::SCSS)}
134
+ it{is_expected.to be_a(described_class::SCSS)}
135
135
  end
136
136
 
137
137
  context 'when given an invalid language' do
@@ -2,27 +2,27 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CheckStyle do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(Good.java bad.java)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'checks.xml'}
12
+ let(:options){{config: 'checks.xml'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
16
16
  'java',
17
17
  [
18
18
  '-jar', container.config_path(described_class::JAR),
19
- '-c', config
19
+ '-c', options[:config]
20
20
  ],
21
21
  files
22
22
  ).and_return(command)
23
23
  expect(command).to receive(:run).with(container)
24
24
 
25
- linter.lint(files)
25
+ linter.lint(files, container, options)
26
26
  end
27
27
  end
28
28
 
@@ -38,7 +38,7 @@ describe LintTrap::Linter::CheckStyle do
38
38
  ).and_return(command)
39
39
  expect(command).to receive(:run).with(container)
40
40
 
41
- linter.lint(files)
41
+ linter.lint(files, container, options)
42
42
  end
43
43
  end
44
44
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CoffeeLint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.coffee bad.coffee)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'coffeelint.json'}
12
+ let(:options){{config: 'coffeelint.json'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
@@ -23,7 +23,7 @@ describe LintTrap::Linter::CoffeeLint do
23
23
  ).and_return(command)
24
24
  expect(command).to receive(:run).with(container)
25
25
 
26
- linter.lint(files)
26
+ linter.lint(files, container, options)
27
27
  end
28
28
  end
29
29
 
@@ -39,7 +39,7 @@ describe LintTrap::Linter::CoffeeLint do
39
39
  ).and_return(command)
40
40
  expect(command).to receive(:run).with(container)
41
41
 
42
- linter.lint(files)
42
+ linter.lint(files, container, options)
43
43
  end
44
44
  end
45
45
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CPPCheck do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.cpp bad.cpp)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
@@ -20,7 +20,7 @@ describe LintTrap::Linter::CPPCheck do
20
20
  ).and_return(command)
21
21
  expect(command).to receive(:run).with(container)
22
22
 
23
- linter.lint(files)
23
+ linter.lint(files, container, options)
24
24
  end
25
25
  end
26
26
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CSSLint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.css bad.css)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'.csslintrc'}
12
+ let(:options){{config: '.csslintrc'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
@@ -22,7 +22,7 @@ describe LintTrap::Linter::CSSLint do
22
22
  ).and_return(command)
23
23
  expect(command).to receive(:run).with(container)
24
24
 
25
- linter.lint(files)
25
+ linter.lint(files, container, options)
26
26
  end
27
27
  end
28
28
 
@@ -37,7 +37,7 @@ describe LintTrap::Linter::CSSLint do
37
37
  ).and_return(command)
38
38
  expect(command).to receive(:run).with(container)
39
39
 
40
- linter.lint(files)
40
+ linter.lint(files, container, options)
41
41
  end
42
42
  end
43
43
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::GoLint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.go bad.go)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
@@ -16,7 +16,7 @@ describe LintTrap::Linter::GoLint do
16
16
  ).and_return(command)
17
17
  expect(command).to receive(:run).with(container)
18
18
 
19
- linter.lint(files)
19
+ linter.lint(files, container, options)
20
20
  end
21
21
  end
22
22
  end
@@ -2,27 +2,27 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::JSHint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.js bad.js)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'.jshintrc'}
12
+ let(:options){{config: '.jshintrc'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
16
16
  'jshint',
17
17
  [
18
18
  '--reporter', container.config_path(described_class::FORMATTER),
19
- '--config', config
19
+ '--config', options[:config]
20
20
  ],
21
21
  files
22
22
  ).and_return(command)
23
23
  expect(command).to receive(:run).with(container)
24
24
 
25
- linter.lint(files)
25
+ linter.lint(files, container, options)
26
26
  end
27
27
  end
28
28
 
@@ -37,7 +37,7 @@ describe LintTrap::Linter::JSHint do
37
37
  ).and_return(command)
38
38
  expect(command).to receive(:run).with(container)
39
39
 
40
- linter.lint(files)
40
+ linter.lint(files, container, options)
41
41
  end
42
42
  end
43
43
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::JSONLint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.go bad.go)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
@@ -16,7 +16,7 @@ describe LintTrap::Linter::JSONLint do
16
16
  ).and_return(command)
17
17
  expect(command).to receive(:run).with(container)
18
18
 
19
- linter.lint(files)
19
+ linter.lint(files, container, options)
20
20
  end
21
21
  end
22
22
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::PyLint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.py bad.py)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'.pylintrc'}
12
+ let(:options){{config: '.pylintrc'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
@@ -17,13 +17,13 @@ describe LintTrap::Linter::PyLint do
17
17
  [
18
18
  '-r', 'no',
19
19
  '--msg-template', '"{abspath}:{line}:{column}::{symbol}:{category}:{msg}"',
20
- '--rcfile', config
20
+ '--rcfile', options[:config]
21
21
  ],
22
22
  files
23
23
  ).and_return(command)
24
24
  expect(command).to receive(:run).with(container)
25
25
 
26
- linter.lint(files)
26
+ linter.lint(files, container, options)
27
27
  end
28
28
  end
29
29
 
@@ -39,7 +39,7 @@ describe LintTrap::Linter::PyLint do
39
39
  ).and_return(command)
40
40
  expect(command).to receive(:run).with(container)
41
41
 
42
- linter.lint(files)
42
+ linter.lint(files, container, options)
43
43
  end
44
44
  end
45
45
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::RuboCop do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.rb bad.rb)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'.rubocop.yml'}
12
+ let(:options){{config: '.rubocop.yml'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
@@ -18,13 +18,13 @@ describe LintTrap::Linter::RuboCop do
18
18
  '--require', container.config_path(described_class::FORMATTER),
19
19
  '--format', 'LintTrap::Rubocop::Formatter',
20
20
  '--no-color',
21
- '--config', config
21
+ '--config', options[:config]
22
22
  ],
23
23
  files
24
24
  ).and_return(command)
25
25
  expect(command).to receive(:run).with(container)
26
26
 
27
- linter.lint(files)
27
+ linter.lint(files, container, options)
28
28
  end
29
29
  end
30
30
 
@@ -41,7 +41,7 @@ describe LintTrap::Linter::RuboCop do
41
41
  ).and_return(command)
42
42
  expect(command).to receive(:run).with(container)
43
43
 
44
- linter.lint(files)
44
+ linter.lint(files, container, options)
45
45
  end
46
46
  end
47
47
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::SCSSLint do
4
4
  let(:container){LintTrap::Container::Fake.new}
5
- let(:config){nil}
5
+ let(:options){{}}
6
6
  let(:files){%w(good.scss bad.scss)}
7
- subject(:linter){described_class.new(container: container, config: config)}
7
+ subject(:linter){described_class.new}
8
8
  let(:command){instance_double(LintTrap::Command)}
9
9
 
10
10
  describe '#lint' do
11
11
  context 'when config is provided' do
12
- let(:config){'.scss-lint.yml'}
12
+ let(:options){{config: '.scss-lint.yml'}}
13
13
 
14
14
  it 'runs the lint command with the correct arguments' do
15
15
  expect(LintTrap::Command).to receive(:new).with(
@@ -22,7 +22,7 @@ describe LintTrap::Linter::SCSSLint do
22
22
  ).and_return(command)
23
23
  expect(command).to receive(:run).with(container)
24
24
 
25
- linter.lint(files)
25
+ linter.lint(files, container, options)
26
26
  end
27
27
  end
28
28
 
@@ -37,7 +37,7 @@ describe LintTrap::Linter::SCSSLint do
37
37
  ).and_return(command)
38
38
  expect(command).to receive(:run).with(container)
39
39
 
40
- linter.lint(files)
40
+ linter.lint(files, container, options)
41
41
  end
42
42
  end
43
43
  end