forked from rails/rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ActionController::Caching depends on RackDelegation and AbstractContr…
…oller::Callbacks
- Loading branch information
1 parent
56a1bb2
commit 459de6f
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'abstract_unit' | ||
|
||
CACHE_DIR = 'test_cache' | ||
# Don't change '/../temp/' cavalierly or you might hose something you don't want hosed | ||
FILE_STORE_PATH = File.join(File.dirname(__FILE__), '/../temp/', CACHE_DIR) | ||
|
||
class CachingController < ActionController::Metal | ||
abstract! | ||
|
||
include ActionController::Caching | ||
|
||
self.page_cache_directory = FILE_STORE_PATH | ||
self.cache_store = :file_store, FILE_STORE_PATH | ||
end | ||
|
||
class PageCachingTestController < CachingController | ||
caches_page :ok | ||
|
||
def ok | ||
self.response_body = "ok" | ||
end | ||
end | ||
|
||
class PageCachingTest < ActionController::TestCase | ||
tests PageCachingTestController | ||
|
||
def test_should_cache_get_with_ok_status | ||
get :ok | ||
assert_response :ok | ||
assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/ok.html"), "get with ok status should have been cached" | ||
end | ||
end |