diff --git a/spec/controllers/ajax/question_controller_spec.rb b/spec/controllers/ajax/question_controller_spec.rb index cd3166a4..cbb1a0f1 100644 --- a/spec/controllers/ajax/question_controller_spec.rb +++ b/spec/controllers/ajax/question_controller_spec.rb @@ -328,6 +328,23 @@ describe Ajax::QuestionController, :ajax_controller, type: :controller do include_examples "does not create the question" end end + + context "when users inbox is locked" do + let(:user_allows_anonymous_questions) { true } + let(:expected_response) do + { + "success" => false, + "status" => "inbox_locked", + "message" => anything + } + end + + before do + target_user.update(privacy_lock_inbox: true) + end + + include_examples "does not create the question" + end end context "when rcpt is followers" do diff --git a/spec/workers/question_worker_spec.rb b/spec/workers/question_worker_spec.rb index 94f45a50..6753f619 100644 --- a/spec/workers/question_worker_spec.rb +++ b/spec/workers/question_worker_spec.rb @@ -40,5 +40,16 @@ describe QuestionWorker do .to(4) ) end + + it "respects inbox locks" do + user.followers.first.update(privacy_lock_inbox: true) + + expect { subject } + .to( + change { Inbox.where(user_id: user.followers.ids, question_id: question_id, new: true).count } + .from(0) + .to(4) + ) + end end end