Sha256: 092e252c17c6d7a2f94397aad44f4c1e59e70a8c56da424b1e620eba0b2568e4

Contents?: true

Size: 700 Bytes

Versions: 9

Compression:

Stored size: 700 Bytes

Contents

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mspec-1.9.1 spec/helpers/tmp_spec.rb
mspec-1.9.0 spec/helpers/tmp_spec.rb
mspec-1.8.0 spec/helpers/tmp_spec.rb
mspec-1.7.0 spec/helpers/tmp_spec.rb
mspec-1.6.0 spec/helpers/tmp_spec.rb
mspec-1.5.21 spec/helpers/tmp_spec.rb
mspec-1.5.20 spec/helpers/tmp_spec.rb
mspec-1.5.19 spec/helpers/tmp_spec.rb
mspec-1.5.18 spec/helpers/tmp_spec.rb