2024-03-06 11:14:53 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-03-06 11:42:20 +08:00
|
|
|
RSpec.describe SiteSetting do
|
2024-03-06 11:14:53 +08:00
|
|
|
let(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }
|
|
|
|
let(:discobot_user) { narrative_bot.discobot_user }
|
|
|
|
|
|
|
|
before { SiteSetting.discourse_narrative_bot_enabled = true }
|
2024-03-06 11:42:20 +08:00
|
|
|
|
2024-03-06 11:14:53 +08:00
|
|
|
it "should update bot's `UserProfile#bio_raw` when `default_locale` site setting is changed" do
|
|
|
|
expect(discobot_user.user_profile.bio_raw).to eq(
|
|
|
|
I18n.with_locale(:en) { I18n.t("discourse_narrative_bot.bio") },
|
|
|
|
)
|
|
|
|
|
2024-03-06 11:42:20 +08:00
|
|
|
SiteSetting.default_locale = "zh_CN"
|
2024-03-06 11:14:53 +08:00
|
|
|
|
2024-03-06 11:42:20 +08:00
|
|
|
expect(discobot_user.user_profile.reload.bio_raw).to eq(
|
2024-03-06 11:14:53 +08:00
|
|
|
I18n.with_locale(:zh_CN) { I18n.t("discourse_narrative_bot.bio") },
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|