Skip to content

Commit

Permalink
Added tests to make sure inverse associations are updated after `dele…
Browse files Browse the repository at this point in the history
…te` and `destroy`
  • Loading branch information
joelvh committed May 19, 2017
1 parent d8ed749 commit 757d091
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ class ProjectMember < ActiveRecord::Base
group.users.delete(user)
group.widgets.destroy(widget)

expect(user.groups).to_not include(group)
expect(widget.groups).to_not include(group)

expect(group.widgets).to_not include(widget)
expect(group.users).to_not include(user)

Expand All @@ -234,6 +237,9 @@ class ProjectMember < ActiveRecord::Base
user.groups.delete(group)
widget.groups.destroy(group)

expect(group.users).to_not include(user)
expect(group.widgets).to_not include(widget)

expect(group.widgets).to_not include(widget)
expect(group.users).to_not include(user)

Expand Down

0 comments on commit 757d091

Please sign in to comment.