Skip to content

Commit

Permalink
Adding unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Dec 20, 2024
1 parent 696eb93 commit 4562546
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/models/relationship_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,19 @@ def teardown
assert Relationship.where(source: a, target: b).exists?
assert !Relationship.where(source: a, target: c).exists?
end

test "should set current user when moving targets to new source" do
t = create_team
u1 = create_user is_admin: true
u2 = create_user is_admin: true
a = create_project_media team: t
b = create_project_media team: t
c = create_project_media team: t
create_relationship source: b, target: c, user: u1
with_current_user_and_team(u2, t) do
create_relationship source: a, target: b
end
r = Relationship.where(source: a, target: c).last
assert_equal u2, r.reload.user
end
end

0 comments on commit 4562546

Please sign in to comment.