-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor supported permissions method
The `sorted_supported_permissions_grantable_from_ui` method was getting a little complex, with a lot of conditional logic. This separates out the sorting and filtering, with the former the responsibility of the `SupportedPermission` model, and the latter remaining the responsibility of the `Doorkeeper::Application` model based on the passed in arguments In the `Doorkeeper::Application` tests, we're using [Mocha's with][1] with a block using [Minitest's assert_same_elements][2] to check that the array argument contains the same elements regardless of order Mocha does have various [ParameterMatchers][3], which can be used with `with`, but unfortunately not an equivalent of `assert_same_elements` or something like [Jest's expect.arrayContaining][4] [1]: https://mocha.jamesmead.org/Mocha/Expectation.html#with-instance_method [2]: https://www.rubydoc.info/gems/minitest-rails-shoulda/0.4.1/MiniTest%2FAssertions:assert_same_elements [3]: https://mocha.jamesmead.org/Mocha/ParameterMatchers.html [4]: https://jestjs.io/docs/expect#expectarraycontainingarray Co-authored-by: Ynda Jas <[email protected]>
- Loading branch information
Showing
4 changed files
with
86 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters