rack-cachely 0.2.0 → 0.2.1

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-cachely (0.1.0)
4
+ rack-cachely (0.2.1)
5
5
  rack
6
6
 
7
7
  GEM
@@ -25,9 +25,9 @@ module Rack
25
25
  parts << @request.script_name
26
26
  parts << @request.path_info
27
27
 
28
- if qs = query_string
28
+ if query_string && query_string != ""
29
29
  parts << "?"
30
- parts << qs
30
+ parts << query_string
31
31
  end
32
32
 
33
33
  parts.join
@@ -9,7 +9,7 @@ module Rack
9
9
 
10
10
  def get(key)
11
11
  remote do
12
- url = "#{config.cachely_url}?url=#{CGI.escape(key.to_s)}"
12
+ url = "#{config.cachely_url}?_version=#{Rack::Cachely::VERSION}&url=#{CGI.escape(key.to_s)}"
13
13
  uri = URI(url)
14
14
  http = Net::HTTP.new(uri.host, uri.port)
15
15
  request = Net::HTTP::Get.new(uri.request_uri)
@@ -43,7 +43,8 @@ module Rack
43
43
  "document[url]" => key,
44
44
  "document[status]" => rack[0].to_i,
45
45
  "document[body]" => body,
46
- "document[age]" => options[:age] || 0
46
+ "document[age]" => options[:age] || 0,
47
+ "_version" => Rack::Cachely::VERSION
47
48
  }
48
49
  rack[1].each do |key, value|
49
50
  data["document[headers][#{key}]"] = value
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Cachely
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -16,6 +16,16 @@ describe Rack::Cachely::Key do
16
16
  Rack::Cachely.config.ignore_query_params = ["A", "c"]
17
17
  key.to_s.should eql("http://example.com/foo/bar?b=B&d=D")
18
18
  end
19
+
20
+ context "no query string" do
21
+
22
+ let(:request) { double(scheme: "http", host: "example.com", port: 80, script_name: "/foo", path_info: "/bar", query_string: "") }
23
+
24
+ it "does not have an empty ? at the end" do
25
+ key.to_s.should eql("http://example.com/foo/bar")
26
+ end
27
+
28
+ end
19
29
 
20
30
  end
21
31
 
@@ -10,7 +10,7 @@ describe Rack::Cachely::Store do
10
10
  it "retreives a page from the service" do
11
11
  response_mock = double(code: "200", body: "hello!")
12
12
  response_mock.stub!(:each_header).and_yield("Content-Type", "text/html")
13
- Net::HTTP::Get.should_receive(:new).with("/v1/cache?url=http%3A%2F%2Fexample.com").and_return {
13
+ Net::HTTP::Get.should_receive(:new).with("/v1/cache?_version=#{Rack::Cachely::VERSION}&url=http%3A%2F%2Fexample.com").and_return {
14
14
  m = double
15
15
  m.should_receive(:basic_auth).with("1234567890", nil)
16
16
  m
@@ -47,7 +47,8 @@ describe Rack::Cachely::Store do
47
47
  "document[status]" => 200,
48
48
  "document[body]" => "hello!",
49
49
  "document[age]" => 30,
50
- "document[headers][Content-Type]" => "text/html"
50
+ "document[headers][Content-Type]" => "text/html",
51
+ "_version" => Rack::Cachely::VERSION
51
52
  }
52
53
  end
53
54
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-cachely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2012-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack