2023-06-13 13:21:46 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe Summarization::Base do
|
2023-06-27 12:18:10 -04:00
|
|
|
subject(:summarization) { described_class.new }
|
|
|
|
|
2023-06-13 13:21:46 -04:00
|
|
|
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
|
|
|
|
|
2023-06-27 12:18:10 -04:00
|
|
|
expect(summarization.can_request_summaries?(user)).to eq(true)
|
2023-06-13 13:21:46 -04:00
|
|
|
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 = ""
|
|
|
|
|
2023-06-27 12:18:10 -04:00
|
|
|
expect(summarization.can_request_summaries?(user)).to eq(false)
|
2023-06-13 13:21:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|