aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/app_generator_test.rb
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2012-12-05 13:02:51 -0600
committerschneems <richard.schneeman@gmail.com>2012-12-10 16:15:04 -0800
commitbaea5d69be52def2a81c31cd119f8dfcd2aa087b (patch)
tree359da2c9c9113f00cd97162e1ad0b54b0113f5ab /railties/test/generators/app_generator_test.rb
parent8110035623b6a2415d9160f98ab1c9816c5c325c (diff)
downloadrails-baea5d69be52def2a81c31cd119f8dfcd2aa087b.tar.gz
rails-baea5d69be52def2a81c31cd119f8dfcd2aa087b.tar.bz2
rails-baea5d69be52def2a81c31cd119f8dfcd2aa087b.zip
Use Rails to Render Default Index Page
This is an alternative implementation to #7771 thanks to the advice of @spastorino Rails is a dynamic framework that serves a static index.html by default. One of my first questions ever on IRC was solved by simply deleting my public/index.html file. This file is a source of confusion when starting as it over-rides any set "root" in the routes yet it itself is not listed in the routes. By making the page dynamic by default we can eliminate this confusion. This PR moves the static index page to an internal controller/route/view similar to `rails/info`. When someone starts a rails server, if no root is defined, this route will take over and the "dynamic" index page from rails/welcome_controller will be rendered. These routes are only added in development. If a developer defines a root in their routes, it automatically takes precedence over this route and will be rendered, with no deleting of files required. In addition to removing this source of confusion for new devs, we can now use Rails view helpers to build and render this page. While not the primary intent, the added value of "dogfooding" should not be under-estimated. The prior PR #7771 had push-back since it introduced developer facing files. This PR solves all of the same problems, but does not have any new developer facing files (it actually removes one). cc/ @wsouto, @dickeyxxx, @tyre, @ryanb, @josevalim, @maxim, @subdigital, @steveklabnik ATP Railties and Actionpack.
Diffstat (limited to 'railties/test/generators/app_generator_test.rb')
-rw-r--r--railties/test/generators/app_generator_test.rb8
1 files changed, 0 insertions, 8 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 5ea31f2e0f..b7e366d266 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -55,7 +55,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
assert_file "app/assets/stylesheets/application.css"
assert_file "config/application.rb", /config\.assets\.enabled = true/
- assert_file "public/index.html", /url\("assets\/rails.png"\);/
end
def test_invalid_application_name_raises_an_error
@@ -251,13 +250,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
- def test_generator_if_skip_index_html_is_given
- run_generator [destination_root, '--skip-index-html']
- assert_no_file 'public/index.html'
- assert_no_file 'app/assets/images/rails.png'
- assert_file 'app/assets/images/.keep'
- end
-
def test_creation_of_a_test_directory
run_generator
assert_file 'test'