Skip to content

Commit

Permalink
DEV: Add tests to assigns_reminder_assigned_topics_query modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Grubba27 committed Apr 25, 2024
1 parent 65f50cc commit 016ffd5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/lib/pending_assigns_reminder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,29 @@ def assert_reminder_not_created

expect(topic.title).to eq(I18n.t("pending_assigns_reminder.title", pending_assignments: 3))
end

context "with assigns_reminder_assigned_topics_query" do
let(:modifier_block) do
Proc.new do |query|
query.where.not(id: @post1.topic_id)
end
end
it "doesn't remind if topic is solved" do
plugin_instance = Plugin::Instance.new
plugin_instance.register_modifier(
:assigns_reminder_assigned_topics_query,
&modifier_block
)
topics = reminder.send(:assigned_topics, user, order: :asc)
puts topics.inspect
expect(topics).not_to include(@post1.topic)
ensure
DiscoursePluginRegistry.unregister_modifier(
plugin_instance,
:assigns_reminder_assigned_topics_query,
&modifier_block
)
end
end
end
end

0 comments on commit 016ffd5

Please sign in to comment.