aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware/cache_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/middleware/cache_test.rb')
-rw-r--r--railties/test/application/middleware/cache_test.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/railties/test/application/middleware/cache_test.rb b/railties/test/application/middleware/cache_test.rb
index fffe79f9cc..9b6c76e7aa 100644
--- a/railties/test/application/middleware/cache_test.rb
+++ b/railties/test/application/middleware/cache_test.rb
@@ -19,17 +19,17 @@ module ApplicationTests
controller :expires, <<-RUBY
class ExpiresController < ApplicationController
def expires_header
- expires_in 10, :public => !params[:private]
- render :text => SecureRandom.hex(16)
+ expires_in 10, public: !params[:private]
+ render text: SecureRandom.hex(16)
end
def expires_etag
- render_conditionally(:etag => "1")
+ render_conditionally(etag: "1")
end
def expires_last_modified
$last_modified ||= Time.now.utc
- render_conditionally(:last_modified => $last_modified)
+ render_conditionally(last_modified: $last_modified)
end
def keeps_if_modified_since
@@ -37,8 +37,8 @@ module ApplicationTests
end
private
def render_conditionally(headers)
- if stale?(headers.merge(:public => !params[:private]))
- render :text => SecureRandom.hex(16)
+ if stale?(headers.merge(public: !params[:private]))
+ render text: SecureRandom.hex(16)
end
end
end
@@ -96,13 +96,13 @@ module ApplicationTests
def test_cache_works_with_expires_private
simple_controller
- get "/expires/expires_header", :private => true
+ get "/expires/expires_header", private: true
assert_equal "miss", last_response.headers["X-Rack-Cache"]
assert_equal "private, max-age=10", last_response.headers["Cache-Control"]
body = last_response.body
- get "/expires/expires_header", :private => true
+ get "/expires/expires_header", private: true
assert_equal "miss", last_response.headers["X-Rack-Cache"]
assert_not_equal body, last_response.body
end
@@ -125,14 +125,14 @@ module ApplicationTests
def test_cache_works_with_etags_private
simple_controller
- get "/expires/expires_etag", :private => true
+ get "/expires/expires_etag", private: true
assert_equal "miss", last_response.headers["X-Rack-Cache"]
assert_equal "must-revalidate, private, max-age=0", last_response.headers["Cache-Control"]
body = last_response.body
etag = last_response.headers["ETag"]
- get "/expires/expires_etag", {:private => true}, "If-None-Match" => etag
+ get "/expires/expires_etag", {private: true}, "If-None-Match" => etag
assert_equal "miss", last_response.headers["X-Rack-Cache"]
assert_not_equal body, last_response.body
end
@@ -155,14 +155,14 @@ module ApplicationTests
def test_cache_works_with_last_modified_private
simple_controller
- get "/expires/expires_last_modified", :private => true
+ get "/expires/expires_last_modified", private: true
assert_equal "miss", last_response.headers["X-Rack-Cache"]
assert_equal "must-revalidate, private, max-age=0", last_response.headers["Cache-Control"]
body = last_response.body
last = last_response.headers["Last-Modified"]
- get "/expires/expires_last_modified", {:private => true}, "If-Modified-Since" => last
+ get "/expires/expires_last_modified", {private: true}, "If-Modified-Since" => last
assert_equal "miss", last_response.headers["X-Rack-Cache"]
assert_not_equal body, last_response.body
end