disk_cache 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module DiskCache
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/disk_cache.rb CHANGED
@@ -167,6 +167,7 @@ module DiskCache
167
167
  #
168
168
  # Returns a String with the escaped url
169
169
  def escape(url)
170
- URI.escape(url)
170
+ return URI.escape(url) if url.include? ' '
171
+ url
171
172
  end
172
173
  end
@@ -46,10 +46,14 @@ describe DiskCache do
46
46
 
47
47
  context "sanity" do
48
48
  let(:web) { 'http://example.com/Troll face.svg' }
49
+ let(:web_correct) { 'http://example.com/Troll%20face.svg' }
49
50
 
50
51
  before(:each) do
51
52
  stub_request(:get, "http://example.com/Troll face.svg").
52
53
  to_return(body: File.read(path))
54
+
55
+ stub_request(:get, "http://example.com/Troll%20face.svg").
56
+ to_return(body: File.read(path))
53
57
  end
54
58
 
55
59
  it "should handle urls with spaces" do
@@ -57,5 +61,11 @@ describe DiskCache do
57
61
  file_from_cache = DiskCache.get(web)
58
62
  FileUtils.compare_file(path, file_from_cache).should be_true
59
63
  end
64
+
65
+ it "should handle urls with escaped spaces" do
66
+ DiskCache.put(web_correct)
67
+ file_from_cache = DiskCache.get(web_correct)
68
+ FileUtils.compare_file(path, file_from_cache).should be_true
69
+ end
60
70
  end
61
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disk_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: