aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware
diff options
context:
space:
mode:
authorEliot Sykes <eliotsykes@gmail.com>2015-05-04 20:55:23 +0100
committerEliot Sykes <eliotsykes@gmail.com>2015-05-28 09:41:00 +0100
commit3ff39494cdea67502dbd6465358eca3e14a84d6b (patch)
tree89e83c974e2e515de9aa12fcc09176255fa905ee /railties/test/application/middleware
parent7cc9754209c0ae00d70bdd629fa4a81a1c74cc6f (diff)
downloadrails-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 'railties/test/application/middleware')
-rw-r--r--railties/test/application/middleware/static_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/railties/test/application/middleware/static_test.rb b/railties/test/application/middleware/static_test.rb
index 121c5d3321..1a46cd3568 100644
--- a/railties/test/application/middleware/static_test.rb
+++ b/railties/test/application/middleware/static_test.rb
@@ -26,5 +26,26 @@ module ApplicationTests
assert_not last_response.headers.has_key?('Cache-Control'), "Cache-Control should not be set"
end
+
+ test "static_index defaults to 'index'" do
+ app_file "public/index.html", "/index.html"
+
+ require "#{app_path}/config/environment"
+
+ get '/'
+
+ assert_equal "/index.html\n", last_response.body
+ end
+
+ test "static_index configurable" do
+ app_file "public/other-index.html", "/other-index.html"
+ add_to_config "config.static_index = 'other-index'"
+
+ require "#{app_path}/config/environment"
+
+ get '/'
+
+ assert_equal "/other-index.html\n", last_response.body
+ end
end
end