diff --git a/lib/site_settings/deprecated_settings.rb b/lib/site_settings/deprecated_settings.rb index e2b22e2af38..a926a5666c2 100644 --- a/lib/site_settings/deprecated_settings.rb +++ b/lib/site_settings/deprecated_settings.rb @@ -6,7 +6,6 @@ end module SiteSettings::DeprecatedSettings SETTINGS = [ # [, , , ] - ["search_tokenize_chinese_japanese_korean", "search_tokenize_chinese", true, "2.9"], ["default_categories_regular", "default_categories_normal", true, "3.0"], ["anonymous_posting_min_trust_level", "anonymous_posting_allowed_groups", false, "3.3"], ["shared_drafts_min_trust_level", "shared_drafts_allowed_groups", false, "3.3"], diff --git a/spec/fixtures/site_settings/deprecated_test.yml b/spec/fixtures/site_settings/deprecated_test.yml index 5bf6c07b673..47dc19c96f3 100644 --- a/spec/fixtures/site_settings/deprecated_test.yml +++ b/spec/fixtures/site_settings/deprecated_test.yml @@ -8,3 +8,7 @@ category1: default: 2 enum: "TrustLevelAndStaffSetting" hidden: true + old_one: + default: false + new_one: + default: false diff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rb index 873abe21c70..2dce8b2cfec 100644 --- a/spec/lib/search_spec.rb +++ b/spec/lib/search_spec.rb @@ -1098,7 +1098,15 @@ RSpec.describe Search do end it "works in Chinese" do - SiteSetting.search_tokenize_chinese_japanese_korean = true + SiteSetting.search_tokenize_chinese = true + post = new_post("I am not in English 你今天怎麼樣") + + results = Search.execute("你今天", search_context: post.topic) + expect(results.posts.map(&:id)).to eq([post.id]) + end + + it "works in Japanese" do + SiteSetting.search_tokenize_japanese = true post = new_post("I am not in English 何点になると思いますか") results = Search.execute("何点になると思", search_context: post.topic) diff --git a/spec/requests/admin/site_settings_controller_spec.rb b/spec/requests/admin/site_settings_controller_spec.rb index 340d60e64e2..f623f44bef6 100644 --- a/spec/requests/admin/site_settings_controller_spec.rb +++ b/spec/requests/admin/site_settings_controller_spec.rb @@ -238,13 +238,19 @@ RSpec.describe Admin::SiteSettingsController do end it "works for deprecated settings" do - put "/admin/site_settings/search_tokenize_chinese_japanese_korean.json", - params: { - search_tokenize_chinese_japanese_korean: true, - } + deprecated_test = "#{Rails.root}/spec/fixtures/site_settings/deprecated_test.yml" + SiteSetting.load_settings(deprecated_test) - expect(response.status).to eq(200) - expect(SiteSetting.search_tokenize_chinese).to eq(true) + stub_const( + SiteSettings::DeprecatedSettings, + "SETTINGS", + [["old_one", "new_one", true, "3.0"]], + ) do + put "/admin/site_settings/old_one.json", params: { old_one: true } + + expect(response.status).to eq(200) + expect(SiteSetting.new_one).to eq(true) + end end it "throws an error when the parameter is not a configurable site setting" do