madpilot-fakefs 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fakefs/file.rb +4 -0
- data/lib/fakefs/fileutils.rb +8 -0
- data/lib/fakefs/version.rb +1 -1
- data/test/fakefs_test.rb +11 -0
- metadata +3 -2
data/lib/fakefs/file.rb
CHANGED
data/lib/fakefs/fileutils.rb
CHANGED
@@ -6,6 +6,14 @@ module FakeFS
|
|
6
6
|
FileSystem.add(path, FakeDir.new)
|
7
7
|
end
|
8
8
|
|
9
|
+
def rmdir(list, options = {})
|
10
|
+
list = [ list ] unless list.is_a?(Array)
|
11
|
+
list.each do |l|
|
12
|
+
raise Errno::ENOENT, l unless FileSystem.find(l)
|
13
|
+
rm(l)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
9
17
|
def rm(path)
|
10
18
|
FileSystem.delete(path)
|
11
19
|
end
|
data/lib/fakefs/version.rb
CHANGED
data/test/fakefs_test.rb
CHANGED
@@ -25,6 +25,13 @@ class FakeFSTest < Test::Unit::TestCase
|
|
25
25
|
FileUtils.mkdir_p("/path/to/dir")
|
26
26
|
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
|
27
27
|
end
|
28
|
+
|
29
|
+
def test_can_delete_directories
|
30
|
+
FileUtils.mkdir_p("/path/to/dir")
|
31
|
+
FileUtils.rmdir("/path/to/dir")
|
32
|
+
assert File.exists?("/path/to/")
|
33
|
+
assert File.exists?("/path/to/dir") == false
|
34
|
+
end
|
28
35
|
|
29
36
|
def test_knows_directories_exist
|
30
37
|
FileUtils.mkdir_p(path = "/path/to/dir")
|
@@ -532,6 +539,10 @@ class FakeFSTest < Test::Unit::TestCase
|
|
532
539
|
}
|
533
540
|
end
|
534
541
|
|
542
|
+
def test_extname
|
543
|
+
assert File.extname("test.doc") == ".doc"
|
544
|
+
end
|
545
|
+
|
535
546
|
# Directory tests
|
536
547
|
def test_new_directory
|
537
548
|
FileUtils.mkdir_p('/this/path/should/be/here')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madpilot-fakefs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- test/verify.rb
|
43
43
|
has_rdoc: false
|
44
44
|
homepage: http://github.com/defunkt/fakefs
|
45
|
+
licenses:
|
45
46
|
post_install_message:
|
46
47
|
rdoc_options:
|
47
48
|
- --charset=UTF-8
|
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
63
|
requirements: []
|
63
64
|
|
64
65
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.3.5
|
66
67
|
signing_key:
|
67
68
|
specification_version: 2
|
68
69
|
summary: A fake filesystem. Use it in your tests.
|