discourse/spec/models/onebox_locale_site_setting_spec.rb
Gary Pendergast f53c734ba6
FEATURE: Add a onebox_locale site setting. (#30655)
Following on from f369db5ae9, this change adds the ability to choose a custom locale to send to onebox providers.

If this setting is left blank, it will fall back to using default_locale.
2025-01-09 14:11:37 +11:00

18 lines
543 B
Ruby

# frozen_string_literal: true
RSpec.describe OneboxLocaleSiteSetting do
describe ".valid_value?" do
it "returns true for a locale that we have translations for" do
expect(OneboxLocaleSiteSetting.valid_value?("en")).to eq(true)
end
it "returns true for an empty value" do
expect(OneboxLocaleSiteSetting.valid_value?("")).to eq(true)
end
it "returns false for a locale that we do not have translations for" do
expect(OneboxLocaleSiteSetting.valid_value?("swedish-chef")).to eq(false)
end
end
end