discourse/plugins/discourse-assign/spec/models/reviewable_spec.rb
Jarek Radosz 71834c898f
DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00

31 lines
777 B
Ruby

# frozen_string_literal: true
describe Reviewable do
fab!(:user)
fab!(:admin)
fab!(:post1, :post)
fab!(:post2, :post)
fab!(:reviewable1) { Fabricate(:reviewable_flagged_post, target: post1) }
fab!(:reviewable2) { Fabricate(:reviewable_flagged_post, target: post2) }
before { SiteSetting.assign_enabled = true }
it "can filter by assigned_to" do
Assignment.create!(
target: post1,
topic_id: post1.topic.id,
assigned_by_user: user,
assigned_to: user,
)
Assignment.create!(
target: post2,
topic_id: post2.topic.id,
assigned_by_user: user,
assigned_to: admin,
)
expect(Reviewable.list_for(admin, additional_filters: { assigned_to: user.username })).to eq(
[reviewable1],
)
end
end