tests: prove that the block code is properly destroying follow relationships
This commit is contained in:
parent
320ca7b11e
commit
e9ed7eb963
|
@ -359,6 +359,61 @@ test "it unblocks users" do
|
||||||
|
|
||||||
refute User.blocks?(user, blocked_user)
|
refute User.blocks?(user, blocked_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "blocks tear down cyclical follow relationships" do
|
||||||
|
blocker = insert(:user)
|
||||||
|
blocked = insert(:user)
|
||||||
|
|
||||||
|
{:ok, blocker} = User.follow(blocker, blocked)
|
||||||
|
{:ok, blocked} = User.follow(blocked, blocker)
|
||||||
|
|
||||||
|
assert User.following?(blocker, blocked)
|
||||||
|
assert User.following?(blocked, blocker)
|
||||||
|
|
||||||
|
{:ok, blocker} = User.block(blocker, blocked)
|
||||||
|
blocked = Repo.get(User, blocked.id)
|
||||||
|
|
||||||
|
assert User.blocks?(blocker, blocked)
|
||||||
|
|
||||||
|
refute User.following?(blocker, blocked)
|
||||||
|
refute User.following?(blocked, blocker)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "blocks tear down blocker->blocked follow relationships" do
|
||||||
|
blocker = insert(:user)
|
||||||
|
blocked = insert(:user)
|
||||||
|
|
||||||
|
{:ok, blocker} = User.follow(blocker, blocked)
|
||||||
|
|
||||||
|
assert User.following?(blocker, blocked)
|
||||||
|
refute User.following?(blocked, blocker)
|
||||||
|
|
||||||
|
{:ok, blocker} = User.block(blocker, blocked)
|
||||||
|
blocked = Repo.get(User, blocked.id)
|
||||||
|
|
||||||
|
assert User.blocks?(blocker, blocked)
|
||||||
|
|
||||||
|
refute User.following?(blocker, blocked)
|
||||||
|
refute User.following?(blocked, blocker)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "blocks tear down blocked->blocker follow relationships" do
|
||||||
|
blocker = insert(:user)
|
||||||
|
blocked = insert(:user)
|
||||||
|
|
||||||
|
{:ok, blocked} = User.follow(blocked, blocker)
|
||||||
|
|
||||||
|
refute User.following?(blocker, blocked)
|
||||||
|
assert User.following?(blocked, blocker)
|
||||||
|
|
||||||
|
{:ok, blocker} = User.block(blocker, blocked)
|
||||||
|
blocked = Repo.get(User, blocked.id)
|
||||||
|
|
||||||
|
assert User.blocks?(blocker, blocked)
|
||||||
|
|
||||||
|
refute User.following?(blocker, blocked)
|
||||||
|
refute User.following?(blocked, blocker)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "domain blocking" do
|
describe "domain blocking" do
|
||||||
|
|
Loading…
Reference in New Issue