discourse/spec/lib/topic_localization_destroyer_spec.rb
Natalie Tay fe30ffa3f9
DEV: Remove 'experimental' prefix from settings (#33233)
This PR takes the localization features out of "experimental" to prep
for the announcement
- rename settings and gives them its own area
- `experimental_content_localization` to `content_localization_enabled`
- `experimental_content_localization_allowed_groups` to
`content_localization_allowed_groups`
- `experimental_content_localization_supported_locales` to
`content_localization_supported_locales`
- `experimental_anon_language_switcher` to
`content_localization_anon_language_switcher`
- migration
- related to https://github.com/discourse/discourse-ai/pull/1439

| screenshot 📸 |
|---|
| <img width="964" alt="Screenshot 2025-06-17 at 5 06 32 PM"
src="https://github.com/user-attachments/assets/9a8b2c38-c846-4fc9-8ddd-815c45cc3d0e"
/> |
2025-06-19 12:23:42 +08:00

29 lines
877 B
Ruby

# frozen_string_literal: true
describe TopicLocalizationDestroyer do
fab!(:user)
fab!(:group)
fab!(:topic)
fab!(:localization) { Fabricate(:topic_localization, topic:, locale: "ja") }
let(:locale) { "ja" }
before do
SiteSetting.content_localization_enabled = true
SiteSetting.content_localization_allowed_groups = group.id.to_s
group.add(user)
end
it "deletes the localization" do
expect {
described_class.destroy(topic_id: topic.id, locale: locale, acting_user: user)
}.to change { TopicLocalization.count }.by(-1)
expect { TopicLocalization.find(localization.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
it "raises not found if the localization is missing" do
expect {
described_class.destroy(topic_id: topic.id, locale: "nope", acting_user: user)
}.to raise_error(Discourse::NotFound)
end
end