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

Make with_deleted work with paranoid join records #339

Merged
merged 9 commits into from
Jul 28, 2024

Conversation

mvz
Copy link
Contributor

@mvz mvz commented Jul 28, 2024

Fixes #337.

  • Document ActsAsParanoid::Associations
  • Declare existing tests as legacy
  • Switch to letting test file names end in _test
  • Set up integration test for associations with minitest/spec
  • Add specs describing the current behavior with paranoid join records
  • Make with_deleted include deleted join table records with has_many through:
  • Extract common code in integration tests
  • Make stubbed ActiveRecord class definition more compact
  • Regenerate RuboCop to-do file

mvz added 3 commits July 27, 2024 17:36
The existing tests are not structured very logically, and the
combination of using method names to indicate what is being tested, and
having loads of assertions per test, makes it difficult to see what each
test aims to demonstrate.

Future tests will use minitest/spec so tests can be grouped within test
files and described clearly.
This is the more customary naming, it distinguishes the tests more
clearly from the test helper, and matches the naming of the test
classes.
@mvz mvz force-pushed the issue-337-has-many-through-paranoid branch from ca974fa to 524924a Compare July 28, 2024 07:52
mvz added 6 commits July 28, 2024 14:11
This uses minitest-stub-const to avoid having to create multiple sets of
ActiveRecord classes to test with.
Paranoid join records are currently not included in the scope for a
many-to-many association using has_many through:.
- Use minitest-around to set up the const stubbing only once in an
  around block
- Group preparatory record creation into a before block
- Inline the author.reload call
@mvz mvz force-pushed the issue-337-has-many-through-paranoid branch from 524924a to f7e44a0 Compare July 28, 2024 12:11
@mvz mvz merged commit 1b5daf9 into master Jul 28, 2024
15 checks passed
@mvz mvz deleted the issue-337-has-many-through-paranoid branch July 28, 2024 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paranoid join tables in through relationships do not work with with_deleted
1 participant