aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/static_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/static_test.rb')
-rw-r--r--actionpack/test/dispatch/static_test.rb41
1 files changed, 8 insertions, 33 deletions
diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb
index 655745a848..9f3cbd19ef 100644
--- a/actionpack/test/dispatch/static_test.rb
+++ b/actionpack/test/dispatch/static_test.rb
@@ -5,6 +5,12 @@ module StaticTests
assert_equal "Hello, World!", get("/nofile").body
end
+ def test_sets_cache_control
+ response = get("/index.html")
+ assert_html "/index.html", response
+ assert_equal "public, max-age=60", response.headers["Cache-Control"]
+ end
+
def test_serves_static_index_at_root
assert_html "/index.html", get("/index.html")
assert_html "/index.html", get("/index")
@@ -40,42 +46,11 @@ class StaticTest < ActiveSupport::TestCase
DummyApp = lambda { |env|
[200, {"Content-Type" => "text/plain"}, ["Hello, World!"]]
}
- App = ActionDispatch::Static.new(DummyApp, "#{FIXTURE_LOAD_PATH}/public")
-
- def setup
- @app = App
- end
-
- include StaticTests
-end
-
-class MultipleDirectorisStaticTest < ActiveSupport::TestCase
- DummyApp = lambda { |env|
- [200, {"Content-Type" => "text/plain"}, ["Hello, World!"]]
- }
- App = ActionDispatch::Static.new(DummyApp,
- { "/" => "#{FIXTURE_LOAD_PATH}/public",
- "/blog" => "#{FIXTURE_LOAD_PATH}/blog_public",
- "/foo" => "#{FIXTURE_LOAD_PATH}/non_existing_dir"
- })
+ App = ActionDispatch::Static.new(DummyApp, "#{FIXTURE_LOAD_PATH}/public", "public, max-age=60")
def setup
@app = App
end
include StaticTests
-
- test "serves files from other mounted directories" do
- assert_html "/blog/index.html", get("/blog/index.html")
- assert_html "/blog/index.html", get("/blog/index")
- assert_html "/blog/index.html", get("/blog/")
-
- assert_html "/blog/blog.html", get("/blog/blog/")
- assert_html "/blog/blog.html", get("/blog/blog.html")
- assert_html "/blog/blog.html", get("/blog/blog")
-
- assert_html "/blog/subdir/index.html", get("/blog/subdir/index.html")
- assert_html "/blog/subdir/index.html", get("/blog/subdir/")
- assert_html "/blog/subdir/index.html", get("/blog/subdir")
- end
-end
+end \ No newline at end of file