diff options
author | Eliot Sykes <eliotsykes@gmail.com> | 2015-05-04 20:55:23 +0100 |
---|---|---|
committer | Eliot Sykes <eliotsykes@gmail.com> | 2015-05-28 09:41:00 +0100 |
commit | 3ff39494cdea67502dbd6465358eca3e14a84d6b (patch) | |
tree | 89e83c974e2e515de9aa12fcc09176255fa905ee /actionpack/test/dispatch | |
parent | 7cc9754209c0ae00d70bdd629fa4a81a1c74cc6f (diff) | |
download | rails-3ff39494cdea67502dbd6465358eca3e14a84d6b.tar.gz rails-3ff39494cdea67502dbd6465358eca3e14a84d6b.tar.bz2 rails-3ff39494cdea67502dbd6465358eca3e14a84d6b.zip |
config.static_index configures directory index "index.html" filename
Set `config.static_index` to serve a static directory index file not
named `index`. For example, to serve `main.html` instead of `index.html`
for directory requests, set `config.static_index` to `"main"`.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/static_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb index 93e5c85a97..e729cc44f9 100644 --- a/actionpack/test/dispatch/static_test.rb +++ b/actionpack/test/dispatch/static_test.rb @@ -57,6 +57,7 @@ module StaticTests def test_serves_static_index_file_in_directory assert_html "/foo/index.html", get("/foo/index.html") + assert_html "/foo/index.html", get("/foo/index") assert_html "/foo/index.html", get("/foo/") assert_html "/foo/index.html", get("/foo") end @@ -260,6 +261,19 @@ class StaticTest < ActiveSupport::TestCase } assert_equal(DummyApp.call(nil), @app.call(env)) end + + def test_non_default_static_index + @app = ActionDispatch::Static.new(DummyApp, @root, "public, max-age=60", "other-index") + assert_html "/other-index.html", get("/other-index.html") + assert_html "/other-index.html", get("/other-index") + assert_html "/other-index.html", get("/") + assert_html "/other-index.html", get("") + assert_html "/foo/other-index.html", get("/foo/other-index.html") + assert_html "/foo/other-index.html", get("/foo/other-index") + assert_html "/foo/other-index.html", get("/foo/") + assert_html "/foo/other-index.html", get("/foo") + end + end class StaticEncodingTest < StaticTest |