Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only pick the frameworks in the application.rb if the test_unit is not

present.

rails/all already catches load errors.

Closes #5652
  • Loading branch information...
commit ba41eec2f9c0c53758e56c049c2e5ff1dc786a14 1 parent 39fd844
@rafaelfranca authored
View
2  railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -1,6 +1,6 @@
require File.expand_path('../boot', __FILE__)
-<% if include_all_railties? -%>
+<% unless options.skip_test_unit? -%>
require 'rails/all'
<% else -%>
# Pick the frameworks you want:
View
18 railties/test/generators/app_generator_test.rb
@@ -219,7 +219,7 @@ def test_generator_if_skip_active_record_is_given
assert_match(/gem ["']actionmailer["']/, gemfile_content)
assert_match(/gem ["']sprockets-rails["'], '~> 1\.0'/, gemfile_content)
end
- assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/
+ assert_file "config/application.rb", /\s+require\s+["']rails\/all["']/
assert_file "config/application.rb", /#\s+config\.active_record\.whitelist_attributes = true/
assert_file "config/application.rb", /#\s+config\.active_record\.dependent_restrict_raises = false/
assert_file "test/test_helper.rb" do |helper_content|
@@ -237,7 +237,7 @@ def test_generator_if_skip_action_mailer_is_given
assert_match(/# gem ["']actionmailer["']/, gemfile_content)
assert_match(/gem ["']sprockets-rails["'], '~> 1\.0'/, gemfile_content)
end
- assert_file "config/application.rb", /#\s+require\s+["']action_mailer\/railtie["']/
+ assert_file "config/application.rb", /\s+require\s+["']rails\/all["']/
assert_file "config/environments/development.rb" do |content|
assert_no_match(/config\.action_mailer\.raise_delivery_errors = false/, content)
end
@@ -259,7 +259,7 @@ def test_generator_if_skip_sprockets_is_given
assert_match(/# gem ["']sprockets-rails["'], '~> 1\.0'/, gemfile_content)
end
assert_file "config/application.rb" do |content|
- assert_match(/#\s+require\s+["']sprockets\/rails\/railtie["']/, content)
+ assert_match(/\s+require\s+["']rails\/all["']/, content)
assert_no_match(/config\.assets\.enabled = true/, content)
end
assert_file "Gemfile" do |content|
@@ -372,6 +372,18 @@ def test_no_active_record_or_test_unit_if_skips_given
assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/
end
+ def test_no_action_mailer_or_test_unit_if_skips_given
+ run_generator [destination_root, "--skip-test-unit", "--skip-action-mailer"]
+ assert_file "config/application.rb", /#\s+require\s+["']rails\/test_unit\/railtie["']/
+ assert_file "config/application.rb", /#\s+require\s+["']action_mailer\/railtie["']/
+ end
+
+ def test_no_sprockets_or_test_unit_if_skips_given
+ run_generator [destination_root, "--skip-test-unit", "--skip-sprockets"]
+ assert_file "config/application.rb", /#\s+require\s+["']rails\/test_unit\/railtie["']/
+ assert_file "config/application.rb", /#\s+require\s+["']sprockets\/rails\/railtie["']/
+ end
+
def test_new_hash_style
run_generator [destination_root]
assert_file "config/initializers/session_store.rb" do |file|
Please sign in to comment.
Something went wrong with that request. Please try again.