Commit 55fa46a
committed
Fix requiring of oauth2
The changes in #83 (which were released in v4.1.0) moved the
`OauthClient` class (which uses the `oauth2` gem) from the Rails
applications into the `rpi_auth` gem. At that point the `oauth2` gem was
made a direct dependency of `rpi_auth` and the direct dependency on
`oauth2` was removed from the Rails applications. I _think_ this meant
that the `oauth2` gem was no longer being required automatically. And,
although individual files in the `oauth2` gem were being required from
individual files in `rpi_auth`, this meant that not all of the files in
`oauth2` were being required. In particular, the `lib/oauth2.rb` file
which defines the top-level `OAuth2` module and the `OAuth2.config`
method were no longer being required. This led to exceptions like this
one [1] in `experience-cs` when
`RpiAuth::OauthClient#refresh_credentials` was called:
NoMethodError: undefined method 'config' for module OAuth2
This commit changes the require statements to just require `oauth2`
which in turn requires all the relevant files [2] in the `oauth2` gem.
The require statement in `spec/rpi_auth/oauth_client_spec.rb` is
unnecessary, because it's automatically loading `RpiAuth::OauthClient`
which in turn loads `oauth2`. This should mean we no longer see
exceptions like the one above.
[1]: https://raspberrypifoundation.sentry.io/issues/6590882516?project=4508953237651456
[2]: https://gitlab.com/oauth-xx/oauth2/-/blob/v2.0.9/lib/oauth2.rb?ref_type=tags#L11-231 parent 19a41f0 commit 55fa46a
File tree
4 files changed
+3
-5
lines changed- lib/rpi_auth
- controllers
- spec
- dummy/spec/requests
- rpi_auth
4 files changed
+3
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
0 commit comments