Skip to content

Commit 5324f2c

Browse files
committed
Revert "Merge pull request rails#37215 from utilum/avoid_test_flunking_on_warning"
This reverts commit ed78e96, reversing changes made to eca6c27.
1 parent 2b9edb7 commit 5324f2c

File tree

8 files changed

+52
-51
lines changed

8 files changed

+52
-51
lines changed

railties/test/application/bin_setup_test.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ def test_bin_setup
1616
list_tables = lambda { rails("runner", "p ActiveRecord::Base.connection.tables").strip }
1717
File.write("log/test.log", "zomg!")
1818

19-
assert_match "[]", list_tables.call
19+
assert_equal "[]", list_tables.call
2020
assert_equal 5, File.size("log/test.log")
2121
assert_not File.exist?("tmp/restart.txt")
2222

2323
`bin/setup 2>&1`
2424
assert_equal 0, File.size("log/test.log")
25-
assert_match '["schema_migrations", "ar_internal_metadata", "articles"]', list_tables.call
25+
assert_equal '["schema_migrations", "ar_internal_metadata", "articles"]', list_tables.call
2626
assert File.exist?("tmp/restart.txt")
2727
end
2828
end
@@ -44,17 +44,18 @@ def test_bin_setup_output
4444
# Ignore warnings such as `Psych.safe_load is deprecated`
4545
output.gsub!(/^warning:\s.*\n/, "")
4646

47-
assert_match(<<~OUTPUT, output)
47+
assert_equal(<<~OUTPUT, output)
4848
== Installing dependencies ==
4949
The Gemfile's dependencies are satisfied
5050
5151
== Preparing database ==
52-
OUTPUT
52+
Created database 'app_development'
53+
Created database 'app_test'
54+
55+
== Removing old logs and tempfiles ==
5356
54-
assert_match("Created database 'app_development'", output)
55-
assert_match("Created database 'app_test'", output)
56-
assert_match("== Removing old logs and tempfiles ==", output)
57-
assert_match("== Restarting application server ==", output)
57+
== Restarting application server ==
58+
OUTPUT
5859
end
5960
end
6061
end

railties/test/application/configuration_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,7 @@ class MyLogger < ::Logger
24412441
RUBY
24422442

24432443
output = rails("routes", "-g", "active_storage")
2444-
assert_match <<~MESSAGE, output
2444+
assert_equal <<~MESSAGE, output
24452445
Prefix Verb URI Pattern Controller#Action
24462446
rails_service_blob GET /files/blobs/:signed_id/*filename(.:format) active_storage/blobs#show
24472447
rails_blob_representation GET /files/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show

railties/test/application/rake/dbs_test.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ def db_structure_dump_and_load(expected_database)
420420
require "#{app_path}/config/environment"
421421
db_structure_dump_and_load ActiveRecord::Base.configurations[Rails.env][:database]
422422

423-
assert_match "test", rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip
424-
assert_match "development", rails("runner", "puts ActiveRecord::InternalMetadata[:environment]").strip
423+
assert_equal "test", rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip
424+
assert_equal "development", rails("runner", "puts ActiveRecord::InternalMetadata[:environment]").strip
425425
end
426426

427427
test "db:structure:dump does not dump schema information when no migrations are used" do
@@ -445,16 +445,16 @@ def db_structure_dump_and_load(expected_database)
445445

446446
list_tables = lambda { rails("runner", "p ActiveRecord::Base.connection.tables").strip }
447447

448-
assert_match '["posts"]', list_tables[].to_s
448+
assert_equal '["posts"]', list_tables[]
449449
rails "db:schema:load"
450-
assert_match '["posts", "comments", "schema_migrations", "ar_internal_metadata"]', list_tables[].to_s
450+
assert_equal '["posts", "comments", "schema_migrations", "ar_internal_metadata"]', list_tables[]
451451

452452
app_file "db/structure.sql", <<-SQL
453453
CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255));
454454
SQL
455455

456456
rails "db:structure:load"
457-
assert_match '["posts", "comments", "schema_migrations", "ar_internal_metadata", "users"]', list_tables[].to_s
457+
assert_equal '["posts", "comments", "schema_migrations", "ar_internal_metadata", "users"]', list_tables[]
458458
end
459459

460460
test "db:schema:load with inflections" do
@@ -480,7 +480,7 @@ def db_structure_dump_and_load(expected_database)
480480
assert_match(/"geese"/, tables)
481481

482482
columns = rails("runner", "p ActiveRecord::Base.connection.columns('geese').map(&:name)").strip
483-
assert_includes columns, '["gooseid", "name"]'
483+
assert_equal columns, '["gooseid", "name"]'
484484
end
485485

486486
test "db:schema:load fails if schema.rb doesn't exist yet" do
@@ -539,8 +539,8 @@ def db_test_load_structure
539539
test_environment = lambda { rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip }
540540
development_environment = lambda { rails("runner", "puts ActiveRecord::InternalMetadata[:environment]").strip }
541541

542-
assert_match "test", test_environment.call
543-
assert_match "development", development_environment.call
542+
assert_equal "test", test_environment.call
543+
assert_equal "development", development_environment.call
544544

545545
app_file "db/structure.sql", ""
546546
app_file "config/initializers/enable_sql_schema_format.rb", <<-RUBY
@@ -549,8 +549,8 @@ def db_test_load_structure
549549

550550
rails "db:setup"
551551

552-
assert_match "test", test_environment.call
553-
assert_match "development", development_environment.call
552+
assert_equal "test", test_environment.call
553+
assert_equal "development", development_environment.call
554554
end
555555

556556
test "db:test:prepare sets test ar_internal_metadata" do
@@ -559,7 +559,7 @@ def db_test_load_structure
559559

560560
test_environment = lambda { rails("runner", "-e", "test", "puts ActiveRecord::InternalMetadata[:environment]").strip }
561561

562-
assert_match "test", test_environment.call
562+
assert_equal "test", test_environment.call
563563

564564
app_file "db/structure.sql", ""
565565
app_file "config/initializers/enable_sql_schema_format.rb", <<-RUBY
@@ -568,7 +568,7 @@ def db_test_load_structure
568568

569569
rails "db:test:prepare"
570570

571-
assert_match "test", test_environment.call
571+
assert_equal "test", test_environment.call
572572
end
573573

574574
test "db:seed:replant truncates all non-internal tables and loads the seeds" do

railties/test/application/rake/migrations_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class TwoMigration < ActiveRecord::Migration::Current
179179

180180
test "migration status when schema migrations table is not present" do
181181
output = rails("db:migrate:status", allow_failure: true)
182-
assert_match "Schema migrations table does not exist yet.\n", output
182+
assert_equal "Schema migrations table does not exist yet.\n", output
183183
end
184184

185185
test "migration status" do

railties/test/application/rake/multi_dbs_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def db_migrate_and_schema_dump_and_load(format)
107107
ar_tables = lambda { rails("runner", "p ActiveRecord::Base.connection.tables").strip }
108108
animals_tables = lambda { rails("runner", "p AnimalsBase.connection.tables").strip }
109109

110-
assert_match '["schema_migrations", "ar_internal_metadata", "books"]', ar_tables[]
111-
assert_match '["schema_migrations", "ar_internal_metadata", "dogs"]', animals_tables[]
110+
assert_equal '["schema_migrations", "ar_internal_metadata", "books"]', ar_tables[]
111+
assert_equal '["schema_migrations", "ar_internal_metadata", "dogs"]', animals_tables[]
112112
end
113113
end
114114

@@ -380,7 +380,7 @@ class TwoMigration < ActiveRecord::Migration::Current
380380
RUBY
381381

382382
output = rails("db:seed")
383-
assert_includes output, "db/development.sqlite3"
383+
assert_equal output, "db/development.sqlite3"
384384
ensure
385385
ENV["RAILS_ENV"] = @old_rails_env
386386
ENV["RACK_ENV"] = @old_rack_env

railties/test/application/runner_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_should_run_ruby_statement
3939

4040
def test_should_set_argv_when_running_code
4141
output = rails("runner", "puts ARGV.join(',')", "--foo", "a1", "-b", "a2", "a3", "--moo")
42-
assert_match "--foo,a1,-b,a2,a3,--moo", output.chomp
42+
assert_equal "--foo,a1,-b,a2,a3,--moo", output.chomp
4343
end
4444

4545
def test_should_run_file

railties/test/commands/notes_test.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
1717

1818
app_file "some_other_dir/blah.rb", "# TODO: note in some_other directory"
1919

20-
assert_match <<~OUTPUT, run_notes_command
20+
assert_equal <<~OUTPUT, run_notes_command
2121
app/controllers/some_controller.rb:
2222
* [ 1] [OPTIMIZE] note in app directory
2323
@@ -37,7 +37,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
3737
end
3838

3939
test "`rails notes` displays an empty string when no results were found" do
40-
assert_match "", run_notes_command
40+
assert_equal "", run_notes_command
4141
end
4242

4343
test "`rails notes --annotations` displays results for a single annotation without being prefixed by a tag" do
@@ -47,7 +47,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
4747
app_file "app/controllers/some_controller.rb", "# OPTIMIZE: note in app directory"
4848
app_file "config/initializers/some_initializer.rb", "# TODO: note in config directory"
4949

50-
assert_match <<~OUTPUT, run_notes_command(["--annotations", "FIXME"])
50+
assert_equal <<~OUTPUT, run_notes_command(["--annotations", "FIXME"])
5151
db/some_seeds.rb:
5252
* [1] note in db directory
5353
@@ -64,7 +64,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
6464

6565
app_file "test/some_test.rb", "# FIXME: note in test directory"
6666

67-
assert_match <<~OUTPUT, run_notes_command(["--annotations", "FOOBAR", "TODO"])
67+
assert_equal <<~OUTPUT, run_notes_command(["--annotations", "FOOBAR", "TODO"])
6868
app/controllers/some_controller.rb:
6969
* [1] [FOOBAR] note in app directory
7070
@@ -85,7 +85,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
8585

8686
add_to_config "config.annotations.register_directories \"spec\""
8787

88-
assert_match <<~OUTPUT, run_notes_command
88+
assert_equal <<~OUTPUT, run_notes_command
8989
db/some_seeds.rb:
9090
* [1] [FIXME] note in db directory
9191
@@ -108,7 +108,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
108108
app_file "app/assets/stylesheets/application.css.scss", "// TODO: note in scss"
109109
app_file "app/assets/stylesheets/application.css.sass", "// TODO: note in sass"
110110

111-
assert_match <<~OUTPUT, run_notes_command
111+
assert_equal <<~OUTPUT, run_notes_command
112112
app/assets/stylesheets/application.css.sass:
113113
* [1] [TODO] note in sass
114114
@@ -128,7 +128,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
128128

129129
add_to_config 'config.annotations.register_tags "TESTME", "DEPRECATEME"'
130130

131-
assert_match <<~OUTPUT, run_notes_command
131+
assert_equal <<~OUTPUT, run_notes_command
132132
app/controllers/hello_controller.rb:
133133
* [1] [DEPRECATEME] this action is no longer needed
134134
@@ -149,7 +149,7 @@ class Rails::Command::NotesTest < ActiveSupport::TestCase
149149

150150
add_to_config 'config.annotations.register_tags "TESTME", "DEPRECATEME"'
151151

152-
assert_match <<~OUTPUT, run_notes_command
152+
assert_equal <<~OUTPUT, run_notes_command
153153
app/controllers/hello_controller.rb:
154154
* [1] [DEPRECATEME] this action is no longer needed
155155

railties/test/commands/routes_test.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
1717
end
1818
RUBY
1919

20-
assert_match <<~OUTPUT, run_routes_command([ "-c", "PostController" ])
20+
assert_equal <<~OUTPUT, run_routes_command([ "-c", "PostController" ])
2121
Prefix Verb URI Pattern Controller#Action
2222
new_post GET /post/new(.:format) posts#new
2323
edit_post GET /post/edit(.:format) posts#edit
@@ -29,7 +29,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
2929
rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create
3030
OUTPUT
3131

32-
assert_match <<~OUTPUT, run_routes_command([ "-c", "UserPermissionController" ])
32+
assert_equal <<~OUTPUT, run_routes_command([ "-c", "UserPermissionController" ])
3333
Prefix Verb URI Pattern Controller#Action
3434
new_user_permission GET /user_permission/new(.:format) user_permissions#new
3535
edit_user_permission GET /user_permission/edit(.:format) user_permissions#edit
@@ -50,7 +50,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
5050
end
5151
RUBY
5252

53-
assert_match <<~MESSAGE, run_routes_command([ "-g", "show" ])
53+
assert_equal <<~MESSAGE, run_routes_command([ "-g", "show" ])
5454
Prefix Verb URI Pattern Controller#Action
5555
cart GET /cart(.:format) cart#show
5656
rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show
@@ -59,7 +59,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
5959
rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show
6060
MESSAGE
6161

62-
assert_match <<~MESSAGE, run_routes_command([ "-g", "POST" ])
62+
assert_equal <<~MESSAGE, run_routes_command([ "-g", "POST" ])
6363
Prefix Verb URI Pattern Controller#Action
6464
POST /cart(.:format) cart#create
6565
rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create
@@ -72,7 +72,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
7272
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
7373
MESSAGE
7474

75-
assert_match <<~MESSAGE, run_routes_command([ "-g", "basketballs" ])
75+
assert_equal <<~MESSAGE, run_routes_command([ "-g", "basketballs" ])
7676
Prefix Verb URI Pattern Controller#Action
7777
basketballs GET /basketballs(.:format) basketball#index
7878
MESSAGE
@@ -89,24 +89,24 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
8989

9090
expected_cart_output = "Prefix Verb URI Pattern Controller#Action\n cart GET /cart(.:format) cart#show\n"
9191
output = run_routes_command(["-c", "cart"])
92-
assert_match expected_cart_output, output
92+
assert_equal expected_cart_output, output
9393

9494
output = run_routes_command(["-c", "Cart"])
95-
assert_match expected_cart_output, output
95+
assert_equal expected_cart_output, output
9696

9797
output = run_routes_command(["-c", "CartController"])
98-
assert_match expected_cart_output, output
98+
assert_equal expected_cart_output, output
9999

100100
expected_perm_output = [" Prefix Verb URI Pattern Controller#Action",
101101
"user_permission GET /user_permission(.:format) user_permission#index\n"].join("\n")
102102
output = run_routes_command(["-c", "user_permission"])
103-
assert_match expected_perm_output, output
103+
assert_equal expected_perm_output, output
104104

105105
output = run_routes_command(["-c", "UserPermission"])
106-
assert_match expected_perm_output, output
106+
assert_equal expected_perm_output, output
107107

108108
output = run_routes_command(["-c", "UserPermissionController"])
109-
assert_match expected_perm_output, output
109+
assert_equal expected_perm_output, output
110110
end
111111

112112
test "rails routes with namespaced controller search key" do
@@ -119,7 +119,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
119119
end
120120
RUBY
121121

122-
assert_match <<~OUTPUT, run_routes_command([ "-c", "Admin::PostController" ])
122+
assert_equal <<~OUTPUT, run_routes_command([ "-c", "Admin::PostController" ])
123123
Prefix Verb URI Pattern Controller#Action
124124
new_admin_post GET /admin/post/new(.:format) admin/posts#new
125125
edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit
@@ -130,7 +130,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
130130
POST /admin/post(.:format) admin/posts#create
131131
OUTPUT
132132

133-
assert_match <<~OUTPUT, run_routes_command([ "-c", "PostController" ])
133+
assert_equal <<~OUTPUT, run_routes_command([ "-c", "PostController" ])
134134
Prefix Verb URI Pattern Controller#Action
135135
new_admin_post GET /admin/post/new(.:format) admin/posts#new
136136
edit_admin_post GET /admin/post/edit(.:format) admin/posts#edit
@@ -153,8 +153,8 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
153153
POST /admin/user_permission(.:format) admin/user_permissions#create
154154
OUTPUT
155155

156-
assert_match expected_permission_output, run_routes_command([ "-c", "Admin::UserPermissionController" ])
157-
assert_match expected_permission_output, run_routes_command([ "-c", "UserPermissionController" ])
156+
assert_equal expected_permission_output, run_routes_command([ "-c", "Admin::UserPermissionController" ])
157+
assert_equal expected_permission_output, run_routes_command([ "-c", "UserPermissionController" ])
158158
end
159159

160160
test "rails routes displays message when no routes are defined" do
@@ -163,7 +163,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
163163
end
164164
RUBY
165165

166-
assert_match <<~MESSAGE, run_routes_command
166+
assert_equal <<~MESSAGE, run_routes_command
167167
Prefix Verb URI Pattern Controller#Action
168168
rails_mandrill_inbound_emails POST /rails/action_mailbox/mandrill/inbound_emails(.:format) action_mailbox/ingresses/mandrill/inbound_emails#create
169169
rails_postmark_inbound_emails POST /rails/action_mailbox/postmark/inbound_emails(.:format) action_mailbox/ingresses/postmark/inbound_emails#create
@@ -199,7 +199,7 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
199199
end
200200

201201
# rubocop:disable Layout/TrailingWhitespace
202-
assert_match <<~MESSAGE, output
202+
assert_equal <<~MESSAGE, output
203203
--[ Route 1 ]--------------
204204
Prefix | cart
205205
Verb | GET

0 commit comments

Comments
 (0)