Skip to content

Commit bb09912

Browse files
committed
[Fix #7] Move error.rb back to rubocop gem
1 parent b1c7f7a commit bb09912

File tree

5 files changed

+6
-40
lines changed

5 files changed

+6
-40
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### Changes
6+
7+
* `AST::ProcessedSource.from_file` now raises a `Errno::ENOENT` instead of a `RuboCop::Error` [#7]
8+
59
## 0.0.2 (2020-05-12)
610

711
### Bug fixes

lib/rubocop/ast.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require 'parser'
44
require 'forwardable'
55

6-
require_relative 'error'
76
require_relative 'node_pattern'
87

98
require_relative 'ast/sexp'

lib/rubocop/error.rb

Lines changed: 0 additions & 34 deletions
This file was deleted.

lib/rubocop/processed_source.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class ProcessedSource
1515
def self.from_file(path, ruby_version)
1616
file = File.read(path, mode: 'rb')
1717
new(file, ruby_version, path)
18-
rescue Errno::ENOENT
19-
raise RuboCop::Error, "No such file or directory: #{path}"
2018
end
2119

2220
def initialize(source, ruby_version, path = nil)

spec/rubocop/processed_source_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ def some_method
3232
end
3333
end
3434

35-
it 'raises RuboCop::Error when the file does not exist' do
35+
it 'raises a Errno::ENOENT when the file does not exist' do
3636
expect do
3737
described_class.from_file('foo', ruby_version)
38-
end.to raise_error(RuboCop::Error)
39-
.with_message(/No such file or directory/)
38+
end.to raise_error(Errno::ENOENT)
4039
end
4140
end
4241

0 commit comments

Comments
 (0)