Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when building unpersisted associations #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/test_associations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ def test_belongs_to_with_deleted
assert_equal paranoid_time, paranoid_has_many_dependant.paranoid_time_with_deleted
end

def test_building_belongs_to_associations
paranoid_has_many_dependant = ParanoidHasManyDependant.new
paranoid_time = ParanoidTime.new(paranoid_has_many_dependants: [paranoid_has_many_dependant])

# This test works
assert_equal paranoid_time.paranoid_has_many_dependants.first.paranoid_time, paranoid_time

# The following tests all fail
assert_equal paranoid_time.paranoid_has_many_dependants.first.paranoid_time_with_scope, paranoid_time
assert_equal paranoid_time.paranoid_has_many_dependants.first.paranoid_time_with_deleted, paranoid_time
assert_equal paranoid_time.paranoid_has_many_dependants.first.paranoid_time_with_scope_with_deleted, paranoid_time
assert_equal paranoid_time.paranoid_has_many_dependants.first.paranoid_time_polymorphic_with_deleted, paranoid_time
assert_equal paranoid_time.paranoid_has_many_dependants.first.paranoid_belongs_dependant, paranoid_time
end

def test_belongs_to_polymorphic_with_deleted
paranoid_time = ParanoidTime.first
paranoid_has_many_dependant = ParanoidHasManyDependant
Expand Down