madpilot-fakefs 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/fakefs/dir.rb +2 -2
- data/lib/fakefs/version.rb +1 -1
- data/test/fakefs_test.rb +31 -25
- metadata +1 -1
data/lib/fakefs/dir.rb
CHANGED
|
@@ -39,7 +39,7 @@ module FakeFS
|
|
|
39
39
|
raise IOError, "closed directory" if @pointer == nil
|
|
40
40
|
n = @contents[@pointer]
|
|
41
41
|
@pointer += 1
|
|
42
|
-
n.to_s if n
|
|
42
|
+
n.to_s.gsub(path + '/', '') if n
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def rewind
|
|
@@ -97,7 +97,7 @@ module FakeFS
|
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
def tmpdir
|
|
100
|
+
def self.tmpdir
|
|
101
101
|
'/tmp'
|
|
102
102
|
end
|
|
103
103
|
|
data/lib/fakefs/version.rb
CHANGED
data/test/fakefs_test.rb
CHANGED
|
@@ -558,12 +558,12 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
558
558
|
end
|
|
559
559
|
|
|
560
560
|
def test_directory_each
|
|
561
|
-
test = ['.', '..', '
|
|
561
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
562
562
|
|
|
563
563
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
564
564
|
|
|
565
565
|
test.each do |f|
|
|
566
|
-
FileUtils.touch(f)
|
|
566
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
567
567
|
end
|
|
568
568
|
|
|
569
569
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -583,10 +583,10 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
583
583
|
end
|
|
584
584
|
|
|
585
585
|
def test_directory_pos
|
|
586
|
-
test = ['.', '..', '
|
|
586
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
587
587
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
588
588
|
test.each do |f|
|
|
589
|
-
FileUtils.touch(f)
|
|
589
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
590
590
|
end
|
|
591
591
|
|
|
592
592
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -605,10 +605,11 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
605
605
|
end
|
|
606
606
|
|
|
607
607
|
def test_directory_pos_assign
|
|
608
|
-
test = ['.', '..', '
|
|
608
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
609
|
+
|
|
609
610
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
610
611
|
test.each do |f|
|
|
611
|
-
FileUtils.touch(f)
|
|
612
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
612
613
|
end
|
|
613
614
|
|
|
614
615
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -619,10 +620,11 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
619
620
|
end
|
|
620
621
|
|
|
621
622
|
def test_directory_read
|
|
622
|
-
test = ['.', '..', '
|
|
623
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
624
|
+
|
|
623
625
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
624
626
|
test.each do |f|
|
|
625
|
-
FileUtils.touch(f)
|
|
627
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
626
628
|
end
|
|
627
629
|
|
|
628
630
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -638,10 +640,11 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
638
640
|
end
|
|
639
641
|
|
|
640
642
|
def test_directory_read_past_length
|
|
641
|
-
test = ['.', '..', '
|
|
643
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
644
|
+
|
|
642
645
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
643
646
|
test.each do |f|
|
|
644
|
-
FileUtils.touch(f)
|
|
647
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
645
648
|
end
|
|
646
649
|
|
|
647
650
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -665,10 +668,11 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
665
668
|
end
|
|
666
669
|
|
|
667
670
|
def test_directory_rewind
|
|
668
|
-
test = ['.', '..', '
|
|
671
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
672
|
+
|
|
669
673
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
670
674
|
test.each do |f|
|
|
671
|
-
FileUtils.touch(f)
|
|
675
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
672
676
|
end
|
|
673
677
|
|
|
674
678
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -681,10 +685,11 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
681
685
|
end
|
|
682
686
|
|
|
683
687
|
def test_directory_seek
|
|
684
|
-
test = ['.', '..', '
|
|
688
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
689
|
+
|
|
685
690
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
686
691
|
test.each do |f|
|
|
687
|
-
FileUtils.touch(f)
|
|
692
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
688
693
|
end
|
|
689
694
|
|
|
690
695
|
dir = Dir.new('/this/path/should/be/here')
|
|
@@ -702,10 +707,11 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
702
707
|
end
|
|
703
708
|
|
|
704
709
|
def test_directory_class_delete_does_not_act_on_non_empty_directory
|
|
705
|
-
test = ['.', '..', '
|
|
710
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
711
|
+
|
|
706
712
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
707
713
|
test.each do |f|
|
|
708
|
-
FileUtils.touch(f)
|
|
714
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
709
715
|
end
|
|
710
716
|
|
|
711
717
|
assert_raises(SystemCallError) do
|
|
@@ -714,12 +720,12 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
714
720
|
end
|
|
715
721
|
|
|
716
722
|
def test_directory_entries
|
|
717
|
-
test = ['.', '..', '
|
|
723
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
718
724
|
|
|
719
725
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
720
726
|
|
|
721
727
|
test.each do |f|
|
|
722
|
-
FileUtils.touch(f)
|
|
728
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
723
729
|
end
|
|
724
730
|
|
|
725
731
|
yielded = Dir.entries('/this/path/should/be/here')
|
|
@@ -728,12 +734,12 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
728
734
|
end
|
|
729
735
|
|
|
730
736
|
def test_directory_foreach
|
|
731
|
-
test = ['.', '..', '
|
|
737
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
732
738
|
|
|
733
739
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
734
740
|
|
|
735
741
|
test.each do |f|
|
|
736
|
-
FileUtils.touch(f)
|
|
742
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
737
743
|
end
|
|
738
744
|
|
|
739
745
|
yielded = []
|
|
@@ -764,12 +770,12 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
764
770
|
end
|
|
765
771
|
|
|
766
772
|
def test_directory_open
|
|
767
|
-
test = ['.', '..', '
|
|
773
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
768
774
|
|
|
769
775
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
770
776
|
|
|
771
777
|
test.each do |f|
|
|
772
|
-
FileUtils.touch(f)
|
|
778
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
773
779
|
end
|
|
774
780
|
|
|
775
781
|
dir = Dir.open('/this/path/should/be/here')
|
|
@@ -777,12 +783,12 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
777
783
|
end
|
|
778
784
|
|
|
779
785
|
def test_directory_open_block
|
|
780
|
-
test = ['.', '..', '
|
|
786
|
+
test = ['.', '..', 'file_1', 'file_2', 'file_3', 'file_4', 'file_5' ]
|
|
781
787
|
|
|
782
788
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
|
783
789
|
|
|
784
790
|
test.each do |f|
|
|
785
|
-
FileUtils.touch(f)
|
|
791
|
+
FileUtils.touch("/this/path/should/be/here/#{f}")
|
|
786
792
|
end
|
|
787
793
|
|
|
788
794
|
yielded = []
|
|
@@ -795,7 +801,7 @@ class FakeFSTest < Test::Unit::TestCase
|
|
|
795
801
|
end
|
|
796
802
|
|
|
797
803
|
def test_tmpdir
|
|
798
|
-
assert Dir.
|
|
804
|
+
assert Dir.tmpdir == "/tmp"
|
|
799
805
|
end
|
|
800
806
|
|
|
801
807
|
def here(fname)
|