Skip to content

Commit 32fbe9f

Browse files
committed
Improve specs for File#path
1 parent f65ce6f commit 32fbe9f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/ruby/core/file/shared/path.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@
1515
@file.send(@method).should be_an_instance_of(String)
1616
end
1717

18+
it "returns a different String on every call" do
19+
@file = File.new @path
20+
path1 = @file.send(@method)
21+
path2 = @file.send(@method)
22+
path1.should == path2
23+
path1.should_not.equal?(path2)
24+
end
25+
26+
it "returns a mutable String" do
27+
@file = File.new @path.dup.freeze
28+
path = @file.send(@method)
29+
path.should == @path
30+
path.should_not.frozen?
31+
path << "test"
32+
@file.send(@method).should == @path
33+
end
34+
1835
it "calls to_str on argument and returns exact value" do
1936
path = mock('path')
2037
path.should_receive(:to_str).and_return(@path)

0 commit comments

Comments
 (0)