Skip to content

Commit 3a454e8

Browse files
Drop custom error
1 parent fdd3fca commit 3a454e8

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

lib/que/command_line_interface.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,7 @@ def parse(
196196
end
197197

198198
args.each do |file|
199-
begin
200-
require file
201-
rescue LoadError => e
202-
output.puts "Could not load file '#{file}': #{e}"
203-
output.puts "Your file path should look like you're running a script, e.g. `./path/to/file.rb`" unless file.start_with?('./')
204-
return 1
205-
end
199+
require File.expand_path(file)
206200
end
207201

208202
Que.logger ||= Logger.new(STDOUT)

spec/que/command_line_interface_spec.rb

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def write_file
121121
it "should infer the default require file if it exists" do
122122
filename = write_file
123123

124-
assert_successful_invocation "", default_require_file: "./#{filename}.rb"
124+
assert_successful_invocation "", default_require_file: "#{filename}.rb"
125125

126126
assert_equal(
127127
{filename => true},
@@ -161,32 +161,13 @@ def write_file
161161

162162
it "should raise an error if any of the files don't exist" do
163163
name = write_file
164-
code = execute "./#{name} ./nonexistent_file"
165-
assert_equal 1, code
166-
167-
assert_equal ["Could not load file './nonexistent_file': cannot load such file -- ./nonexistent_file"], output.messages
164+
assert_raises(LoadError) { execute "#{name} ./nonexistent_file" }
168165

169166
assert_equal(
170167
{name => true},
171168
LOADED_FILES
172169
)
173170
end
174-
175-
it "should raise an error if file is not leading with ./" do
176-
name = write_file
177-
code = execute "#{name}"
178-
assert_equal 1, code
179-
180-
assert_equal [
181-
"Could not load file '#{name}': cannot load such file -- #{name}",
182-
"Your file path should look like you're running a script, e.g. `./path/to/file.rb`"
183-
], output.messages
184-
185-
assert_equal(
186-
{},
187-
LOADED_FILES
188-
)
189-
end
190171
end
191172

192173
describe "should start up a locker" do

0 commit comments

Comments
 (0)