A platform for community discussion. Free, open, simple.
# frozen_string_literal: true
RSpec.describe ProblemCheck::UpcomingChangeStableOptedOut do
subject(:check) { described_class.new(target) }
describe ".call" do
let(:target) { "enable_upload_debug_mode" }
before do
mock_upcoming_change_metadata(
{
enable_upload_debug_mode: {
impact: "other,developers",
status: :stable,
impact_type: "feature",
impact_role: "admins",
},
},
)
end
context "when upcoming change is enabled (opted in)" do
before { SiteSetting.enable_upload_debug_mode = true }
it { expect(check).to be_chill_about_it }
end
context "when upcoming change is stable and not opted in" do
before { SiteSetting.enable_upload_debug_mode = false }
it do
expect(check).to have_a_problem.with_priority("low").with_target("enable_upload_debug_mode")
end
end
context "when upcoming change is not yet stable and not opted in" do
before do
mock_upcoming_change_metadata(
{
enable_upload_debug_mode: {
impact: "other,developers",
status: :alpha,
impact_type: "other",
impact_role: "developers",
},
},
)
end
it { expect(check).to be_chill_about_it }
end
context "when upcoming change is not enabled and should not be displayed for the site" do
before do
mock_upcoming_change_metadata(
{
enable_upload_debug_mode: {
impact: "other,developers",
status: :stable,
impact_type: "feature",
impact_role: "admins",
},
},
)
UpcomingChanges::ConditionalDisplay
.expects(:should_display_enable_upload_debug_mode?)
.at_least_once
.returns(false)
SiteSetting.enable_upload_debug_mode = false
end
it { expect(check).to be_chill_about_it }
end
end
end