sugarcube 0.20.4 → 0.20.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,8 @@ class NSString
15
15
  end
16
16
 
17
17
  def exists?
18
- NSFileManager.defaultManager.fileExistsAtPath(self.document)
18
+ path = self.hasPrefix('/') ? self : self.document
19
+ NSFileManager.defaultManager.fileExistsAtPath(path)
19
20
  end
20
21
 
21
22
  def remove!
@@ -1,3 +1,3 @@
1
1
  module SugarCube
2
- Version = '0.20.4'
2
+ Version = '0.20.5'
3
3
  end
@@ -26,6 +26,54 @@ describe 'NSString' do
26
26
  'little_square.png'.resource_exists?.should == true
27
27
  'foo'.resource_exists?.should == false
28
28
  end
29
+
30
+ describe "exists?" do
31
+
32
+ it "should not exists" do
33
+ "abc".exists?.should == false
34
+ end
35
+
36
+ it "should not exists" do
37
+ "abc".cache.exists?.should == false
38
+ end
39
+
40
+ it "should not exists" do
41
+ "abc".resource.exists?.should == false
42
+ end
43
+
44
+ describe "in document" do
45
+ before do
46
+ "abc".writeToFile "abc".document, atomically:true
47
+ end
48
+ after do
49
+ NSFileManager.defaultManager.removeItemAtPath "abc".document, error:nil
50
+ end
51
+
52
+ it "should be exists" do
53
+ "abc".exists?.should == true
54
+ end
55
+ end
56
+
57
+ describe "in cache" do
58
+ before do
59
+ "abc".writeToFile "abc".cache, atomically:true
60
+ end
61
+ after do
62
+ NSFileManager.defaultManager.removeItemAtPath "abc".cache, error:nil
63
+ end
64
+
65
+ it "should be exists" do
66
+ "abc".cache.exists?.should == true
67
+ end
68
+ end
69
+
70
+ describe "in resource" do
71
+ it "should be exists" do
72
+ "info.plist".resource.exists?.should == true
73
+ end
74
+ end
75
+
76
+ end
29
77
 
30
78
  describe 'resource()' do
31
79
  describe '"info.plist".resource' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.4
4
+ version: 0.20.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-04-01 00:00:00.000000000 Z
16
+ date: 2013-04-02 00:00:00.000000000 Z
17
17
  dependencies: []
18
18
  description: ! '== Description
19
19
 
@@ -229,3 +229,4 @@ test_files:
229
229
  - spec/uiview_spec.rb
230
230
  - spec/uiviewcontroller_spec.rb
231
231
  - spec/unholy_spec.rb
232
+ has_rdoc: