mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 14:09:53 +01:00
Add tests for inbox locking
This commit is contained in:
parent
8bdf00e0e8
commit
fdf42d4169
2 changed files with 28 additions and 0 deletions
|
@ -328,6 +328,23 @@ describe Ajax::QuestionController, :ajax_controller, type: :controller do
|
||||||
include_examples "does not create the question"
|
include_examples "does not create the question"
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
context "when rcpt is followers" do
|
context "when rcpt is followers" do
|
||||||
|
|
|
@ -40,5 +40,16 @@ describe QuestionWorker do
|
||||||
.to(4)
|
.to(4)
|
||||||
)
|
)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue