[openstreetmap/openstreetmap-website] Add user transient attribute to oauth factories (PR #5541)

Anton Khorev notifications at github.com
Thu Jan 23 15:13:45 UTC 2025


It's annoying to type
```
create(:oauth_access_token, :resource_owner_id => user.id, ...
```

This PR shortens it to
```
create(:oauth_access_grant, :user => user, ...
```

Doorkeper classes don't have actual associations with our models and looks like this line in `oauth_access_grant` factory never worked
```
resource_owner_id :factory => :user
```
And I also have to tell RuboCop not to enforce these associations.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5541

-- Commit Summary --

  * Add user transient attribute to oauth_access_token factory
  * Add user transient attribute to oauth_access_grant factory

-- File Changes --

    M test/abilities/api_abilities_test.rb (2)
    M test/abilities/api_capability_test.rb (8)
    M test/controllers/oauth2_authorized_applications_controller_test.rb (24)
    M test/factories/oauth_access_grant.rb (7)
    M test/factories/oauth_access_token.rb (6)
    M test/models/user_test.rb (2)
    M test/test_helper.rb (2)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5541.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5541.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5541
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5541 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250123/83beb7eb/attachment.htm>


More information about the rails-dev mailing list