diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/test_runner_test.rb | 5 | ||||
-rw-r--r-- | railties/test/command/base_test.rb | 2 | ||||
-rw-r--r-- | railties/test/commands/credentials_test.rb | 8 | ||||
-rw-r--r-- | railties/test/commands/dbconsole_test.rb | 4 | ||||
-rw-r--r-- | railties/test/generators/actions_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/generators_test_helper.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/mailer_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/plugin_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 2 | ||||
-rw-r--r-- | railties/test/railties/mounted_engine_test.rb | 6 |
12 files changed, 35 insertions, 12 deletions
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index fda6df500d..0bdd2b314d 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -16,7 +16,7 @@ module ApplicationTests teardown_app end - def test_run_via_backwardscompatibility + def test_run_via_backwards_compatibility require "minitest/rails_plugin" assert_nothing_raised do @@ -742,6 +742,7 @@ module ApplicationTests def test_reset_sessions_before_rollback_on_system_tests app_file "test/system/reset_session_before_rollback_test.rb", <<-RUBY require "application_system_test_case" + require "selenium/webdriver" class ResetSessionBeforeRollbackTest < ApplicationSystemTestCase def teardown_fixtures @@ -770,6 +771,7 @@ module ApplicationTests def test_reset_sessions_on_failed_system_test_screenshot app_file "test/system/reset_sessions_on_failed_system_test_screenshot_test.rb", <<~RUBY require "application_system_test_case" + require "selenium/webdriver" class ResetSessionsOnFailedSystemTestScreenshotTest < ApplicationSystemTestCase ActionDispatch::SystemTestCase.class_eval do @@ -826,6 +828,7 @@ module ApplicationTests def test_system_tests_are_run_through_rake_test_when_given_in_TEST app_file "test/system/dummy_test.rb", <<-RUBY require "application_system_test_case" + require "selenium/webdriver" class DummyTest < ApplicationSystemTestCase test "something" do diff --git a/railties/test/command/base_test.rb b/railties/test/command/base_test.rb index a49ae8aae7..9132c8b4af 100644 --- a/railties/test/command/base_test.rb +++ b/railties/test/command/base_test.rb @@ -4,10 +4,12 @@ require "abstract_unit" require "rails/command" require "rails/commands/generate/generate_command" require "rails/commands/secrets/secrets_command" +require "rails/commands/db/system/change/change_command" class Rails::Command::BaseTest < ActiveSupport::TestCase test "printing commands" do assert_equal %w(generate), Rails::Command::GenerateCommand.printing_commands assert_equal %w(secrets:setup secrets:edit secrets:show), Rails::Command::SecretsCommand.printing_commands + assert_equal %w(db:system:change), Rails::Command::Db::System::ChangeCommand.printing_commands end end diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb index 7842b0db61..10d0ba1cae 100644 --- a/railties/test/commands/credentials_test.rb +++ b/railties/test/commands/credentials_test.rb @@ -63,6 +63,14 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase end end + test "edit command does not raise when an initializer tries to access non-existent credentials" do + app_file "config/initializers/raise_when_loaded.rb", <<-RUBY + Rails.application.credentials.missing_key! + RUBY + + assert_match(/access_key_id: 123/, run_edit_command(environment: "qa")) + end + test "show credentials" do assert_match(/access_key_id: 123/, run_show_command) end diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb index adb168f7a3..65f6916acb 100644 --- a/railties/test/commands/dbconsole_test.rb +++ b/railties/test/commands/dbconsole_test.rb @@ -112,9 +112,9 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase end def test_mysql_full - start(adapter: "mysql2", database: "db", host: "locahost", port: 1234, socket: "socket", username: "user", password: "qwerty", encoding: "UTF-8") + start(adapter: "mysql2", database: "db", host: "localhost", port: 1234, socket: "socket", username: "user", password: "qwerty", encoding: "UTF-8") assert_not aborted - assert_equal [%w[mysql mysql5], "--host=locahost", "--port=1234", "--socket=socket", "--user=user", "--default-character-set=UTF-8", "-p", "db"], dbconsole.find_cmd_and_exec_args + assert_equal [%w[mysql mysql5], "--host=localhost", "--port=1234", "--socket=socket", "--user=user", "--default-character-set=UTF-8", "-p", "db"], dbconsole.find_cmd_and_exec_args end def test_mysql_include_password diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 4932100ea2..44d4e92256 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -320,6 +320,12 @@ class ActionsTest < Rails::Generators::TestCase assert_no_file "app/models/my_model.rb" end + def test_generate_should_run_command_without_env + assert_called_with(generator, :run, ["rails generate model MyModel name:string", verbose: false]) do + action :generate, "model", "MyModel", "name:string" + end + end + def test_rake_should_run_rake_command_with_default_env assert_called_with(generator, :run, ["rake log:clear RAILS_ENV=development", verbose: false]) do with_rails_env nil do diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index e0cd7f90ce..860e2bf63e 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -199,7 +199,7 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_new_application_use_json_serialzier + def test_new_application_use_json_serializer run_generator assert_file("config/initializers/cookies_serializer.rb", /Rails\.application\.config\.action_dispatch\.cookies_serializer = :json/) diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 975a204af4..8b42cb83db 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -79,7 +79,11 @@ module GeneratorsTestHelper end def evaluate_template(file, locals = {}) - erb = ERB.new(File.read(file), nil, "-", "@output_buffer") + erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ + ERB.new(File.read(file), trim_mode: "-", eoutvar: "@output_buffer") + else + ERB.new(File.read(file), nil, "-", "@output_buffer") + end context = Class.new do locals.each do |local, value| class_attribute local, default: value diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index ddac6e1a1e..099e06c4d3 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -119,7 +119,7 @@ class MailerGeneratorTest < Rails::Generators::TestCase assert_match(/haml \[not found\]/, content) end - def test_mailer_with_namedspaced_mailer + def test_mailer_with_namespaced_mailer run_generator ["Farm::Animal", "moos"] assert_file "app/mailers/farm/animal_mailer.rb" do |mailer| assert_match(/class Farm::AnimalMailer < ApplicationMailer/, mailer) diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index b06db6dd8a..134659f285 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -104,7 +104,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase ActiveRecord::Base.pluralize_table_names = true end - def test_migration_with_namespaces_in_model_name_without_plurization + def test_migration_with_namespaces_in_model_name_without_pluralization ActiveRecord::Base.pluralize_table_names = false run_generator ["Gallery::Image"] assert_migration "db/migrate/create_gallery_image", /class CreateGalleryImage < ActiveRecord::Migration\[[0-9.]+\]/ diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index 4ec656d18b..f45464f8d0 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -442,7 +442,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase end end - def test_dummy_appplication_skip_listen_by_default + def test_dummy_application_skip_listen_by_default run_generator assert_file "test/dummy/config/environments/development.rb" do |contents| diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 01b6cb0a43..e9cf60a13d 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -483,7 +483,7 @@ Module.new do Dir.chdir(app_template_path) { `yarn add https://github.com/rails/webpacker.git` } # Use the latest version. - # Manually install `webpack` as bin symlinks are not created for subdependencies + # Manually install `webpack` as bin symlinks are not created for sub dependencies # in workspaces. See https://github.com/yarnpkg/yarn/issues/4964 Dir.chdir(app_template_path) { `yarn add webpack@4.17.1 --tilde` } Dir.chdir(app_template_path) { `yarn add webpack-cli` } diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb index 48f0fbc80f..9755823e51 100644 --- a/railties/test/railties/mounted_engine_test.rb +++ b/railties/test/railties/mounted_engine_test.rb @@ -232,7 +232,7 @@ module ApplicationTests get "/someone/blog/generate_application_route" assert_equal "/", last_response.body - get "/somone/blog/application_route_in_view" + get "/someone/blog/application_route_in_view" assert_equal "/", last_response.body # test generating engine's route from other engine @@ -258,8 +258,8 @@ module ApplicationTests assert_equal "http://example.org/anonymous/blog/posts/44", last_response.body # test that correct path is generated for the same polymorphic_path call in an engine - get "/somone/blog/engine_polymorphic_path" - assert_equal "/somone/blog/posts/44", last_response.body + get "/someone/blog/engine_polymorphic_path" + assert_equal "/someone/blog/posts/44", last_response.body # and in an application get "/application_polymorphic_path" |