mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
display an error message when cat is invoked without arguments.
This commit is contained in:
parent
fd2e366c2e
commit
c591031077
2 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,8 @@ class Pry
|
|||
attr_reader :_pry_
|
||||
|
||||
def initialize(file_with_embedded_line, _pry_, opts)
|
||||
raise CommandError, "Must provide a filename, --in, or --ex." if !file_with_embedded_line
|
||||
|
||||
@file_with_embedded_line = file_with_embedded_line
|
||||
@opts = opts
|
||||
@_pry_ = _pry_
|
||||
|
@ -13,8 +15,6 @@ class Pry
|
|||
end
|
||||
|
||||
def format
|
||||
raise CommandError, "Must provide a filename, --in, or --ex." if !file_with_embedded_line
|
||||
|
||||
set_file_and_dir_locals(file_name, _pry_, _pry_.current_context)
|
||||
decorate(@code_from_file)
|
||||
end
|
||||
|
|
|
@ -15,6 +15,12 @@ describe "cat" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "when invoked without arguments" do
|
||||
it 'should display an error message' do
|
||||
expect { @t.eval 'cat' }.to raise_error(Pry::CommandError, /Must provide a filename/)
|
||||
end
|
||||
end
|
||||
|
||||
describe "on receiving a file that does not exist" do
|
||||
it 'should display an error message' do
|
||||
expect { @t.eval 'cat supercalifragilicious66' }.to raise_error(StandardError, /Cannot open/)
|
||||
|
|
Loading…
Reference in a new issue