Adds billable and nonbillable trait to member role

What does this MR do and why?

As part of billing changes we frequently require member_roles that are either billable or non-billable. Until now, we had to select a permission that corresponded to billable or non-billable while creating a member_role. Added a trait in member_role factory, that abstracts the selection of billable/non-billable permission by auto selecting the corresponding permission.

This simplifies the need for knowing which permission is billable from a user point of view, and also makes the solution future proof incase we change/remove permissions.

Usage changed from:

let_it_be(:billable_member_role) { create(:member_role, :guest, namespace: nil, read_vulnerability: true) }
let_it_be(:billable_member_role) { create(:member_role, :guest, read_vulnerability: true) }

to

let_it_be(:billable_member_role) { create(:member_role, :instance, :billable) }
let_it_be(:billable_member_role) { create(:member_role, :billable) }

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Suraj Tripathi

Merge request reports

Loading