Skip to content

Commit a860aef

Browse files
authored
Fix failed tests (#160)
* Fix failed tests * use regexp
1 parent 194184e commit a860aef

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

test/controllers/actual_db_schema/migrations_controller_test.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,8 @@ def down
146146
post :rollback, params: { id: "20130906111513", database: @utils.primary_database }
147147
assert_response :redirect
148148
get :index
149-
message = if ENV["DB_ADAPTER"] == "mysql2"
150-
"An error has occurred, all later migrations canceled:\n\nActiveRecord::IrreversibleMigration"
151-
else
152-
"An error has occurred, this and all later migrations canceled:\n\n" \
153-
"ActiveRecord::IrreversibleMigration"
154-
end
155-
assert_select ".flash", text: message
149+
assert_select ".flash", text: /An error has occurred/
150+
assert_select ".flash", text: /ActiveRecord::IrreversibleMigration/
156151
end
157152

158153
test "POST #rollback changes migration status to down and hide migration with down status" do

test/controllers/actual_db_schema/phantom_migrations_controller_test.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,8 @@ def down
154154
post :rollback, params: { id: "20130906111513", database: @utils.primary_database }
155155
assert_response :redirect
156156
get :index
157-
message = if ENV["DB_ADAPTER"] == "mysql2"
158-
"An error has occurred, all later migrations canceled:\n\nActiveRecord::IrreversibleMigration"
159-
else
160-
"An error has occurred, this and all later migrations canceled:\n\n" \
161-
"ActiveRecord::IrreversibleMigration"
162-
end
163-
assert_select ".flash", text: message
157+
assert_select ".flash", text: /An error has occurred/
158+
assert_select ".flash", text: /ActiveRecord::IrreversibleMigration/
164159
end
165160

166161
test "POST #rollback_all changes all phantom migrations status to down and hide migration with down status" do

0 commit comments

Comments
 (0)