Update relationship use case tests to not take usernaames and include blocking

This commit is contained in:
Karina Kwiatek 2022-06-12 09:34:49 +02:00 committed by Karina Kwiatek
parent ea3bbcef17
commit 7b17a93075
2 changed files with 31 additions and 31 deletions

View File

@ -7,20 +7,8 @@ require "errors"
describe UseCase::Relationship::Create do
shared_examples_for "valid relationship type" do
context "source_user does not exist" do
let(:source_user) { "Schweinsbraten" }
include_examples "raises an error", Errors::UserNotFound
end
context "target_user does not exist" do
let(:target_user) { "peterwitzig" }
include_examples "raises an error", Errors::UserNotFound
end
context "target_user is source_user" do
let(:target_user) { user1.screen_name }
let(:target_user) { user1 }
include_examples "raises an error", Errors::SelfAction
end
@ -62,8 +50,21 @@ describe UseCase::Relationship::Create do
include_examples "valid relationship type"
context "using screen names" do
let(:source_user) { user1.screen_name }
let(:target_user) { user2.screen_name }
let(:source_user) { user1 }
let(:target_user) { user2 }
include_examples "valid relationship type"
end
end
context "type = 'block'" do
let(:type) { "block" }
include_examples "valid relationship type"
context "using screen names" do
let(:source_user) { user1 }
let(:target_user) { user2 }
include_examples "valid relationship type"
end

View File

@ -25,20 +25,6 @@ describe UseCase::Relationship::Destroy do
expect { subject }.to change { Relationship.count }.by(0)
end
end
context "source_user does not exist" do
let(:source_user) { "Schweinsbraten" }
let(:target_user) { user2.screen_name }
include_examples "raises an error", Errors::UserNotFound
end
context "target_user does not exist" do
let(:source_user) { user1.screen_name }
let(:target_user) { "peterwitzig" }
include_examples "raises an error", Errors::UserNotFound
end
end
let(:base_params) do
@ -65,8 +51,21 @@ describe UseCase::Relationship::Destroy do
include_examples "valid relationship type"
context "using screen names" do
let(:source_user) { user1.screen_name }
let(:target_user) { user2.screen_name }
let(:source_user) { user1 }
let(:target_user) { user2 }
include_examples "valid relationship type"
end
end
context "type = 'block'" do
let(:type) { "block" }
include_examples "valid relationship type"
context "using screen names" do
let(:source_user) { user1 }
let(:target_user) { user2 }
include_examples "valid relationship type"
end