aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-08-07 04:31:14 +0000
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-11-06 21:29:14 +0000
commit0835527d6bb970cedd33633503506e41156ab780 (patch)
tree7f68428f01f469871ad6f44256112d529d7cf5d3 /railties/test/application
parent4a835aa3236eedb135ccf8b59ed3c03e040b8b01 (diff)
downloadrails-0835527d6bb970cedd33633503506e41156ab780.tar.gz
rails-0835527d6bb970cedd33633503506e41156ab780.tar.bz2
rails-0835527d6bb970cedd33633503506e41156ab780.zip
`rails new` runs `rails active_storage:install`
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
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/bin_setup_test.rb4
-rw-r--r--railties/test/application/integration_test_case_test.rb7
-rw-r--r--railties/test/application/rackup_test.rb1
-rw-r--r--railties/test/application/rake/dbs_test.rb4
-rw-r--r--railties/test/application/test_runner_test.rb5
-rw-r--r--railties/test/application/test_test.rb5
6 files changed, 24 insertions, 2 deletions
diff --git a/railties/test/application/bin_setup_test.rb b/railties/test/application/bin_setup_test.rb
index 54934dbe24..9fac0435e4 100644
--- a/railties/test/application/bin_setup_test.rb
+++ b/railties/test/application/bin_setup_test.rb
@@ -16,6 +16,8 @@ module ApplicationTests
def test_bin_setup
Dir.chdir(app_path) do
+ FileUtils.rm_rf("db/migrate")
+
app_file "db/schema.rb", <<-RUBY
ActiveRecord::Schema.define(version: 20140423102712) do
create_table(:articles) {}
@@ -37,6 +39,8 @@ module ApplicationTests
def test_bin_setup_output
Dir.chdir(app_path) do
+ FileUtils.rm_rf("db/migrate")
+
app_file "db/schema.rb", ""
output = `bin/setup 2>&1`
diff --git a/railties/test/application/integration_test_case_test.rb b/railties/test/application/integration_test_case_test.rb
index 9edc907fce..c08761092b 100644
--- a/railties/test/application/integration_test_case_test.rb
+++ b/railties/test/application/integration_test_case_test.rb
@@ -1,10 +1,11 @@
# frozen_string_literal: true
require "isolation/abstract_unit"
+require "env_helpers"
module ApplicationTests
class IntegrationTestCaseTest < ActiveSupport::TestCase
- include ActiveSupport::Testing::Isolation
+ include ActiveSupport::Testing::Isolation, EnvHelpers
setup do
build_app
@@ -39,13 +40,14 @@ module ApplicationTests
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
+ include ActiveSupport::Testing::Isolation, EnvHelpers
setup do
build_app
@@ -66,6 +68,7 @@ module ApplicationTests
end
RUBY
+ with_rails_env("test") { rails("db:migrate") }
output = rails("test")
assert_match(/0 failures, 0 errors/, output)
end
diff --git a/railties/test/application/rackup_test.rb b/railties/test/application/rackup_test.rb
index 383f18a7da..1dcc2826f0 100644
--- a/railties/test/application/rackup_test.rb
+++ b/railties/test/application/rackup_test.rb
@@ -26,6 +26,7 @@ module ApplicationTests
test "config.ru can be racked up" do
Dir.chdir app_path do
+ FileUtils.rm_rf("db/migrate")
@app = rackup
assert_welcome get("/")
end
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb
index fd22477539..009f2887c9 100644
--- a/railties/test/application/rake/dbs_test.rb
+++ b/railties/test/application/rake/dbs_test.rb
@@ -287,6 +287,8 @@ module ApplicationTests
ENV.delete "RAILS_ENV"
ENV.delete "RACK_ENV"
+ Dir.chdir(app_path) { FileUtils.rm_rf("db/migrate") }
+
app_file "db/schema.rb", <<-RUBY
ActiveRecord::Schema.define(version: "1") do
create_table :users do |t|
@@ -308,6 +310,8 @@ module ApplicationTests
end
test "db:setup sets ar_internal_metadata" do
+ Dir.chdir(app_path) { FileUtils.rm_rf("db/migrate") }
+
app_file "db/schema.rb", ""
rails "db:setup"
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb
index e92a0466dd..30bd283b48 100644
--- a/railties/test/application/test_runner_test.rb
+++ b/railties/test/application/test_runner_test.rb
@@ -11,6 +11,7 @@ module ApplicationTests
def setup
build_app
create_schema
+ remove_migrations
end
def teardown
@@ -727,6 +728,10 @@ module ApplicationTests
app_file "db/schema.rb", ""
end
+ def remove_migrations
+ Dir.chdir(app_path) { FileUtils.rm_rf("db/migrate") }
+ end
+
def create_test_file(path = :unit, name = "test", pass: true)
app_file "test/#{path}/#{name}_test.rb", <<-RUBY
require 'test_helper'
diff --git a/railties/test/application/test_test.rb b/railties/test/application/test_test.rb
index 0a51e98656..50238ed682 100644
--- a/railties/test/application/test_test.rb
+++ b/railties/test/application/test_test.rb
@@ -8,6 +8,7 @@ module ApplicationTests
def setup
build_app
+ remove_migrations
end
def teardown
@@ -320,6 +321,10 @@ Expected: ["id", "name"]
end
private
+ def remove_migrations
+ Dir.chdir(app_path) { FileUtils.rm_rf("db/migrate") }
+ end
+
def assert_unsuccessful_run(name, message)
result = run_test_file(name)
assert_not_equal 0, $?.to_i