guard-rubocop 1.0.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,7 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- require 'spec_helper.rb'
4
-
5
- describe Guard::Rubocop, :silence_output do
6
- subject(:guard) { Guard::Rubocop.new(options) }
3
+ RSpec.describe Guard::RuboCop, :silence_output do
4
+ subject(:guard) { Guard::RuboCop.new(options) }
7
5
  let(:options) { {} }
8
6
 
9
7
  describe '#options' do
@@ -14,12 +12,12 @@ describe Guard::Rubocop, :silence_output do
14
12
 
15
13
  describe '[:all_on_start]' do
16
14
  subject { super()[:all_on_start] }
17
- it { should be_true }
15
+ it { should be_truthy }
18
16
  end
19
17
 
20
18
  describe '[:keep_failed]' do
21
19
  subject { super()[:keep_failed] }
22
- it { should be_true }
20
+ it { should be_truthy }
23
21
  end
24
22
 
25
23
  describe '[:notification]' do
@@ -57,13 +55,13 @@ describe Guard::Rubocop, :silence_output do
57
55
  shared_examples 'processes after running', :processes_after_running do
58
56
  context 'when passed' do
59
57
  it 'throws nothing' do
60
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_return(true)
58
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_return(true)
61
59
  expect { subject }.not_to throw_symbol
62
60
  end
63
61
 
64
62
  it 'clears failed paths' do
65
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_return(true)
66
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:failed_paths).and_return([])
63
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_return(true)
64
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:failed_paths).and_return([])
67
65
  subject
68
66
  expect(guard.failed_paths).to be_empty
69
67
  end
@@ -71,7 +69,7 @@ describe Guard::Rubocop, :silence_output do
71
69
 
72
70
  context 'when failed' do
73
71
  it 'throws symbol :task_has_failed' do
74
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_return(false)
72
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_return(false)
75
73
  expect { subject }.to throw_symbol(:task_has_failed)
76
74
  end
77
75
 
@@ -81,8 +79,8 @@ describe Guard::Rubocop, :silence_output do
81
79
  'some_failed_file.rb',
82
80
  'dir/another_failed_file.rb'
83
81
  ]
84
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_return(false)
85
- allow_any_instance_of(Guard::Rubocop::Runner)
82
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_return(false)
83
+ allow_any_instance_of(Guard::RuboCop::Runner)
86
84
  .to receive(:failed_paths).and_return(failed_paths)
87
85
  subject
88
86
  expect(guard.failed_paths).to eq(failed_paths)
@@ -91,7 +89,7 @@ describe Guard::Rubocop, :silence_output do
91
89
 
92
90
  context 'when an exception is raised' do
93
91
  it 'prevents itself from firing' do
94
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_raise(RuntimeError)
92
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_raise(RuntimeError)
95
93
  expect { subject }.not_to raise_error
96
94
  end
97
95
  end
@@ -101,17 +99,17 @@ describe Guard::Rubocop, :silence_output do
101
99
  subject { super().run_all }
102
100
 
103
101
  before do
104
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_return(true)
105
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:failed_paths).and_return([])
102
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_return(true)
103
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:failed_paths).and_return([])
106
104
  end
107
105
 
108
106
  it 'inspects all files with rubocop' do
109
- expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run).with([])
107
+ expect_any_instance_of(Guard::RuboCop::Runner).to receive(:run).with([])
110
108
  guard.run_all
111
109
  end
112
110
  end
113
111
 
114
- [:run_on_additions, :run_on_modifications].each do |method|
112
+ %i[run_on_additions run_on_modifications].each do |method|
115
113
  describe "##{method}", :processes_after_running do
116
114
  subject { super().send(method, changed_paths) }
117
115
  let(:changed_paths) do
@@ -122,20 +120,20 @@ describe Guard::Rubocop, :silence_output do
122
120
  end
123
121
 
124
122
  before do
125
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:run).and_return(true)
126
- allow_any_instance_of(Guard::Rubocop::Runner).to receive(:failed_paths).and_return([])
123
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:run).and_return(true)
124
+ allow_any_instance_of(Guard::RuboCop::Runner).to receive(:failed_paths).and_return([])
127
125
  end
128
126
 
129
127
  it 'inspects changed files with rubocop' do
130
- expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run)
128
+ expect_any_instance_of(Guard::RuboCop::Runner).to receive(:run)
131
129
  subject
132
130
  end
133
131
 
134
132
  it 'passes cleaned paths to rubocop' do
135
- expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do |paths|
133
+ expect_any_instance_of(Guard::RuboCop::Runner).to receive(:run) do |_instance, paths|
136
134
  expect(paths).to eq([
137
- File.expand_path('some.rb'),
138
- File.expand_path('dir/another.rb')
135
+ File.expand_path('lib/guard/rubocop.rb'),
136
+ File.expand_path('spec/spec_helper.rb')
139
137
  ])
140
138
  end
141
139
  subject
@@ -147,7 +145,7 @@ describe Guard::Rubocop, :silence_output do
147
145
  end
148
146
 
149
147
  it 'does nothing' do
150
- expect_any_instance_of(Guard::Rubocop::Runner).not_to receive(:run)
148
+ expect_any_instance_of(Guard::RuboCop::Runner).not_to receive(:run)
151
149
  subject
152
150
  end
153
151
  end
@@ -159,7 +157,7 @@ describe Guard::Rubocop, :silence_output do
159
157
 
160
158
  it 'also inspects paths which are failed last time' do
161
159
  guard.failed_paths << failed_path
162
- expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do |paths|
160
+ expect_any_instance_of(Guard::RuboCop::Runner).to receive(:run) do |_instance, paths|
163
161
  expect(paths).to include failed_path
164
162
  end
165
163
  subject
@@ -171,8 +169,11 @@ describe Guard::Rubocop, :silence_output do
171
169
 
172
170
  it 'inspects just changed paths' do
173
171
  guard.failed_paths << failed_path
174
- expect_any_instance_of(Guard::Rubocop::Runner).to receive(:run) do |paths|
175
- expect(paths).to eq(changed_paths)
172
+ expect_any_instance_of(Guard::RuboCop::Runner).to receive(:run) do |_instance, paths|
173
+ expect(paths).to eq([
174
+ File.expand_path('lib/guard/rubocop.rb'),
175
+ File.expand_path('spec/spec_helper.rb')
176
+ ])
176
177
  end
177
178
  subject
178
179
  end
@@ -1,31 +1,33 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  RSpec.configure do |config|
4
- config.expect_with :rspec do |c|
5
- c.syntax = :expect
4
+ config.expect_with :rspec do |expectations|
5
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
6
6
  end
7
7
 
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
- end
8
+ config.mock_with :rspec do |mocks|
9
+ mocks.verify_partial_doubles = true
10
+ end
10
11
 
11
- Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path|
12
- require path
13
- end
12
+ config.filter_run_when_matching :focus
13
+
14
+ config.example_status_persistence_file_path = 'spec/examples.txt'
14
15
 
15
- require 'simplecov'
16
- SimpleCov.coverage_dir(File.join('spec', 'coverage'))
16
+ config.disable_monkey_patching!
17
17
 
18
- if ENV['TRAVIS']
19
- require 'coveralls'
20
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
21
- elsif ENV['CI']
22
- require 'simplecov-rcov'
23
- SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
18
+ config.default_formatter = 'doc' if config.files_to_run.one?
19
+
20
+ config.order = :random
21
+
22
+ Kernel.srand config.seed
24
23
  end
25
24
 
26
- SimpleCov.start do
27
- add_filter '/spec/'
28
- add_filter '/vendor/bundle/'
25
+ Dir[File.join(File.dirname(__FILE__), 'support', '*')].sort.each do |path|
26
+ require path
29
27
  end
30
28
 
29
+ # Initialize Guard for running tests.
30
+ require 'guard'
31
+ Guard.setup(notify: false)
32
+
31
33
  require 'guard/rubocop'
@@ -1,14 +1,27 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- shared_context 'silence output', silence_output: true do
4
- before do
5
- null_output = double('output').as_null_object
3
+ RSpec.shared_context 'silence output', :silence_output do
4
+ null_object = BasicObject.new
5
+
6
+ class << null_object
7
+ # #respond_to_missing? does not work.
8
+ def respond_to?(*)
9
+ true
10
+ end
6
11
 
12
+ def respond_to_missing?(*)
13
+ true
14
+ end
15
+
16
+ def method_missing(*)
17
+ end
18
+ end
19
+
20
+ before do
7
21
  @original_stdout = $stdout
8
22
  @original_stderr = $stderr
9
-
10
- $stdout = null_output
11
- $stderr = null_output
23
+ $stdout = null_object
24
+ $stderr = null_object
12
25
  end
13
26
 
14
27
  after do
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'simplecov'
4
+
5
+ if ENV['CI']
6
+ require 'simplecov-lcov'
7
+
8
+ SimpleCov::Formatter::LcovFormatter.config do |config|
9
+ config.report_with_single_file = true
10
+ config.single_report_path = 'coverage/lcov.info'
11
+ end
12
+
13
+ SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
14
+ end
15
+
16
+ SimpleCov.start do
17
+ add_filter '/spec/'
18
+ add_filter '/vendor/bundle/'
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -28,101 +28,107 @@ dependencies:
28
28
  name: rubocop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.10'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.10'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: guard-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 4.2.3
62
+ - - "<"
60
63
  - !ruby/object:Gem::Version
61
- version: '10.0'
64
+ version: '5.0'
62
65
  type: :development
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - "~>"
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 4.2.3
72
+ - - "<"
67
73
  - !ruby/object:Gem::Version
68
- version: '10.0'
74
+ version: '5.0'
69
75
  - !ruby/object:Gem::Dependency
70
- name: rspec
76
+ name: launchy
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '2.14'
81
+ version: '2.4'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '2.14'
88
+ version: '2.4'
83
89
  - !ruby/object:Gem::Dependency
84
- name: simplecov
90
+ name: rake
85
91
  requirement: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - "~>"
93
+ - - ">="
88
94
  - !ruby/object:Gem::Version
89
- version: '0.7'
95
+ version: '12.0'
90
96
  type: :development
91
97
  prerelease: false
92
98
  version_requirements: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - "~>"
100
+ - - ">="
95
101
  - !ruby/object:Gem::Version
96
- version: '0.7'
102
+ version: '12.0'
97
103
  - !ruby/object:Gem::Dependency
98
- name: guard-rspec
104
+ name: rspec
99
105
  requirement: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '4.0'
109
+ version: '3.0'
104
110
  type: :development
105
111
  prerelease: false
106
112
  version_requirements: !ruby/object:Gem::Requirement
107
113
  requirements:
108
114
  - - "~>"
109
115
  - !ruby/object:Gem::Version
110
- version: '4.0'
116
+ version: '3.0'
111
117
  - !ruby/object:Gem::Dependency
112
- name: ruby_gntp
118
+ name: simplecov
113
119
  requirement: !ruby/object:Gem::Requirement
114
120
  requirements:
115
121
  - - "~>"
116
122
  - !ruby/object:Gem::Version
117
- version: '0.3'
123
+ version: '0.7'
118
124
  type: :development
119
125
  prerelease: false
120
126
  version_requirements: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - "~>"
123
129
  - !ruby/object:Gem::Version
124
- version: '0.3'
125
- description: Guard::Rubocop automatically checks Ruby code style with RuboCop when
130
+ version: '0.7'
131
+ description: Guard::RuboCop automatically checks Ruby code style with RuboCop when
126
132
  files are modified.
127
133
  email:
128
134
  - nkymyj@gmail.com
@@ -130,9 +136,11 @@ executables: []
130
136
  extensions: []
131
137
  extra_rdoc_files: []
132
138
  files:
139
+ - ".github/workflows/ci.yml"
133
140
  - ".gitignore"
141
+ - ".rspec"
134
142
  - ".rubocop.yml"
135
- - ".travis.yml"
143
+ - ".rubocop_todo.yml"
136
144
  - ".yardopts"
137
145
  - CHANGELOG.md
138
146
  - Gemfile
@@ -145,11 +153,11 @@ files:
145
153
  - lib/guard/rubocop/runner.rb
146
154
  - lib/guard/rubocop/templates/Guardfile
147
155
  - lib/guard/rubocop/version.rb
148
- - spec/.rubocop.yml
149
156
  - spec/guard/rubocop/runner_spec.rb
150
157
  - spec/guard/rubocop_spec.rb
151
158
  - spec/spec_helper.rb
152
159
  - spec/support/silence_output.rb
160
+ - spec/support/simplecov.rb
153
161
  homepage: https://github.com/yujinakayama/guard-rubocop
154
162
  licenses:
155
163
  - MIT
@@ -162,22 +170,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
170
  requirements:
163
171
  - - ">="
164
172
  - !ruby/object:Gem::Version
165
- version: '0'
173
+ version: '2.4'
166
174
  required_rubygems_version: !ruby/object:Gem::Requirement
167
175
  requirements:
168
176
  - - ">="
169
177
  - !ruby/object:Gem::Version
170
178
  version: '0'
171
179
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.0.14
180
+ rubygems_version: 3.1.2
174
181
  signing_key:
175
182
  specification_version: 4
176
183
  summary: Guard plugin for RuboCop
177
184
  test_files:
178
- - spec/.rubocop.yml
179
185
  - spec/guard/rubocop/runner_spec.rb
180
186
  - spec/guard/rubocop_spec.rb
181
187
  - spec/spec_helper.rb
182
188
  - spec/support/silence_output.rb
183
- has_rdoc:
189
+ - spec/support/simplecov.rb