Skip to content

Commit

Permalink
Eliminate old JRuby tests that use make_tmpname removed by MRI.
Browse files Browse the repository at this point in the history
headius committed Feb 23, 2018

Verified

This commit was signed with the committer’s verified signature. The key has expired.
nomadium Miguel Landaeta
1 parent ca25471 commit c4afc88
Showing 2 changed files with 0 additions and 32 deletions.
22 changes: 0 additions & 22 deletions test/jruby/test_file.rb
Original file line number Diff line number Diff line change
@@ -1213,28 +1213,6 @@ def test_umask_respects_existing_umask_value
end
end

def test_allow_override_of_make_tmpname
# mimics behavior of attachment_fu, which overrides private #make_tmpname
Tempfile.class_eval do
alias_method :save_make_tmpname, :make_tmpname
def make_tmpname(basename, n)
ext = nil
sprintf("%s%d-%d%s", basename.to_s.gsub(/\.\w+$/) { |s| ext = s; '' }, $$, n, ext)
end
end

@teardown_blocks << proc do
Tempfile.class_eval { alias_method :make_tmpname, :save_make_tmpname }
end

begin
t = Tempfile.new "tcttac.jpg", File.dirname(__FILE__)
assert t.path =~ /\.jpg$/
ensure
t.close
end
end

unless WINDOWS
def test_mode_of_tempfile_is_600
t = Tempfile.new "tcttac.jpg"
10 changes: 0 additions & 10 deletions test/jruby/test_pathname.rb
Original file line number Diff line number Diff line change
@@ -10,16 +10,6 @@ def test_dup
assert_equal 'some/path', Pathname.new('some/path').dup.to_s
end

def test_realpath_symlink; require 'tempfile'
target = Tempfile.new 'target'
link = Dir::Tmpname.make_tmpname 'link', nil
File.symlink(target, link)
assert_equal Pathname.new(target).realpath, Pathname.new(link).realpath
ensure
target.close! if target
File.delete(link) if link && File.exists?(link)
end unless WINDOWS # Don't have symlinks on Windows.

# GH-3392
def test_dirname_ending_in_!
x = "joe"

0 comments on commit c4afc88

Please sign in to comment.