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

Admin policy test coverage #5262

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

martinemde
Copy link
Member

I started a pattern here for testing associations but I'm getting really bored of adding it all 🥱 Maybe we can finish it later. It's very repetitive.

Remove unused code in Api::ApplicationPolicy
@simi
Copy link
Member

simi commented Nov 21, 2024

@martinemde happy to finish the rest later (in additional PR)

@martinemde
Copy link
Member Author

martinemde commented Nov 21, 2024

@simi If it seems useful, we can continue. I noticed that their coverage is "fake" before this (i.e. the method is called so it counts as coverage).

I'm aiming for a shoulda level coverage where we just say "yep, it's defined correctly" but they're all the same 🤷‍♂️

@martinemde martinemde requested a review from simi November 21, 2024 02:22
Copy link
Member Author

@martinemde martinemde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove this part of the code if we think it's too unfinished.

refute_authorizes(user, record, :"view_#{association}?")
end

# TODO: I'm not clear on what `record` is used in show_association?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention here was to use the passed policy to assert that it refers to that policy, but I'm unclear on how that works.

Is it really getting passed the "object" of the association as the record or are we just looking up the same policy as self because it's not a different record? That would imply that record is not a RubyGem in the RubyGemPolicy when we plan on checking show_association?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants