Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit bd57191

Browse files
committed
Fix tests
1 parent dd3c3ea commit bd57191

File tree

6 files changed

+12
-1
lines changed

6 files changed

+12
-1
lines changed

spec/lib/modules/toxicity/jobs/regular/toxicity_classify_chat_message_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
before do
88
SiteSetting.ai_toxicity_enabled = true
99
SiteSetting.ai_toxicity_flag_automatically = true
10+
SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com"
1011
end
1112

1213
fab!(:chat_message)

spec/lib/modules/toxicity/jobs/regular/toxicity_classify_post_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
before do
99
SiteSetting.ai_toxicity_enabled = true
1010
SiteSetting.ai_toxicity_flag_automatically = true
11+
SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com"
1112
end
1213

1314
fab!(:post)

spec/lib/modules/toxicity/toxicity_classification_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
describe DiscourseAi::Toxicity::ToxicityClassification do
66
fab!(:target) { Fabricate(:post) }
77

8+
before { SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" }
9+
810
describe "#request" do
911
it "returns the classification and the model used for it" do
1012
ToxicityInferenceStubs.stub_post_classification(target, toxic: false)

spec/plugin_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
require_relative "support/toxicity_inference_stubs"
44

55
describe Plugin::Instance do
6-
before { SiteSetting.discourse_ai_enabled = true }
6+
before do
7+
SiteSetting.discourse_ai_enabled = true
8+
SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com"
9+
end
710

811
describe "on reviewable_transitioned_to event" do
912
fab!(:post)

spec/shared/chat_message_classificator_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
let(:model) { DiscourseAi::Toxicity::ToxicityClassification.new }
99
let(:classification) { described_class.new(model) }
1010

11+
before { SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" }
12+
1113
describe "#classify!" do
1214
before { ToxicityInferenceStubs.stub_chat_message_classification(chat_message, toxic: true) }
1315

spec/shared/post_classificator_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
let(:model) { DiscourseAi::Toxicity::ToxicityClassification.new }
99
let(:classification) { described_class.new(model) }
1010

11+
before { SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" }
12+
1113
describe "#classify!" do
1214
before { ToxicityInferenceStubs.stub_post_classification(post, toxic: true) }
1315

0 commit comments

Comments
 (0)