mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
RSpec setup becomes harder to follow at either extreme: trivial fixture wrappers hide lifecycle and intent, while forcing every named operation inline repeats low-level protocol and configuration details. This change documents and applies a test-setup hierarchy: - use `fab!`, `let`, `let!`, `subject`, and inline `Fabricate` according to lifecycle and role; - use a small example-group method when parameterized behavior gives one spec useful vocabulary; - move helpers into auto-loaded `spec/support` only when they are shared across spec files; - use fabricators and page objects for the data shapes and system-test interfaces they own. Core and plugin support files are loaded centrally by `rails_helper`, so plugin-specific support loaders are unnecessary. The migration specs encountered during the sweep are removed according to repository policy; production migrations are unchanged.
37 lines
1.2 KiB
Ruby
Vendored
37 lines
1.2 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe ProblemCheck::TranslationOverrides do
|
|
subject(:check) { described_class.new }
|
|
|
|
around { |example| allow_missing_translations(&example) }
|
|
|
|
describe ".call" do
|
|
let!(:translation_override) { Fabricate(:translation_override, status: status) }
|
|
|
|
context "when there are outdated translation overrides" do
|
|
let(:status) { "outdated" }
|
|
|
|
it do
|
|
expect(check).to have_a_problem.with_priority("low").with_message(
|
|
"Some of your translation overrides are out of date. Please check your <a href='/admin/customize/site_texts?outdated=true'>text customizations</a>.",
|
|
)
|
|
end
|
|
end
|
|
|
|
context "when there are translation overrides with invalid interpolation keys" do
|
|
let(:status) { "invalid_interpolation_keys" }
|
|
|
|
it do
|
|
expect(check).to have_a_problem.with_priority("low").with_message(
|
|
"Some of your translation overrides are out of date. Please check your <a href='/admin/customize/site_texts?outdated=true'>text customizations</a>.",
|
|
)
|
|
end
|
|
end
|
|
|
|
context "when all translation overrides are fine" do
|
|
let(:status) { "up_to_date" }
|
|
|
|
it { expect(check).to be_chill_about_it }
|
|
end
|
|
end
|
|
end
|