From 3b46c2c7e9bed3e8d8cd319422057987945f179a Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Thu, 25 Jan 2024 21:49:15 +0100 Subject: [PATCH] Add spec for disallowed filter combination results --- spec/controllers/inbox_controller_spec.rb | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spec/controllers/inbox_controller_spec.rb b/spec/controllers/inbox_controller_spec.rb index b939c9ac..5b7eae63 100644 --- a/spec/controllers/inbox_controller_spec.rb +++ b/spec/controllers/inbox_controller_spec.rb @@ -254,6 +254,37 @@ describe InboxController, type: :controller do end end end + + context "when passed the anonymous and the author param" do + let!(:other_user) { FactoryBot.create(:user) } + let!(:generic_inbox_entry) do + Inbox.create( + user:, + question: FactoryBot.create( + :question, + user: other_user, + author_is_anonymous: false, + ), + ) + end + + let!(:inbox_entry_fillers) do + # 9 times => 1 entry less than default page size + 9.times.map { Inbox.create(user:, question: FactoryBot.create(:question, author_is_anonymous: true)) } + end + + subject { get :show, params: { anonymous: true, author: "some_name" } } + + include_examples "sets the expected ivars" do + let(:expected_assigns) do + { + inbox: [], + more_data_available: false, + inbox_count: 0, + } + end + end + end end end