discourse/spec/lib/summarization/base_spec.rb
Roman Rizzi f4e7a80600
DEV: Cache summarization strategy results. (#22230)
Updates the interface for implementing summarization strategies and adds a cache layer to summarize topics once.

The cache stores the final summary and each chunk used to build it, which will be useful when we have to extend or rebuild it.
2023-06-27 11:44:34 -03:00

23 lines
709 B
Ruby

# frozen_string_literal: true
describe Summarization::Base do
fab!(:user) { Fabricate(:user) }
fab!(:group) { Fabricate(:group) }
before { group.add(user) }
describe "#can_request_summaries?" do
it "returns true if the user group is present in the custom_summarization_allowed_groups_map setting" do
SiteSetting.custom_summarization_allowed_groups = group.id
expect(subject.can_request_summaries?(user)).to eq(true)
end
it "returns false if the user group is not present in the custom_summarization_allowed_groups_map setting" do
SiteSetting.custom_summarization_allowed_groups = ""
expect(subject.can_request_summaries?(user)).to eq(false)
end
end
end