blob: afadc7f51c2d6d42726a9a88046eabf3c96d4b66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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
|