openstreetmap-actionpack-page_caching 1.1.2
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.
- checksums.yaml +7 -0
- data/.codeclimate.yml +7 -0
- data/.gitignore +5 -0
- data/.rubocop.yml +116 -0
- data/.travis.yml +43 -0
- data/CHANGELOG.md +47 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +215 -0
- data/Rakefile +11 -0
- data/actionpack-page_caching.gemspec +21 -0
- data/gemfiles/Gemfile-5-0-stable +5 -0
- data/gemfiles/Gemfile-5-1-stable +5 -0
- data/gemfiles/Gemfile-5-2-stable +5 -0
- data/gemfiles/Gemfile-6-0-stable +5 -0
- data/gemfiles/Gemfile-edge +6 -0
- data/lib/action_controller/caching/pages.rb +306 -0
- data/lib/action_controller/page_caching.rb +13 -0
- data/lib/actionpack/page_caching.rb +1 -0
- data/lib/actionpack/page_caching/railtie.rb +17 -0
- data/test/abstract_unit.rb +12 -0
- data/test/caching_test.rb +524 -0
- data/test/log_subscriber_test.rb +57 -0
- metadata +95 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
require "abstract_unit"
|
2
|
+
require "active_support/log_subscriber/test_helper"
|
3
|
+
require "action_controller/log_subscriber"
|
4
|
+
|
5
|
+
module Another
|
6
|
+
class LogSubscribersController < ActionController::Base
|
7
|
+
abstract!
|
8
|
+
|
9
|
+
self.perform_caching = true
|
10
|
+
|
11
|
+
def with_page_cache
|
12
|
+
cache_page("Super soaker", "/index.html")
|
13
|
+
head :ok
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class ACLogSubscriberTest < ActionController::TestCase
|
19
|
+
tests Another::LogSubscribersController
|
20
|
+
include ActiveSupport::LogSubscriber::TestHelper
|
21
|
+
|
22
|
+
def setup
|
23
|
+
super
|
24
|
+
|
25
|
+
@routes = ActionDispatch::Routing::RouteSet.new
|
26
|
+
|
27
|
+
@cache_path = File.expand_path("../tmp/test_cache", __FILE__)
|
28
|
+
ActionController::Base.page_cache_directory = @cache_path
|
29
|
+
@controller.cache_store = :file_store, @cache_path
|
30
|
+
ActionController::LogSubscriber.attach_to :action_controller
|
31
|
+
end
|
32
|
+
|
33
|
+
def teardown
|
34
|
+
ActiveSupport::LogSubscriber.log_subscribers.clear
|
35
|
+
FileUtils.rm_rf(@cache_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_logger(logger)
|
39
|
+
ActionController::Base.logger = logger
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_with_page_cache
|
43
|
+
with_routing do |set|
|
44
|
+
set.draw do
|
45
|
+
get "/with_page_cache", to: "another/log_subscribers#with_page_cache"
|
46
|
+
end
|
47
|
+
|
48
|
+
get :with_page_cache
|
49
|
+
wait
|
50
|
+
|
51
|
+
logs = @logger.logged(:info)
|
52
|
+
assert_equal 3, logs.size
|
53
|
+
assert_match(/Write page/, logs[1])
|
54
|
+
assert_match(/\/index\.html/, logs[1])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openstreetmap-actionpack-page_caching
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Heinemeier Hansson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionpack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mocha
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Static page caching for Action Pack (removed from core in Rails 4.0)
|
42
|
+
email: tom@compton.nu
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- ".codeclimate.yml"
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- ".travis.yml"
|
51
|
+
- CHANGELOG.md
|
52
|
+
- Gemfile
|
53
|
+
- LICENSE.txt
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- actionpack-page_caching.gemspec
|
57
|
+
- gemfiles/Gemfile-5-0-stable
|
58
|
+
- gemfiles/Gemfile-5-1-stable
|
59
|
+
- gemfiles/Gemfile-5-2-stable
|
60
|
+
- gemfiles/Gemfile-6-0-stable
|
61
|
+
- gemfiles/Gemfile-edge
|
62
|
+
- lib/action_controller/caching/pages.rb
|
63
|
+
- lib/action_controller/page_caching.rb
|
64
|
+
- lib/actionpack/page_caching.rb
|
65
|
+
- lib/actionpack/page_caching/railtie.rb
|
66
|
+
- test/abstract_unit.rb
|
67
|
+
- test/caching_test.rb
|
68
|
+
- test/log_subscriber_test.rb
|
69
|
+
homepage: https://github.com/rails/actionpack-page_caching
|
70
|
+
licenses:
|
71
|
+
- MIT
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 2.4.6
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubygems_version: 3.0.3
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Static page caching for Action Pack (removed from core in Rails 4.0)
|
92
|
+
test_files:
|
93
|
+
- test/abstract_unit.rb
|
94
|
+
- test/caching_test.rb
|
95
|
+
- test/log_subscriber_test.rb
|