DEV: Upgrade Rails to 6.1.3.1 (#12688)

Rails 6.1.3.1 deprecates a few API and has some internal changes that break our tests suite, so this commit fixes all the deprecations and errors and now Discourse should be fully compatible with Rails 6.1.3.1. We also have a new release of the rails_failover gem that's compatible with Rails 6.1.3.1.
This commit is contained in:
Osama Sayegh
2021-04-21 12:36:32 +03:00
committed by GitHub
parent 838fa12f14
commit 45ccadeeeb
25 changed files with 116 additions and 95 deletions

View File

@@ -324,6 +324,15 @@ describe Topic do
it "won't allow another topic to be created with the same name in same category" do
expect(new_topic).not_to be_valid
end
it "other errors will not be cleared" do
SiteSetting.min_topic_title_length = 5
topic.update!(title: "more than 5 characters but less than 134")
SiteSetting.min_topic_title_length = 134
new_topic_different_cat.title = "more than 5 characters but less than 134"
expect(new_topic_different_cat).not_to be_valid
expect(new_topic_different_cat.errors[:title]).to include(I18n.t("errors.messages.too_short", count: 134))
end
end
end

View File

@@ -11,7 +11,7 @@ describe UserNotificationSchedule do
user: user,
enabled: true
})
expect(schedule.errors.keys).to eq([
expect(schedule.errors.attribute_names).to eq([
:day_0_start_time,
:day_0_end_time,
:day_1_start_time,

View File

@@ -116,6 +116,7 @@ RSpec.describe Admin::BackupsController do
expect(response.status).to eq(422)
expect(response.headers['Content-Disposition']).not_to match(/attachment; filename/)
expect(response.body).to include(I18n.t("download_backup_mailer.no_token"))
end
end

View File

@@ -40,7 +40,7 @@ describe Admin::EmbeddableHostsController do
history_exists = UserHistory.where(
acting_user_id: admin.id,
action: UserHistory.actions[:embeddable_host_update],
new_value: "host: test.com, class_name: test-class, category_id: #{category.id}").exists?
new_value: "category_id: #{category.id}, class_name: test-class, host: test.com").exists?
expect(history_exists).to eq(true)

View File

@@ -69,7 +69,7 @@ describe Admin::WebHooksController do
expect(response.status).to eq(200)
expect(UserHistory.where(acting_user_id: admin.id,
action: UserHistory.actions[:web_hook_update],
new_value: "payload_url: https://test.com, active: false").exists?).to eq(true)
new_value: "active: false, payload_url: https://test.com").exists?).to eq(true)
end
end

View File

@@ -282,9 +282,7 @@ RSpec.describe ApplicationController do
get "/search/query.json", params: { trem: "misspelled term" }
expect(response.status).to eq(400)
expect(response.parsed_body).to eq(
"errors" => ["param is missing or the value is empty: term"]
)
expect(response.parsed_body["errors"].first).to include("param is missing or the value is empty: term")
end
end