Add tests for inbox locking
This commit is contained in:
parent
8bdf00e0e8
commit
fdf42d4169
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue