Add tests for user-tracked anonymous blocks

This commit is contained in:
Andreas Nedbal 2022-12-27 02:29:47 +01:00 committed by Andreas Nedbal
parent 97736a956d
commit 6df07bb377
1 changed files with 15 additions and 0 deletions

View File

@ -99,6 +99,20 @@ describe UseCase::Question::Create do
end
end
shared_examples "filters signed in questions" do
context "user blocks this anonymized user" do
before do
target_user.anonymous_blocks.create!(
identifier: "r4nd0m",
question_id: FactoryBot.create(:question).id,
target_user_id: source_user&.id
)
end
it_behaves_like "creates the question", false
end
end
context "user signed in" do
let!(:source_user) { FactoryBot.create(:user) }
@ -115,6 +129,7 @@ describe UseCase::Question::Create do
context "recipient allows anonymous questions" do
it_behaves_like "filters questions"
it_behaves_like "filters signed in questions"
it_behaves_like "creates the question"
it_behaves_like "validates content"