File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11require_relative '../../spec_helper'
2- require_relative 'fixtures/common'
32
43describe "Dir#path" do
5- before :all do
6- DirSpecs . create_mock_dirs
7- end
8-
9- after :all do
10- DirSpecs . delete_mock_dirs
11- end
12-
13- it "returns the path that was supplied to .new or .open" do
14- dir = Dir . open DirSpecs . mock_dir
15- begin
16- dir . path . should == DirSpecs . mock_dir
17- ensure
18- dir . close rescue nil
19- end
20- end
21-
22- it "returns the path even when called on a closed Dir instance" do
23- dir = Dir . open DirSpecs . mock_dir
24- dir . close
25- dir . path . should == DirSpecs . mock_dir
26- end
27-
28- it "returns a String with the same encoding as the argument to .open" do
29- path = DirSpecs . mock_dir . force_encoding Encoding ::IBM866
30- dir = Dir . open path
31- begin
32- dir . path . encoding . should . equal? ( Encoding ::IBM866 )
33- ensure
34- dir . close
35- end
4+ it "is an alias of Dir#to_path" do
5+ Dir . instance_method ( :path ) . should == Dir . instance_method ( :to_path )
366 end
377end
Original file line number Diff line number Diff line change 11require_relative '../../spec_helper'
2+ require_relative 'fixtures/common'
23
34describe "Dir#to_path" do
4- it "is an alias of Dir#path" do
5- Dir . instance_method ( :to_path ) . should == Dir . instance_method ( :path )
5+ before :all do
6+ DirSpecs . create_mock_dirs
7+ end
8+
9+ after :all do
10+ DirSpecs . delete_mock_dirs
11+ end
12+
13+ it "returns the to_path that was supplied to .new or .open" do
14+ dir = Dir . open DirSpecs . mock_dir
15+ begin
16+ dir . to_path . should == DirSpecs . mock_dir
17+ ensure
18+ dir . close rescue nil
19+ end
20+ end
21+
22+ it "returns the to_path even when called on a closed Dir instance" do
23+ dir = Dir . open DirSpecs . mock_dir
24+ dir . close
25+ dir . to_path . should == DirSpecs . mock_dir
26+ end
27+
28+ it "returns a String with the same encoding as the argument to .open" do
29+ to_path = DirSpecs . mock_dir . force_encoding Encoding ::IBM866
30+ dir = Dir . open to_path
31+ begin
32+ dir . to_path . encoding . should . equal? ( Encoding ::IBM866 )
33+ ensure
34+ dir . close
35+ end
636 end
737end
You can’t perform that action at this time.
0 commit comments