Skip to content

Commit dfef447

Browse files
committed
Fix rubocop and cleanup test
Followup to rails#42794. This fixes a rubocop failure for the spacing before the curly brace and uses a more common/correct approach to testing the error message.
1 parent 86aeadc commit dfef447

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

railties/test/application/rake/multi_dbs_test.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,21 +1080,18 @@ class TwoMigration < ActiveRecord::Migration::Current
10801080
YAML
10811081

10821082
Dir.chdir(app_path) do
1083-
animals_db_exists = lambda{ rails("runner", "puts !!(AnimalsBase.connection rescue false)").strip }
1083+
animals_db_exists = lambda { rails("runner", "puts !!(AnimalsBase.connection rescue false)").strip }
10841084

10851085
generate_models_for_animals
10861086

10871087
assert_equal "true", animals_db_exists.call
10881088

10891089
assert_not File.exist?("db/animals_schema.yml")
10901090

1091-
begin
1092-
assert_raise RuntimeError do
1093-
rails "db:migrate:animals" ### Task not defined
1094-
end
1095-
rescue RuntimeError => e
1096-
assert_includes e.message, "See the list of available tasks"
1091+
error = assert_raises do
1092+
rails "db:migrate:animals" ### Task not defined
10971093
end
1094+
assert_includes error.message, "See the list of available tasks"
10981095

10991096
rails "db:schema:dump"
11001097
assert_not File.exist?("db/animals_schema.yml")
@@ -1103,7 +1100,6 @@ class TwoMigration < ActiveRecord::Migration::Current
11031100
assert_equal "true", animals_db_exists.call
11041101
end
11051102
end
1106-
11071103
end
11081104
end
11091105
end

0 commit comments

Comments
 (0)