use a better prefix for tempfiles (fixes #331)

This commit is contained in:
Ryan Fitzgerald 2011-11-06 01:09:11 -07:00
parent fd488dfd01
commit aee2eae8e5
5 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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