0835527d6b
Omit `rails activestorage:install` for jdbcmysql, jdbc and shebang tests AppGeneratorTest#test_config_jdbcmysql_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/mysql_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_config_jdbc_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/jdbc_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_shebang_is_added_to_rails_file /home/ubuntu/.rbenv/versions/2.4.1/bin/ruby: no Ruby script found in input (LoadError) Prevent PendingMigrationError in tests * Run `bin/rails db:migrate RAILS_ENV=test` in test_cases before start tests to prevent PendingMigrationError * FileUtils.rm_r("db/migrate") * --skip-active-storage Fix failed tests in `railties/test/railties/engine_test.rb` Related to #30111 Imporve `SharedGeneratorTests#test_default_frameworks_are_required_when_others_are_removed` - Explicitly skip active_storage - Ensure that skipped frameworks are commented - Ensure that default frameworks are not commented Fix error `Errno::ENOSPC: No space left on device - sendfile` Since `rails new` runs `rails active_storage:install` that boots an app. Since adding Bootsnap 0312a5c67e35b960e33677b5358c539f1047e4e1 during booting an app, it creates the cache: 264K tmp/cache/bootsnap-load-path-cache 27M tmp/cache/bootsnap-compile-cache * teardown_app must remove app
77 lines
2.0 KiB
Ruby
77 lines
2.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "isolation/abstract_unit"
|
|
require "env_helpers"
|
|
|
|
module ApplicationTests
|
|
class IntegrationTestCaseTest < ActiveSupport::TestCase
|
|
include ActiveSupport::Testing::Isolation, EnvHelpers
|
|
|
|
setup do
|
|
build_app
|
|
end
|
|
|
|
teardown do
|
|
teardown_app
|
|
end
|
|
|
|
test "resets Action Mailer test deliveries" do
|
|
rails "generate", "mailer", "BaseMailer", "welcome"
|
|
|
|
app_file "test/integration/mailer_integration_test.rb", <<-RUBY
|
|
require 'test_helper'
|
|
|
|
class MailerIntegrationTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
@old_delivery_method = ActionMailer::Base.delivery_method
|
|
ActionMailer::Base.delivery_method = :test
|
|
end
|
|
|
|
teardown do
|
|
ActionMailer::Base.delivery_method = @old_delivery_method
|
|
end
|
|
|
|
2.times do |i|
|
|
define_method "test_resets_deliveries_\#{i}" do
|
|
BaseMailer.welcome.deliver_now
|
|
assert_equal 1, ActionMailer::Base.deliveries.count
|
|
end
|
|
end
|
|
end
|
|
RUBY
|
|
|
|
with_rails_env("test") { rails("db:migrate") }
|
|
output = rails("test")
|
|
assert_match(/0 failures, 0 errors/, output)
|
|
end
|
|
end
|
|
|
|
class IntegrationTestDefaultApp < ActiveSupport::TestCase
|
|
include ActiveSupport::Testing::Isolation, EnvHelpers
|
|
|
|
setup do
|
|
build_app
|
|
end
|
|
|
|
teardown do
|
|
teardown_app
|
|
end
|
|
|
|
test "app method of integration tests returns test_app by default" do
|
|
app_file "test/integration/default_app_test.rb", <<-RUBY
|
|
require 'test_helper'
|
|
|
|
class DefaultAppIntegrationTest < ActionDispatch::IntegrationTest
|
|
def test_app_returns_action_dispatch_test_app_by_default
|
|
assert_equal ActionDispatch.test_app, app
|
|
end
|
|
end
|
|
RUBY
|
|
|
|
with_rails_env("test") { rails("db:migrate") }
|
|
output = rails("test")
|
|
assert_match(/0 failures, 0 errors/, output)
|
|
end
|
|
end
|
|
end
|