HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.5.9/spec/mspec/spec/helpers/tmp_spec.rb
require 'spec_helper'
require 'mspec/guards'
require 'mspec/helpers'

describe Object, "#tmp" do
  before :all do
    @dir = "#{File.expand_path(Dir.pwd)}/rubyspec_temp"
  end

  it "returns a name relative to the current working directory" do
    tmp("test.txt").should == "#{@dir}/#{SPEC_TEMP_UNIQUIFIER}-test.txt"
  end

  it "returns a 'unique' name on repeated calls" do
    a = tmp("text.txt")
    b = tmp("text.txt")
    a.should_not == b
  end

  it "does not 'uniquify' the name if requested not to" do
    tmp("test.txt", false).should == "#{@dir}/test.txt"
  end

  it "returns the name of the temporary directory when passed an empty string" do
    tmp("").should == "#{@dir}/"
  end
end