aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/app_generator_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-06-29 09:39:41 -0300
committerJosé Valim <jose.valim@gmail.com>2011-06-29 09:41:16 -0300
commitc690b7124d2f2206342d11aebb7aa3fc990046d2 (patch)
tree1d4e0bc6a60c46ae7e2e6fed8965320ed997f208 /railties/test/generators/app_generator_test.rb
parent4106245530bc573c035fe70e8fc8633e89741abd (diff)
downloadrails-c690b7124d2f2206342d11aebb7aa3fc990046d2.tar.gz
rails-c690b7124d2f2206342d11aebb7aa3fc990046d2.tar.bz2
rails-c690b7124d2f2206342d11aebb7aa3fc990046d2.zip
[IMPORTANT] Make "sprockets/railtie" require explicit.
This makes "sprockets/railtie" explicit. This means that sprockets will be loaded when you require "rails/all". If you are not using requiring "rails/all", you need to manually load it with all other framework railties. In order to be complete, this commit also adds --skip-sprockets to the rails generator.
Diffstat (limited to 'railties/test/generators/app_generator_test.rb')
-rw-r--r--railties/test/generators/app_generator_test.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index eb60674a03..81f0bf5e82 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -48,11 +48,12 @@ class AppGeneratorTest < Rails::Generators::TestCase
::DEFAULT_APP_FILES
end
- def test_application_controller_and_layout_files
+ def test_assets
run_generator
assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/
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/
end
def test_invalid_application_name_raises_an_error
@@ -180,15 +181,20 @@ class AppGeneratorTest < Rails::Generators::TestCase
def test_generator_if_skip_active_record_is_given
run_generator [destination_root, "--skip-active-record"]
assert_no_file "config/database.yml"
+ assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/
assert_file "test/test_helper.rb" do |helper_content|
assert_no_match(/fixtures :all/, helper_content)
end
assert_file "test/performance/browsing_test.rb"
end
- def test_active_record_is_removed_from_frameworks_if_skip_active_record_is_given
- run_generator [destination_root, "--skip-active-record"]
- assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/
+ def test_generator_if_skip_active_record_is_given
+ run_generator [destination_root, "--skip-sprockets"]
+ assert_file "config/application.rb" do |content|
+ assert_match(/#\s+require\s+["']sprockets\/railtie["']/, content)
+ assert_no_match(/config\.assets\.enabled = true/, content)
+ end
+ assert_file "test/performance/browsing_test.rb"
end
def test_creation_of_a_test_directory