aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/app_loader_test.rb2
-rw-r--r--railties/test/application/per_request_digest_cache_test.rb2
-rw-r--r--railties/test/commands/credentials_test.rb2
-rw-r--r--railties/test/generators/app_generator_test.rb32
-rw-r--r--railties/test/isolation/abstract_unit.rb2
5 files changed, 35 insertions, 5 deletions
diff --git a/railties/test/app_loader_test.rb b/railties/test/app_loader_test.rb
index c7a6bdee1b..93ed68fabb 100644
--- a/railties/test/app_loader_test.rb
+++ b/railties/test/app_loader_test.rb
@@ -76,7 +76,7 @@ class AppLoaderTest < ActiveSupport::TestCase
# Compare the realpath in case either of them has symlinks.
#
- # This happens in particular in Mac OS X, where @tmp starts
+ # This happens in particular in macOS, where @tmp starts
# with "/var", and Dir.pwd with "/private/var", due to a
# default system symlink var -> private/var.
assert_equal File.realpath("#@tmp/foo"), File.realpath(Dir.pwd)
diff --git a/railties/test/application/per_request_digest_cache_test.rb b/railties/test/application/per_request_digest_cache_test.rb
index 10d3313f6e..ab055c7648 100644
--- a/railties/test/application/per_request_digest_cache_test.rb
+++ b/railties/test/application/per_request_digest_cache_test.rb
@@ -5,11 +5,9 @@ require "rack/test"
require "minitest/mock"
require "action_view"
-require "active_support/testing/method_call_assertions"
class PerRequestDigestCacheTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
- include ActiveSupport::Testing::MethodCallAssertions
include Rack::Test::Methods
setup do
diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb
index 663ee73bcd..fc16b8194f 100644
--- a/railties/test/commands/credentials_test.rb
+++ b/railties/test/commands/credentials_test.rb
@@ -49,7 +49,7 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
FileUtils.rm("config/master.key")
switch_env("RAILS_MASTER_KEY", key) do
- run_edit_command
+ assert_match(/access_key_id: 123/, run_edit_command)
assert_not File.exist?("config/master.key")
end
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 3cb7d66bbb..b0f958091c 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -438,6 +438,30 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "config/application.rb", /\s+config\.load_defaults 5\.1/
end
+ def test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name
+ app_root = File.join(destination_root, "hyphenated-app")
+ run_generator [app_root, "-d", "postgresql"]
+
+ assert_file "#{app_root}/config/database.yml" do |content|
+ assert_match(/hyphenated_app_development/, content)
+ assert_no_match(/hyphenated-app_development/, content)
+ end
+
+ assert_file "#{app_root}/config/cable.yml" do |content|
+ assert_match(/hyphenated_app/, content)
+ assert_no_match(/hyphenated-app/, content)
+ end
+
+ FileUtils.cd(app_root) do
+ quietly { system("bin/rails app:update") }
+ end
+
+ assert_file "#{app_root}/config/cable.yml" do |content|
+ assert_match(/hyphenated_app/, content)
+ assert_no_match(/hyphenated-app/, content)
+ 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!/
@@ -891,7 +915,13 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_match(/ruby '#{RUBY_VERSION}'/, content)
end
assert_file ".ruby-version" do |content|
- assert_match(/#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}/, content)
+ if ENV["RBENV_VERSION"]
+ assert_match(/#{ENV["RBENV_VERSION"]}/, content)
+ elsif ENV["rvm_ruby_string"]
+ assert_match(/#{ENV["rvm_ruby_string"]}/, content)
+ else
+ assert_match(/#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}/, content)
+ end
end
end
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 3cde7c03b0..516c457e48 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -14,6 +14,7 @@ require "bundler/setup" unless defined?(Bundler)
require "active_support"
require "active_support/testing/autorun"
require "active_support/testing/stream"
+require "active_support/testing/method_call_assertions"
require "active_support/test_case"
RAILS_FRAMEWORK_ROOT = File.expand_path("../../..", __dir__)
@@ -430,6 +431,7 @@ class ActiveSupport::TestCase
include TestHelpers::Rack
include TestHelpers::Generation
include ActiveSupport::Testing::Stream
+ include ActiveSupport::Testing::MethodCallAssertions
def frozen_error_class
Object.const_defined?(:FrozenError) ? FrozenError : RuntimeError