Skip to content

Commit

Permalink
CV2-3804: delete FeedInvitation when feed deleted (#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy authored Nov 9, 2023
1 parent 77e6ca0 commit d623958
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Feed < ApplicationRecord
has_many :requests
has_many :feed_teams, dependent: :destroy
has_many :teams, through: :feed_teams
has_many :feed_invitations
has_many :feed_invitations, dependent: :destroy
belongs_to :user, optional: true
belongs_to :saved_search, optional: true
belongs_to :team, optional: true
Expand Down
9 changes: 8 additions & 1 deletion test/models/feed_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def setup
CheckSearch.any_instance.unstub(:medias)
end

test "should delete feed teams when feed is deleted" do
test "should delete feed teams and invitation when feed is deleted" do
f = create_feed
f.teams << create_team
ft = create_feed_team team: create_team, feed: f
Expand All @@ -176,5 +176,12 @@ def setup
f.destroy!
end
end
f = create_feed
create_feed_invitation feed: f
assert_difference 'Feed.count', -1 do
assert_difference 'FeedInvitation.count', -1 do
f.destroy!
end
end
end
end

0 comments on commit d623958

Please sign in to comment.