aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/app_generator_test.rb
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-02-25 09:43:33 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-02-25 09:43:33 +0530
commit9ea8de334e6298210b96ff1ff9c02f266d79b8d2 (patch)
treee136fde0a3c81882ba73e5a957e94a85f4eb50e0 /railties/test/generators/app_generator_test.rb
parent00c4ecf38c303210ceb869cfc6d4c1f9f05b8050 (diff)
downloadrails-9ea8de334e6298210b96ff1ff9c02f266d79b8d2.tar.gz
rails-9ea8de334e6298210b96ff1ff9c02f266d79b8d2.tar.bz2
rails-9ea8de334e6298210b96ff1ff9c02f266d79b8d2.zip
Old applications will not get the ssl_options initializer
- We will remove the initializer for old apps which are migrated to Rails 5 so that they are not affected by this breaking change.
Diffstat (limited to 'railties/test/generators/app_generator_test.rb')
-rw-r--r--railties/test/generators/app_generator_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index bc80c7eb1b..ec8ec4787f 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -241,6 +241,34 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_rails_update_does_not_create_ssl_options_by_default
+ app_root = File.join(destination_root, 'myapp')
+ run_generator [app_root]
+
+ FileUtils.rm("#{app_root}/config/initializers/ssl_options.rb")
+
+ stub_rails_application(app_root) do
+ generator = Rails::Generators::AppGenerator.new ["rails"], { with_dispatchers: true }, destination_root: app_root, shell: @shell
+ generator.send(:app_const)
+ quietly { generator.send(:update_config_files) }
+ assert_no_file "#{app_root}/config/initializers/ssl_options.rb"
+ end
+ end
+
+ def test_rails_update_does_not_remove_ssl_options_if_already_present
+ app_root = File.join(destination_root, 'myapp')
+ run_generator [app_root]
+
+ FileUtils.touch("#{app_root}/config/initializers/ssl_options.rb")
+
+ stub_rails_application(app_root) do
+ generator = Rails::Generators::AppGenerator.new ["rails"], { with_dispatchers: true }, destination_root: app_root, shell: @shell
+ generator.send(:app_const)
+ quietly { generator.send(:update_config_files) }
+ assert_file "#{app_root}/config/initializers/ssl_options.rb"
+ end
+ end
+
def test_application_names_are_not_singularized
run_generator [File.join(destination_root, "hats")]
assert_file "hats/config/environment.rb", /Rails\.application\.initialize!/