Fix bug where we ignored type passed into Pry::Code.from_file
This commit is contained in:
parent
d242a70444
commit
03dc165ebf
|
@ -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 New Issue