Skip to content

DEV: Rename spec #1344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions spec/tasks/backfill_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@

require_relative "../support/sentiment_inference_stubs"

RSpec.describe "assets:precompile" do
RSpec.describe "ai:sentiment:backfill" do
before do
Rake::Task.clear
Discourse::Application.load_tasks
end

describe "ai:sentiment:backfill" do
before do
SiteSetting.ai_sentiment_model_configs =
"[{\"model_name\":\"SamLowe/roberta-base-go_emotions\",\"endpoint\":\"http://samlowe-emotion.com\",\"api_key\":\"123\"},{\"model_name\":\"j-hartmann/emotion-english-distilroberta-base\",\"endpoint\":\"http://jhartmann-emotion.com\",\"api_key\":\"123\"},{\"model_name\":\"cardiffnlp/twitter-roberta-base-sentiment-latest\",\"endpoint\":\"http://cardiffnlp-sentiment.com\",\"api_key\":\"123\"}]"
end
before do
SiteSetting.ai_sentiment_model_configs =
"[{\"model_name\":\"SamLowe/roberta-base-go_emotions\",\"endpoint\":\"http://samlowe-emotion.com\",\"api_key\":\"123\"},{\"model_name\":\"j-hartmann/emotion-english-distilroberta-base\",\"endpoint\":\"http://jhartmann-emotion.com\",\"api_key\":\"123\"},{\"model_name\":\"cardiffnlp/twitter-roberta-base-sentiment-latest\",\"endpoint\":\"http://cardiffnlp-sentiment.com\",\"api_key\":\"123\"}]"
end

it "does nothing if the topic is soft-deleted" do
target = Fabricate(:post)
SentimentInferenceStubs.stub_classification(target)
target.topic.trash!
it "does nothing if the topic is soft-deleted" do
target = Fabricate(:post)
SentimentInferenceStubs.stub_classification(target)
target.topic.trash!

path = Rake::Task["ai:sentiment:backfill"].invoke
Rake::Task["ai:sentiment:backfill"].invoke

expect(ClassificationResult.count).to be_zero
end
expect(ClassificationResult.count).to be_zero
end
end
Loading