1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Fix errors on Rubinius and JRuby

These implementations have slightly different APIs for getting your
temp directory path.
This commit is contained in:
Kyrylo Silin 2013-01-14 12:11:37 +02:00 committed by John Mair
parent 24ac5b04f4
commit 05d4d13f37
2 changed files with 13 additions and 2 deletions

View file

@ -16,10 +16,16 @@ describe "edit" do
end end
describe "with FILE" do describe "with FILE" do
before do before do
# OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's # OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's
# something "Temp". # something "Temp".
@tf_dir = Pathname.new(Dir::Tmpname.tmpdir) @tf_dir =
if Pry::Helpers::BaseHelpers.rbx? || Pry::Helpers::BaseHelpers.jruby?
Pathname.new(Dir.tmpdir)
else
Pathname.new(Dir::Tmpname.tmpdir)
end
@tf_path = File.expand_path(File.join(@tf_dir.to_s, 'bar.rb')) @tf_path = File.expand_path(File.join(@tf_dir.to_s, 'bar.rb'))
FileUtils.touch(@tf_path) FileUtils.touch(@tf_path)

View file

@ -9,7 +9,12 @@ describe Pry::Editor do
before do before do
# OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's # OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's
# something "Temp". # something "Temp".
@tf_dir = Pathname.new(Dir::Tmpname.tmpdir) @tf_dir =
if Pry::Helpers::BaseHelpers.rbx? || Pry::Helpers::BaseHelpers.jruby?
Pathname.new(Dir.tmpdir)
else
Pathname.new(Dir::Tmpname.tmpdir)
end
@tf_path = File.join(@tf_dir.to_s, 'hello world.rb') @tf_path = File.join(@tf_dir.to_s, 'hello world.rb')
end end