Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use already defined Purge::PURGE_HEADER constant

  • Loading branch information...
commit 442333b525c57c0ecbfa7f58319cd1e1e9a8ff38 1 parent 6851313
@svenfuchs authored
Showing with 5 additions and 5 deletions.
  1. +4 −4 lib/rack/cache/tags.rb
  2. +1 −1  test/test_tags.rb
View
8 lib/rack/cache/tags.rb
@@ -1,4 +1,5 @@
require 'rack/request'
+require 'rack/cache/purge'
module Rack
module Cache
@@ -15,10 +16,9 @@ def store=(store)
end
end
- TAGS_HEADER = 'rack-cache.tags'
- PURGE_HEADER = 'rack-cache.purge'
PURGE_TAGS_HEADER = 'rack-cache.purge-tags'
-
+ TAGS_HEADER = 'rack-cache.tags'
+
attr_reader :app
def initialize(app)
@@ -40,7 +40,7 @@ def store(*args)
def purge(headers)
urls = self.class.store.purge(headers[PURGE_TAGS_HEADER])
- headers[PURGE_HEADER] = urls unless urls.empty?
+ headers[Purge::PURGE_HEADER] = urls unless urls.empty?
end
end
end
View
2  test/test_tags.rb
@@ -27,7 +27,7 @@ def setup
actual = ActiveRecord::Tagging.all.map { |tagging| [tagging.url, tagging.tag] }
assert_equal [%w(http://example.com/baz baz-1)], actual
- assert_equal %w(http://example.com/foo http://example.com/bar), headers[Rack::Cache::Tags::PURGE_HEADER]
+ assert_equal %w(http://example.com/foo http://example.com/bar), headers[Rack::Cache::Purge::PURGE_HEADER]
end
test 'active_record store finds tags w/o methods' do
Please sign in to comment.
Something went wrong with that request. Please try again.