mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:01:52 +08:00
0fe9a36e89
The error was: ``` 1) ExtraLocalesController.client_overrides_exist? returns true if there are client-side translation overrides Failure/Error: expect(ExtraLocalesController.client_overrides_exist?).to eq(false) expected: false got: true (compared using ==) Diff: @@ -1 +1 @@ -false +true # ./spec/requests/extra_locales_controller_spec.rb:162:in `block (3 levels) in <main>' # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>' # .gem/ruby/2.7.3/gems/webmock-3.13.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>' ``` Minimal repro: ``` bin/rspec './spec/models/trust_level_and_staff_setting_spec.rb[1:1:1]' './spec/requests/extra_locales_controller_spec.rb[1:3:2]' --tag ~type:multisite --seed 33616 ```
31 lines
905 B
Ruby
31 lines
905 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe TrustLevelAndStaffSetting do
|
|
describe ".values" do
|
|
after do
|
|
I18n.reload!
|
|
end
|
|
|
|
it "returns translated names" do
|
|
TranslationOverride.upsert!(I18n.locale, "js.trust_levels.names.newuser", "New Member")
|
|
TranslationOverride.upsert!(I18n.locale, "trust_levels.admin", "Hero")
|
|
|
|
values = TrustLevelAndStaffSetting.values
|
|
|
|
value = values.find { |v| v[:value] == 0 }
|
|
expect(value).to be_present
|
|
expect(value[:name]).to eq(I18n.t("js.trust_levels.detailed_name", level: 0, name: "New Member"))
|
|
|
|
value = values.find { |v| v[:value] == "admin" }
|
|
expect(value).to be_present
|
|
expect(value[:name]).to eq("Hero")
|
|
|
|
value = values.find { |v| v[:value] == "staff" }
|
|
expect(value).to be_present
|
|
expect(value[:name]).to eq(I18n.t("trust_levels.staff"))
|
|
end
|
|
end
|
|
end
|