23 lines
656 B
Ruby
23 lines
656 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
require "rails_helper"
|
||
|
require_relative "../../../support/sentiment_inference_stubs"
|
||
|
|
||
|
describe DiscourseAI::Sentiment::SentimentClassification do
|
||
|
describe "#request" do
|
||
|
fab!(:target) { Fabricate(:post) }
|
||
|
|
||
|
before { SiteSetting.ai_sentiment_inference_service_api_endpoint = "http://test.com" }
|
||
|
|
||
|
it "returns the classification and the model used for it" do
|
||
|
SentimentInferenceStubs.stub_classification(target)
|
||
|
|
||
|
result = subject.request(target)
|
||
|
|
||
|
subject.available_models.each do |model|
|
||
|
expect(result[model]).to eq(SentimentInferenceStubs.model_response(model))
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|