aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/configuration_test.rb2
-rw-r--r--railties/test/application/rake_test.rb4
-rw-r--r--railties/test/generators/app_generator_test.rb28
3 files changed, 31 insertions, 3 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index decc4d138d..1ca6bbcecf 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1464,7 +1464,7 @@ module ApplicationTests
assert_equal :api, Rails.configuration.debug_exception_response_format
end
- test "debug_exception_response_format can be overriden" do
+ test "debug_exception_response_format can be overridden" do
add_to_config <<-RUBY
config.api_only = true
RUBY
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 1fa5b5e2b5..acdb4e7d79 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -118,8 +118,8 @@ module ApplicationTests
end
def test_code_statistics_sanity
- assert_match "Code LOC: 18 Test LOC: 0 Code to Test Ratio: 1:0.0",
- Dir.chdir(app_path){ `bin/rails stats` }
+ assert_match "Code LOC: 26 Test LOC: 0 Code to Test Ratio: 1:0.0",
+ Dir.chdir(app_path) { `bin/rails stats` }
end
def test_rails_routes_calls_the_route_inspector
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 2d9867fa9d..25a8635e7d 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -257,6 +257,34 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
+ def test_rails_update_does_not_create_to_time_preserves_timezone
+ app_root = File.join(destination_root, 'myapp')
+ run_generator [app_root]
+
+ FileUtils.rm("#{app_root}/config/initializers/to_time_preserves_timezone.rb")
+
+ stub_rails_application(app_root) do
+ generator = Rails::Generators::AppGenerator.new ["rails"], [], destination_root: app_root, shell: @shell
+ generator.send(:app_const)
+ quietly { generator.send(:update_config_files) }
+ assert_no_file "#{app_root}/config/initializers/to_time_preserves_timezone.rb"
+ end
+ end
+
+ def test_rails_update_does_not_remove_to_time_preserves_timezone_if_already_present
+ app_root = File.join(destination_root, 'myapp')
+ run_generator [app_root]
+
+ FileUtils.touch("#{app_root}/config/initializers/to_time_preserves_timezone.rb")
+
+ stub_rails_application(app_root) do
+ generator = Rails::Generators::AppGenerator.new ["rails"], [], destination_root: app_root, shell: @shell
+ generator.send(:app_const)
+ quietly { generator.send(:update_config_files) }
+ assert_file "#{app_root}/config/initializers/to_time_preserves_timezone.rb"
+ end
+ end
+
def test_rails_update_does_not_create_ssl_options_by_default
app_root = File.join(destination_root, 'myapp')
run_generator [app_root]