mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix bug where we ignored type passed into Pry::Code.from_file
This commit is contained in:
parent
d242a70444
commit
03dc165ebf
2 changed files with 7 additions and 1 deletions
|
@ -41,7 +41,7 @@ class Pry
|
|||
else
|
||||
if File.readable?(fn)
|
||||
f = File.open(fn, 'r')
|
||||
code_type = type_from_filename(fn)
|
||||
code_type ||= type_from_filename(fn)
|
||||
else
|
||||
raise MethodSource::SourceNotFoundError, "Cannot open #{fn.inspect} for reading."
|
||||
end
|
||||
|
|
|
@ -23,6 +23,12 @@ describe Pry::Code do
|
|||
end
|
||||
end
|
||||
|
||||
should 'use the provided extension' do
|
||||
temp_file('.c') do |f|
|
||||
Pry::Code.from_file(f.path, :ruby).code_type.should == :ruby
|
||||
end
|
||||
end
|
||||
|
||||
should 'raise an error if the file doesn\'t exist' do
|
||||
proc do
|
||||
Pry::Code.from_file('/knalkjsdnalsd/alkjdlkq')
|
||||
|
|
Loading…
Reference in a new issue