adva-cache 0.0.9 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
data/lib/adva/cache.rb
CHANGED
@@ -11,7 +11,7 @@ module Adva
|
|
11
11
|
include Adva::Engine
|
12
12
|
|
13
13
|
# TODO [config] add config vars to specify rack-cache storage uris
|
14
|
-
config.app_middleware.insert_after 'Rails::Rack::Logger', ::Rack::Cache
|
14
|
+
config.app_middleware.insert_after 'Rails::Rack::Logger', ::Rack::Cache, :verbose => false
|
15
15
|
config.app_middleware.insert_after 'Rack::Cache', ::Rack::Cache::Purge
|
16
16
|
config.app_middleware.insert_after 'Rack::Cache::Purge', ::Rack::Cache::Tags
|
17
17
|
end
|
data/lib/adva_cache/version.rb
CHANGED
@@ -21,34 +21,48 @@ Then /^the following urls should be tagged:$/ do |table|
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
Capybara::Driver::RackTest.class_eval do
|
25
25
|
cattr_accessor :follow_redirects
|
26
26
|
self.follow_redirects = true
|
27
27
|
|
28
|
-
def
|
29
|
-
follow_redirects &&
|
28
|
+
def follow_redirects_with_skipping!
|
29
|
+
follow_redirects && follow_redirects_without_skipping!
|
30
|
+
end
|
31
|
+
alias_method_chain :follow_redirects!, :skipping
|
32
|
+
end
|
33
|
+
|
34
|
+
Capybara::Session.module_eval do
|
35
|
+
def follow_redirects=(yes_or_no)
|
36
|
+
if driver_supports_redirect_skipping?
|
37
|
+
driver.follow_redirects = yes_or_no
|
38
|
+
else
|
39
|
+
raise "driver #{driver} does not support skipping redirects"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def driver_supports_redirect_skipping?
|
44
|
+
driver.respond_to?(:follow_redirects=)
|
30
45
|
end
|
31
|
-
alias_method_chain :internal_redirect?, :skipping
|
32
46
|
end
|
33
47
|
|
34
48
|
Before do
|
35
|
-
|
49
|
+
page.follow_redirects = true if page.driver_supports_redirect_skipping?
|
36
50
|
end
|
37
51
|
|
38
52
|
When /I don't follow any http redirects/ do
|
39
|
-
|
53
|
+
page.follow_redirects = false
|
40
54
|
end
|
41
55
|
|
42
56
|
Then /^it should purge cache entries tagged: (.+)$/ do |tags|
|
43
57
|
expected = tags.split(',').map(&:strip)
|
44
|
-
actual =
|
58
|
+
actual = page.response_headers[Rack::Cache::Tags::PURGE_TAGS_HEADER]
|
45
59
|
assert actual, 'no purge tags headers found'
|
46
60
|
assert_equal expected.sort, actual.split("\n").sort
|
47
61
|
end
|
48
62
|
|
49
63
|
Then /^it should purge the cache entries: (.+)$/ do |urls|
|
50
64
|
expected = urls.split(',').map(&:strip).sort
|
51
|
-
actual =
|
65
|
+
actual = page.response_headers[Rack::Cache::Purge::PURGE_HEADER]
|
52
66
|
assert actual, 'no purge headers found'
|
53
67
|
actual = actual.split("\n").map { |url| url.sub('http://www.example.com', '') }.sort
|
54
68
|
assert_equal expected, actual, "did not purge the expected urls.\n expected: #{expected.inspect}\n actual: #{actual.inspect}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adva-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 14
|
10
|
+
version: 0.0.14
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Fuchs
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-02-27 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: adva-core
|
@@ -72,15 +71,15 @@ dependencies:
|
|
72
71
|
requirements:
|
73
72
|
- - "="
|
74
73
|
- !ruby/object:Gem::Version
|
75
|
-
hash:
|
74
|
+
hash: 21
|
76
75
|
segments:
|
77
76
|
- 0
|
78
77
|
- 0
|
79
|
-
-
|
80
|
-
version: 0.0.
|
78
|
+
- 5
|
79
|
+
version: 0.0.5
|
81
80
|
type: :runtime
|
82
81
|
version_requirements: *id004
|
83
|
-
description: Cache engine for adva-cms2
|
82
|
+
description: Cache engine for adva-cms2.
|
84
83
|
email: nobody@adva-cms.org
|
85
84
|
executables: []
|
86
85
|
|
@@ -89,13 +88,13 @@ extensions: []
|
|
89
88
|
extra_rdoc_files: []
|
90
89
|
|
91
90
|
files:
|
92
|
-
-
|
91
|
+
- db/migrate/20100904224918_adva_cache_create_tables.rb
|
93
92
|
- lib/adva/cache/responder/purge.rb
|
94
93
|
- lib/adva/cache/responder.rb
|
95
94
|
- lib/adva/cache.rb
|
95
|
+
- lib/adva-cache.rb
|
96
96
|
- lib/adva_cache/version.rb
|
97
97
|
- lib/testing/step_definitions.rb
|
98
|
-
has_rdoc: true
|
99
98
|
homepage: http://github.com/svenfuchs/adva-cms2
|
100
99
|
licenses: []
|
101
100
|
|
@@ -125,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
124
|
requirements: []
|
126
125
|
|
127
126
|
rubyforge_project: "[none]"
|
128
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 1.8.10
|
129
128
|
signing_key:
|
130
129
|
specification_version: 3
|
131
130
|
summary: Cache engine for adva-cms2
|