graphql_devise 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/Appraisals +14 -0
- data/CHANGELOG.md +14 -0
- data/README.md +15 -5
- data/docs/usage/reset_password_flow.md +90 -0
- data/graphql_devise.gemspec +1 -1
- data/lib/graphql_devise/schema_plugin.rb +12 -10
- data/lib/graphql_devise/version.rb +1 -1
- data/spec/graphql/user_queries_spec.rb +118 -0
- data/spec/requests/user_controller_spec.rb +9 -9
- data/spec/support/contexts/schema_test.rb +14 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf545450ef87f507744e5bf493ebc30d94c20da544307ec11657f58d2e685b37
|
4
|
+
data.tar.gz: 7c62c31ef018325ed51516e08a3f5774d5ebe8325340ce57edbee2df9a9e29bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53dfe2bfde5d1e22f7d5d91f03c6336559abe2967208c2a237218d06fc65d4df2c5c3d0bf5d84f097c77fa2d39299defe6318999adddb68b05263c403a418654
|
7
|
+
data.tar.gz: dc0e2a550b3657fc13505db35042febdc32df9770cdfb00524fabb1fdaf09b1d43a0fc6a13ce71160e37aada85e3cef8ff611aaebb4d027efb81ec8013267eba
|
data/.travis.yml
CHANGED
@@ -25,6 +25,7 @@ gemfile:
|
|
25
25
|
- gemfiles/rails5.2_graphql1.9.gemfile
|
26
26
|
- gemfiles/rails5.2_graphql1.10.gemfile
|
27
27
|
- gemfiles/rails5.2_graphql1.11.gemfile
|
28
|
+
- gemfiles/rails5.2_graphql1.12.gemfile
|
28
29
|
|
29
30
|
jobs:
|
30
31
|
include:
|
@@ -52,6 +53,12 @@ jobs:
|
|
52
53
|
rvm: 2.6.6
|
53
54
|
- gemfile: gemfiles/rails6.0_graphql1.11.gemfile
|
54
55
|
rvm: 2.7.1
|
56
|
+
- gemfile: gemfiles/rails6.0_graphql1.12.gemfile
|
57
|
+
rvm: 2.5.8
|
58
|
+
- gemfile: gemfiles/rails6.0_graphql1.12.gemfile
|
59
|
+
rvm: 2.6.6
|
60
|
+
- gemfile: gemfiles/rails6.0_graphql1.12.gemfile
|
61
|
+
rvm: 2.7.1
|
55
62
|
- gemfile: gemfiles/rails6.0_graphql_edge.gemfile
|
56
63
|
rvm: 2.6.6
|
57
64
|
env:
|
data/Appraisals
CHANGED
@@ -68,6 +68,13 @@ appraise 'rails5.2-graphql1.11' do
|
|
68
68
|
gem 'rspec-rails', '< 4.0'
|
69
69
|
end
|
70
70
|
|
71
|
+
appraise 'rails5.2-graphql1.12' do
|
72
|
+
gem 'sqlite3', '~> 1.3.6'
|
73
|
+
gem 'rails', github: 'rails/rails', branch: '5-2-stable'
|
74
|
+
gem 'graphql', '~> 1.12.0'
|
75
|
+
gem 'rspec-rails', '< 4.0'
|
76
|
+
end
|
77
|
+
|
71
78
|
appraise 'rails6.0-graphql1.8' do
|
72
79
|
gem 'sqlite3', '~> 1.4'
|
73
80
|
gem 'devise', '>= 4.7'
|
@@ -96,6 +103,13 @@ appraise 'rails6.0-graphql1.11' do
|
|
96
103
|
gem 'graphql', '~> 1.11.0'
|
97
104
|
end
|
98
105
|
|
106
|
+
appraise 'rails6.0-graphql1.12' do
|
107
|
+
gem 'sqlite3', '~> 1.4'
|
108
|
+
gem 'devise', '>= 4.7'
|
109
|
+
gem 'rails', github: 'rails/rails', branch: '6-0-stable'
|
110
|
+
gem 'graphql', '~> 1.12.0'
|
111
|
+
end
|
112
|
+
|
99
113
|
appraise 'rails6.0-graphql_edge' do
|
100
114
|
gem 'sqlite3', '~> 1.4'
|
101
115
|
gem 'devise_token_auth', github: 'lynndylanhurley/devise_token_auth', branch: 'master'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.14.1](https://github.com/graphql-devise/graphql_devise/tree/v0.14.1) (2021-02-11)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.14.0...v0.14.1)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Testing Authenticated Elements [\#138](https://github.com/graphql-devise/graphql_devise/issues/138)
|
10
|
+
- Add support for GraphQL 1.12 [\#150](https://github.com/graphql-devise/graphql_devise/pull/150) ([mengqing](https://github.com/mengqing))
|
11
|
+
- Allow setting current resource in tests [\#149](https://github.com/graphql-devise/graphql_devise/pull/149) ([00dav00](https://github.com/00dav00))
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- Document password reset flows [\#147](https://github.com/graphql-devise/graphql_devise/pull/147) ([mcelicalderon](https://github.com/mcelicalderon))
|
16
|
+
|
3
17
|
## [v0.14.0](https://github.com/graphql-devise/graphql_devise/tree/v0.14.0) (2021-01-19)
|
4
18
|
|
5
19
|
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.13.6...v0.14.0)
|
data/README.md
CHANGED
@@ -33,6 +33,7 @@ GraphQL interface on top of the [Devise Token Auth](https://github.com/lynndylan
|
|
33
33
|
* [Making Requests](#making-requests)
|
34
34
|
* [Mutations](#mutations)
|
35
35
|
* [Queries](#queries)
|
36
|
+
* [Reset Password Flow](#reset-password-flow)
|
36
37
|
* [More Configuration Options](#more-configuration-options)
|
37
38
|
* [Devise Token Auth Initializer](#devise-token-auth-initializer)
|
38
39
|
* [Devise Initializer](#devise-initializer)
|
@@ -42,7 +43,7 @@ GraphQL interface on top of the [Devise Token Auth](https://github.com/lynndylan
|
|
42
43
|
* [Contributing](#contributing)
|
43
44
|
* [License](#license)
|
44
45
|
|
45
|
-
<!-- Added by:
|
46
|
+
<!-- Added by: mcelicalderon, at: Mon Jan 25 22:48:17 -05 2021 -->
|
46
47
|
|
47
48
|
<!--te-->
|
48
49
|
|
@@ -288,10 +289,12 @@ The following is a list of the symbols you can provide to the `operations`, `ski
|
|
288
289
|
:login
|
289
290
|
:logout
|
290
291
|
:sign_up
|
291
|
-
:update_password
|
292
|
-
:send_password_reset
|
293
292
|
:confirm_account
|
293
|
+
:send_password_reset
|
294
294
|
:check_password_token
|
295
|
+
:update_password
|
296
|
+
:send_password_reset_with_token
|
297
|
+
:update_password_with_token
|
295
298
|
```
|
296
299
|
|
297
300
|
### Configuring Model
|
@@ -458,9 +461,11 @@ Operation | Description | Example
|
|
458
461
|
login | This mutation has a second field by default. `credentials` can be fetched directly on the mutation return type.<br>Credentials are still returned in the headers of the response. | userLogin(email: String!, password: String!): UserLoginPayload
|
459
462
|
logout | | userLogout: UserLogoutPayload
|
460
463
|
signUp | The parameter `confirmSuccessUrl` is optional unless you are using the `confirmable` plugin from Devise in your `resource`'s model. If you have `confirmable` set up, you will have to provide it unless you have `config.default_confirm_success_url` set in `config/initializers/devise_token_auth.rb`. | userSignUp(email: String!, password: String!, passwordConfirmation: String!, confirmSuccessUrl: String): UserSignUpPayload
|
461
|
-
|
462
|
-
|
464
|
+
sendPasswordResetWithToken | Sends an email to the provided address with a link to reset the password of the resource. First step of the most recently implemented password reset flow. | userSendPasswordResetWithToken(email: String!, redirectUrl: String!): UserSendPasswordResetWithTokenPayload
|
465
|
+
updatePasswordWithToken | Uses a `resetPasswordToken` to update the password of a resource. Second and last step of the most recently implemented password reset flow. | userSendPasswordResetWithToken(resetPasswordToken: String!, password: String!, passwordConfirmation: String!): UserUpdatePasswordWithTokenPayload
|
463
466
|
resendConfirmation | The `UserResendConfirmationPayload` will return the `authenticatable` resource that was sent the confirmation instructions but also has a `message: String!` that can be used to notify a user what to do after the instructions were sent to them | userResendConfirmation(email: String!, redirectUrl: String!): UserResendConfirmationPayload
|
467
|
+
sendResetPassword | Sends an email to the provided address with a link to reset the password of the resource. **This mutation is part of the first and soon to be deprecated password reset flow.** | userSendResetPassword(email: String!, redirectUrl: String!): UserSendReserPasswordPayload
|
468
|
+
updatePassword | The parameter `currentPassword` is optional if you have `config.check_current_password_before_update` set to false (disabled by default) on your generated `config/initializers/devise_token_aut.rb` or if the `resource` model supports the `recoverable` Devise plugin and the `resource`'s `allow_password_change` attribute is set to true (this is done in the `userCheckPasswordToken` query when you click on the sent email's link). **This mutation is part of the first and soon to be deprecated password reset flow.** | userUpdatePassword(password: String!, passwordConfirmation: String!, currentPassword: String): UserUpdatePasswordPayload
|
464
469
|
|
465
470
|
#### Queries
|
466
471
|
Operation | Description | Example
|
@@ -478,6 +483,11 @@ you can use [our specs](spec/requests) to better understand how to use the gem.
|
|
478
483
|
Also, the [dummy app](spec/dummy) used in our specs will give you
|
479
484
|
a clear idea on how to configure the gem on your Rails application.
|
480
485
|
|
486
|
+
### Reset Password Flow
|
487
|
+
This gem supports two password recovery flows. The most recently implemented is preferred and
|
488
|
+
requires less steps. More detail on how it works can be found
|
489
|
+
[here](docs/usage/reset_password_flow.md).
|
490
|
+
|
481
491
|
### More Configuration Options
|
482
492
|
As mentioned in the introduction there are many configurations that will change how this gem behaves. You can change
|
483
493
|
this values on the initializer files generated by the installer.
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# Reset Password Flow
|
2
|
+
This gem supports two different ways to reset a password on a resource. Each password reset flow has it's own set of
|
3
|
+
operations and this document will explain in more detail how to use each.
|
4
|
+
The first and most recently implemented flow is preferred as it requires less steps and doesn't require a mutation
|
5
|
+
to return a redirect on the response. Flow 2 might be deprecated in the future.
|
6
|
+
|
7
|
+
## Flow #1 (Preferred)
|
8
|
+
This flow only has two steps. Each step name refers to the operation name you can use in the mount options to skip or override.
|
9
|
+
|
10
|
+
### 1. send_password_reset_with_token
|
11
|
+
This mutation will send an email to the specified address if it's found on the system. Returns an error if the email is not found. Here's an example assuming the resource used
|
12
|
+
for authentication is `User`:
|
13
|
+
```graphql
|
14
|
+
mutation {
|
15
|
+
userSendPasswordResetWithToken(
|
16
|
+
email: "vvega@wallaceinc.com",
|
17
|
+
redirectUrl: "https://google.com"
|
18
|
+
) {
|
19
|
+
message
|
20
|
+
}
|
21
|
+
}
|
22
|
+
```
|
23
|
+
The email will contain a link to the `redirectUrl` (https://google.com in the example) and append a `reset_password_token` query param. This is the token you will
|
24
|
+
need to use in the next step in order to reset the password.
|
25
|
+
|
26
|
+
### 2. update_password_with_token
|
27
|
+
This mutation uses the token sent on the email to find the resource you are trying to recover.
|
28
|
+
All you have to do is send a valid token together with the new password and password confirmation.
|
29
|
+
Here's an example assuming the resource used for authentication is `User`:
|
30
|
+
|
31
|
+
```graphql
|
32
|
+
mutation {
|
33
|
+
userUpdatePasswordWithToken(
|
34
|
+
resetPasswordToken: "token_here",
|
35
|
+
password: "password123",
|
36
|
+
passwordConfirmation: "password123"
|
37
|
+
) {
|
38
|
+
authenticatable { email }
|
39
|
+
credentials { accessToken }
|
40
|
+
}
|
41
|
+
}
|
42
|
+
```
|
43
|
+
The mutation has two fields:
|
44
|
+
1. `authenticatable`: Just like other mutations, returns the actual resource you just recover the password for.
|
45
|
+
1. `credentials`: This is a nullable field. It will only return credentials as if you had just logged
|
46
|
+
in into the app if you explicitly say so by overriding the mutation. The docs have more detail
|
47
|
+
on how to extend the default behavior of mutations, but
|
48
|
+
[here](https://github.com/graphql-devise/graphql_devise/blob/8c7c8a5ff1b35fb026e4c9499c70dc5f90b9187a/spec/dummy/app/graphql/mutations/reset_admin_password_with_token.rb)
|
49
|
+
you can find an example mutation on what needs to be done in order for the mutation to return
|
50
|
+
credentials after updating the password.
|
51
|
+
|
52
|
+
## Flow 2 (Deprecated)
|
53
|
+
This was the first flow to be implemented, requires an additional step and also to encode a GQL query in a url, so this is not the preferred method.
|
54
|
+
Each step name refers to the operation name you can use in the mount options to skip or override.
|
55
|
+
|
56
|
+
### 1. send_password_reset
|
57
|
+
This mutation will send an email to the specified address if it's found on the system. Returns an error if the email is not found. Here's an example assuming the resource used
|
58
|
+
for authentication is `User`:
|
59
|
+
```graphql
|
60
|
+
mutation {
|
61
|
+
userSendPasswordReset(
|
62
|
+
email: "vvega@wallaceinc.com",
|
63
|
+
redirectUrl: "https://google.com"
|
64
|
+
) {
|
65
|
+
message
|
66
|
+
}
|
67
|
+
}
|
68
|
+
```
|
69
|
+
The email will contain an encoded GraphQL query that holds the reset token and redirectUrl.
|
70
|
+
The query is described in the next step.
|
71
|
+
|
72
|
+
### 2. check_password_token
|
73
|
+
This query checks the reset password token and if successful changes a column in the DB (`allow_password_change`) to true.
|
74
|
+
This change will allow for the next step to update the password without providing the current password.
|
75
|
+
Then, this query will redirect to the provided `redirectUrl` with credentials.
|
76
|
+
|
77
|
+
### 3. update_password
|
78
|
+
This step requires the request to include authentication headers and will allow the user to
|
79
|
+
update the password if step 2 was successful.
|
80
|
+
Here's an example assuming the resource used for authentication is `User`:
|
81
|
+
```graphql
|
82
|
+
mutation {
|
83
|
+
userUpdatePassword(
|
84
|
+
password: "password123",
|
85
|
+
passwordConfirmation: "password123"
|
86
|
+
) {
|
87
|
+
authenticatable { email }
|
88
|
+
}
|
89
|
+
}
|
90
|
+
```
|
data/graphql_devise.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.required_ruby_version = '>= 2.2.0'
|
29
29
|
|
30
30
|
spec.add_dependency 'devise_token_auth', '>= 0.1.43', '< 2.0'
|
31
|
-
spec.add_dependency 'graphql', '>= 1.8', '< 1.
|
31
|
+
spec.add_dependency 'graphql', '>= 1.8', '< 1.13.0'
|
32
32
|
spec.add_dependency 'rails', '>= 4.2', '< 6.2'
|
33
33
|
|
34
34
|
spec.add_development_dependency 'appraisal'
|
@@ -24,13 +24,12 @@ module GraphqlDevise
|
|
24
24
|
# Authenticate only root level queries
|
25
25
|
return yield unless event == 'execute_field' && path(trace_data).count == 1
|
26
26
|
|
27
|
-
field
|
28
|
-
|
29
|
-
context
|
27
|
+
field = traced_field(trace_data)
|
28
|
+
auth_required = authenticate_option(field, trace_data)
|
29
|
+
context = context_from_data(trace_data)
|
30
30
|
|
31
|
-
if
|
32
|
-
|
33
|
-
elsif @authenticate_default
|
31
|
+
if auth_required
|
32
|
+
context = set_current_resource(context)
|
34
33
|
raise_on_missing_resource(context, field)
|
35
34
|
end
|
36
35
|
|
@@ -40,9 +39,10 @@ module GraphqlDevise
|
|
40
39
|
private
|
41
40
|
|
42
41
|
def set_current_resource(context)
|
43
|
-
controller
|
44
|
-
resource_names
|
45
|
-
|
42
|
+
controller = context[:controller]
|
43
|
+
resource_names = Array(context[:resource_name])
|
44
|
+
|
45
|
+
context[:current_resource] ||= resource_names.find do |resource_name|
|
46
46
|
unless Devise.mappings.key?(resource_name)
|
47
47
|
raise(
|
48
48
|
GraphqlDevise::Error,
|
@@ -88,11 +88,13 @@ module GraphqlDevise
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def authenticate_option(field, trace_data)
|
91
|
-
if trace_data[:context]
|
91
|
+
auth_required = if trace_data[:context]
|
92
92
|
field.metadata[:authenticate]
|
93
93
|
else
|
94
94
|
field.graphql_definition.metadata[:authenticate]
|
95
95
|
end
|
96
|
+
|
97
|
+
auth_required.nil? ? @authenticate_default : auth_required
|
96
98
|
end
|
97
99
|
|
98
100
|
def reconfigure_warden!
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.describe 'Users controller specs' do
|
6
|
+
include_context 'with graphql schema test'
|
7
|
+
|
8
|
+
let(:schema) { DummySchema }
|
9
|
+
let(:user) { create(:user, :confirmed) }
|
10
|
+
let(:field) { 'privateField' }
|
11
|
+
let(:public_message) { 'Field does not require authentication' }
|
12
|
+
let(:private_message) { 'Field will always require authentication' }
|
13
|
+
let(:private_error) do
|
14
|
+
{
|
15
|
+
message: "#{field} field requires authentication",
|
16
|
+
extensions: { code: 'AUTHENTICATION_ERROR' }
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'publicField' do
|
21
|
+
let(:query) do
|
22
|
+
<<-GRAPHQL
|
23
|
+
query {
|
24
|
+
publicField
|
25
|
+
}
|
26
|
+
GRAPHQL
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when using a regular schema' do
|
30
|
+
it 'does not require authentication' do
|
31
|
+
expect(response[:data][:publicField]).to eq(public_message)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'privateField' do
|
37
|
+
let(:query) do
|
38
|
+
<<-GRAPHQL
|
39
|
+
query {
|
40
|
+
privateField
|
41
|
+
}
|
42
|
+
GRAPHQL
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when using a regular schema' do
|
46
|
+
context 'when user is authenticated' do
|
47
|
+
let(:resource) { user }
|
48
|
+
|
49
|
+
it 'allows to perform the query' do
|
50
|
+
expect(response[:data][:privateField]).to eq(private_message)
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when using a SchemaUser' do
|
54
|
+
let(:resource) { create(:schema_user, :confirmed) }
|
55
|
+
|
56
|
+
it 'allows to perform the query' do
|
57
|
+
expect(response[:data][:privateField]).to eq(private_message)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when using an interpreter schema' do
|
64
|
+
let(:schema) { InterpreterSchema }
|
65
|
+
|
66
|
+
context 'when user is authenticated' do
|
67
|
+
let(:resource) { user }
|
68
|
+
|
69
|
+
it 'allows to perform the query' do
|
70
|
+
expect(response[:data][:privateField]).to eq(private_message)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'user' do
|
77
|
+
let(:user_data) { { email: user.email, id: user.id } }
|
78
|
+
let(:query) do
|
79
|
+
<<-GRAPHQL
|
80
|
+
query {
|
81
|
+
user(id: #{user.id}) {
|
82
|
+
id
|
83
|
+
email
|
84
|
+
}
|
85
|
+
}
|
86
|
+
GRAPHQL
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when using a regular schema' do
|
90
|
+
context 'when user is authenticated' do
|
91
|
+
let(:resource) { user }
|
92
|
+
|
93
|
+
it 'allows to perform the query' do
|
94
|
+
expect(response[:data][:user]).to match(**user_data)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when using an interpreter schema' do
|
100
|
+
let(:schema) { InterpreterSchema }
|
101
|
+
|
102
|
+
context 'when user is authenticated' do
|
103
|
+
let(:resource) { user }
|
104
|
+
|
105
|
+
it 'allows to perform the query' do
|
106
|
+
expect(response[:data][:user]).to match(**user_data)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'when user is not authenticated' do
|
111
|
+
# Interpreter schema fields are public unless specified otherwise (plugin setting)
|
112
|
+
it 'allows to perform the query' do
|
113
|
+
expect(response[:data][:user]).to match(**user_data)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -31,15 +31,6 @@ RSpec.describe "Integrations with the user's controller" do
|
|
31
31
|
expect(json_response[:data][:publicField]).to eq('Field does not require authentication')
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
35
|
-
context 'when using the failing route' do
|
36
|
-
it 'raises an invalid resource_name error' do
|
37
|
-
expect { post_request('/api/v1/failing') }.to raise_error(
|
38
|
-
GraphqlDevise::Error,
|
39
|
-
'Invalid resource_name `fail` provided to `graphql_context`. Possible values are: [:user, :admin, :guest, :users_customer, :schema_user].'
|
40
|
-
)
|
41
|
-
end
|
42
|
-
end
|
43
34
|
end
|
44
35
|
|
45
36
|
describe 'privateField' do
|
@@ -77,6 +68,15 @@ RSpec.describe "Integrations with the user's controller" do
|
|
77
68
|
)
|
78
69
|
end
|
79
70
|
end
|
71
|
+
|
72
|
+
context 'when using the failing route' do
|
73
|
+
it 'raises an invalid resource_name error' do
|
74
|
+
expect { post_request('/api/v1/failing') }.to raise_error(
|
75
|
+
GraphqlDevise::Error,
|
76
|
+
'Invalid resource_name `fail` provided to `graphql_context`. Possible values are: [:user, :admin, :guest, :users_customer, :schema_user].'
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
80
|
end
|
81
81
|
|
82
82
|
context 'when using an interpreter schema' do
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.shared_context 'with graphql schema test' do
|
4
|
+
let(:variables) { {} }
|
5
|
+
let(:resource_names) { [:user] }
|
6
|
+
let(:resource) { nil }
|
7
|
+
let(:controller) { instance_double(GraphqlDevise::GraphqlController) }
|
8
|
+
let(:context) do
|
9
|
+
{ current_resource: resource, controller: controller, resource_name: resource_names }
|
10
|
+
end
|
11
|
+
let(:response) do
|
12
|
+
schema.execute(query, context: context, variables: variables).deep_symbolize_keys
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Celi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise_token_auth
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '1.8'
|
41
41
|
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.
|
43
|
+
version: 1.13.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: '1.8'
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.
|
53
|
+
version: 1.13.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: rails
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -302,6 +302,7 @@ files:
|
|
302
302
|
- bin/setup
|
303
303
|
- config/locales/en.yml
|
304
304
|
- config/routes.rb
|
305
|
+
- docs/usage/reset_password_flow.md
|
305
306
|
- graphql_devise.gemspec
|
306
307
|
- lib/generators/graphql_devise/install_generator.rb
|
307
308
|
- lib/graphql_devise.rb
|
@@ -431,6 +432,7 @@ files:
|
|
431
432
|
- spec/factories/users.rb
|
432
433
|
- spec/factories/users_customers.rb
|
433
434
|
- spec/generators/graphql_devise/install_generator_spec.rb
|
435
|
+
- spec/graphql/user_queries_spec.rb
|
434
436
|
- spec/graphql_devise/model/with_email_updater_spec.rb
|
435
437
|
- spec/graphql_devise_spec.rb
|
436
438
|
- spec/models/user_spec.rb
|
@@ -470,6 +472,7 @@ files:
|
|
470
472
|
- spec/services/schema_plugin_spec.rb
|
471
473
|
- spec/spec_helper.rb
|
472
474
|
- spec/support/contexts/graphql_request.rb
|
475
|
+
- spec/support/contexts/schema_test.rb
|
473
476
|
- spec/support/factory_bot.rb
|
474
477
|
- spec/support/matchers/auth_headers_matcher.rb
|
475
478
|
- spec/support/matchers/not_change_matcher.rb
|
@@ -577,6 +580,7 @@ test_files:
|
|
577
580
|
- spec/factories/users.rb
|
578
581
|
- spec/factories/users_customers.rb
|
579
582
|
- spec/generators/graphql_devise/install_generator_spec.rb
|
583
|
+
- spec/graphql/user_queries_spec.rb
|
580
584
|
- spec/graphql_devise/model/with_email_updater_spec.rb
|
581
585
|
- spec/graphql_devise_spec.rb
|
582
586
|
- spec/models/user_spec.rb
|
@@ -616,6 +620,7 @@ test_files:
|
|
616
620
|
- spec/services/schema_plugin_spec.rb
|
617
621
|
- spec/spec_helper.rb
|
618
622
|
- spec/support/contexts/graphql_request.rb
|
623
|
+
- spec/support/contexts/schema_test.rb
|
619
624
|
- spec/support/factory_bot.rb
|
620
625
|
- spec/support/matchers/auth_headers_matcher.rb
|
621
626
|
- spec/support/matchers/not_change_matcher.rb
|