mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
use a better prefix for tempfiles (fixes #331)
This commit is contained in:
parent
fd488dfd01
commit
aee2eae8e5
5 changed files with 10 additions and 10 deletions
|
@ -22,7 +22,7 @@ class Pry
|
|||
# Open a temp file and yield it to the block, closing it after
|
||||
# @return [String] The path of the temp file
|
||||
def temp_file
|
||||
file = Tempfile.new(["tmp", ".rb"])
|
||||
file = Tempfile.new(['pry', '.rb'])
|
||||
yield file
|
||||
ensure
|
||||
file.close
|
||||
|
|
|
@ -163,7 +163,7 @@ end
|
|||
# Open a temp file and yield it to the block, closing it after
|
||||
# @return [String] The path of the temp file
|
||||
def temp_file
|
||||
file = Tempfile.new("tmp")
|
||||
file = Tempfile.new('pry')
|
||||
yield file
|
||||
ensure
|
||||
file.close
|
||||
|
|
|
@ -48,7 +48,7 @@ describe "Pry::DefaultCommands::Introspection" do
|
|||
end
|
||||
|
||||
it "should reload the file if it is a ruby file" do
|
||||
tf = Tempfile.new(["tmp", ".rb"])
|
||||
tf = Tempfile.new(["pry", ".rb"])
|
||||
path = tf.path
|
||||
|
||||
mock_pry("edit #{path}", "$rand").should =~ /#{@rand}/
|
||||
|
@ -57,7 +57,7 @@ describe "Pry::DefaultCommands::Introspection" do
|
|||
end
|
||||
|
||||
it "should not reload the file if it is not a ruby file" do
|
||||
tf = Tempfile.new(["tmp", ".py"])
|
||||
tf = Tempfile.new(["pry", ".py"])
|
||||
path = tf.path
|
||||
|
||||
mock_pry("edit #{path}", "$rand").should.not =~ /#{@rand}/
|
||||
|
@ -66,7 +66,7 @@ describe "Pry::DefaultCommands::Introspection" do
|
|||
end
|
||||
|
||||
it "should not reload a ruby file if -n is given" do
|
||||
tf = Tempfile.new(["tmp", ".rb"])
|
||||
tf = Tempfile.new(["pry", ".rb"])
|
||||
path = tf.path
|
||||
|
||||
mock_pry("edit -n #{path}", "$rand").should.not =~ /#{@rand}/
|
||||
|
@ -75,7 +75,7 @@ describe "Pry::DefaultCommands::Introspection" do
|
|||
end
|
||||
|
||||
it "should reload a non-ruby file if -r is given" do
|
||||
tf = Tempfile.new(["tmp", ".pryrc"])
|
||||
tf = Tempfile.new(["pry", ".pryrc"])
|
||||
path = tf.path
|
||||
|
||||
mock_pry("edit -r #{path}", "$rand").should =~ /#{@rand}/
|
||||
|
@ -87,7 +87,7 @@ describe "Pry::DefaultCommands::Introspection" do
|
|||
|
||||
describe "with --ex" do
|
||||
before do
|
||||
@tf = Tempfile.new(["tmp", ".rb"])
|
||||
@tf = Tempfile.new(["pry", ".rb"])
|
||||
@path = @tf.path
|
||||
@tf << "1\n2\nraise RuntimeError"
|
||||
@tf.flush
|
||||
|
@ -364,7 +364,7 @@ describe "Pry::DefaultCommands::Introspection" do
|
|||
describe "edit-method" do
|
||||
describe "on a method defined in a file" do
|
||||
before do
|
||||
@tempfile = Tempfile.new(['tmp', '*.rb'])
|
||||
@tempfile = Tempfile.new(['pry', '*.rb'])
|
||||
@tempfile.puts <<-EOS
|
||||
module A
|
||||
def a
|
||||
|
|
|
@ -121,7 +121,7 @@ describe "Pry::DefaultCommands::Shell" do
|
|||
it 'each successive cat --ex should show the next level of backtrace, and going past the final level should return to the first' do
|
||||
temp_files = []
|
||||
3.times do |i|
|
||||
temp_files << Tempfile.new(['tmp', '*.rb'])
|
||||
temp_files << Tempfile.new(['pry', '*.rb'])
|
||||
temp_files.last << "bt number #{i}"
|
||||
temp_files.last.flush
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ describe Pry do
|
|||
|
||||
before do
|
||||
Pry.history.clear
|
||||
@file = Tempfile.new(["tmp", ".pry_history"])
|
||||
@file = Tempfile.new(["pry", ".pry_history"])
|
||||
@hist = @file.path
|
||||
File.open(@hist, 'w') {|f| f << "1\n2\n3\n" }
|
||||
@old_hist = Pry.config.history.file
|
||||
|
|
Loading…
Reference in a new issue