generated from discourse/discourse-plugin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Correctly display errors when parent module needs to be disabled…
… first (#788) * FIX: Correctly display errors when parent module needs to be disabled first * Update spec/configuration/llm_validator_spec.rb Co-authored-by: Penar Musaraj <pmusaraj@gmail.com> --------- Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
- Loading branch information
1 parent
e408cd0
commit ed97827
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe DiscourseAi::Configuration::LlmValidator do | ||
describe "#valid_value?" do | ||
context "when the parent module is enabled and we try to reset the selected model" do | ||
before do | ||
assign_fake_provider_to(:ai_summarization_model) | ||
SiteSetting.ai_summarization_enabled = true | ||
end | ||
|
||
it "returns false and displays an error message" do | ||
validator = described_class.new(name: :ai_summarization_model) | ||
|
||
value = validator.valid_value?("") | ||
|
||
expect(value).to eq(false) | ||
expect(validator.error_message).to include("ai_summarization_enabled") | ||
end | ||
end | ||
end | ||
end |