Skip to content

Commit b2a8f55

Browse files
committed
refactor(test): do not dump when not necessary
1 parent fb3dff3 commit b2a8f55

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

activerecord/test/cases/adapters/postgresql/enum_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def test_schema_dump_scoped_to_schemas
246246
t.column :current_mood, :mood_in_test_schema
247247
end
248248

249-
output = dump_all_table_schema
249+
output = dump_table_schema("postgresql_enums_in_test_schema")
250250

251251
assert_includes output, 'create_enum "public.mood", ["sad", "ok", "happy"]'
252252
assert_includes output, 'create_enum "mood_in_test_schema", ["sad", "ok", "happy"]'

activerecord/test/cases/tasks/database_tasks_test.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,9 @@ def test_ensure_db_dir
370370
FileUtils.rm_rf(dir)
371371
assert_not File.file?(path)
372372

373-
ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config)
373+
ActiveRecord::SchemaDumper.stub(:dump, "") do # Do not actually dump for test performances
374+
ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config)
375+
end
374376

375377
assert File.file?(path)
376378
end
@@ -389,7 +391,9 @@ def test_db_dir_ignored_if_included_in_schema_dump
389391
FileUtils.rm_rf(dir)
390392
assert_not File.file?(path)
391393

392-
ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config)
394+
ActiveRecord::SchemaDumper.stub(:dump, "") do # Do not actually dump for test performances
395+
ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config)
396+
end
393397

394398
assert File.file?(path)
395399
end

0 commit comments

Comments
 (0)