graphql_devise 0.12.1 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -0
  3. data/Appraisals +14 -0
  4. data/CHANGELOG.md +60 -0
  5. data/Gemfile +2 -0
  6. data/README.md +125 -82
  7. data/Rakefile +2 -0
  8. data/app/controllers/graphql_devise/application_controller.rb +2 -0
  9. data/app/controllers/graphql_devise/concerns/set_user_by_token.rb +12 -4
  10. data/app/controllers/graphql_devise/graphql_controller.rb +2 -0
  11. data/app/helpers/graphql_devise/application_helper.rb +2 -0
  12. data/app/helpers/graphql_devise/mailer_helper.rb +2 -0
  13. data/app/models/graphql_devise/concerns/model.rb +10 -0
  14. data/app/views/graphql_devise/mailer/confirmation_instructions.html.erb +1 -1
  15. data/app/views/graphql_devise/mailer/reset_password_instructions.html.erb +1 -1
  16. data/config/routes.rb +2 -0
  17. data/graphql_devise.gemspec +1 -1
  18. data/lib/generators/graphql_devise/install_generator.rb +3 -1
  19. data/lib/graphql_devise.rb +2 -0
  20. data/lib/graphql_devise/concerns/controller_methods.rb +2 -0
  21. data/lib/graphql_devise/default_operations/mutations.rb +2 -0
  22. data/lib/graphql_devise/default_operations/resolvers.rb +2 -0
  23. data/lib/graphql_devise/engine.rb +2 -0
  24. data/lib/graphql_devise/errors/authentication_error.rb +2 -0
  25. data/lib/graphql_devise/errors/detailed_user_error.rb +2 -0
  26. data/lib/graphql_devise/errors/error_codes.rb +2 -0
  27. data/lib/graphql_devise/errors/execution_error.rb +2 -0
  28. data/lib/graphql_devise/errors/user_error.rb +2 -0
  29. data/lib/graphql_devise/model/with_email_updater.rb +74 -0
  30. data/lib/graphql_devise/mount_method/operation_preparer.rb +2 -0
  31. data/lib/graphql_devise/mount_method/operation_preparers/custom_operation_preparer.rb +2 -0
  32. data/lib/graphql_devise/mount_method/operation_preparers/default_operation_preparer.rb +2 -0
  33. data/lib/graphql_devise/mount_method/operation_preparers/gql_name_setter.rb +2 -0
  34. data/lib/graphql_devise/mount_method/operation_preparers/mutation_field_setter.rb +2 -0
  35. data/lib/graphql_devise/mount_method/operation_preparers/resolver_type_setter.rb +2 -0
  36. data/lib/graphql_devise/mount_method/operation_preparers/resource_name_setter.rb +2 -0
  37. data/lib/graphql_devise/mount_method/operation_sanitizer.rb +2 -0
  38. data/lib/graphql_devise/mount_method/option_sanitizer.rb +2 -0
  39. data/lib/graphql_devise/mount_method/option_sanitizers/array_checker.rb +2 -0
  40. data/lib/graphql_devise/mount_method/option_sanitizers/class_checker.rb +2 -0
  41. data/lib/graphql_devise/mount_method/option_sanitizers/hash_checker.rb +2 -0
  42. data/lib/graphql_devise/mount_method/option_sanitizers/string_checker.rb +2 -0
  43. data/lib/graphql_devise/mount_method/option_validators/provided_operations_validator.rb +2 -0
  44. data/lib/graphql_devise/mount_method/option_validators/skip_only_validator.rb +2 -0
  45. data/lib/graphql_devise/mount_method/option_validators/supported_operations_validator.rb +2 -0
  46. data/lib/graphql_devise/mount_method/options_validator.rb +2 -0
  47. data/lib/graphql_devise/mount_method/supported_options.rb +2 -0
  48. data/lib/graphql_devise/mutations/base.rb +2 -0
  49. data/lib/graphql_devise/mutations/login.rb +2 -0
  50. data/lib/graphql_devise/mutations/logout.rb +2 -0
  51. data/lib/graphql_devise/mutations/resend_confirmation.rb +4 -1
  52. data/lib/graphql_devise/mutations/send_password_reset.rb +4 -1
  53. data/lib/graphql_devise/mutations/sign_up.rb +13 -3
  54. data/lib/graphql_devise/mutations/update_password.rb +2 -0
  55. data/lib/graphql_devise/rails/routes.rb +2 -0
  56. data/lib/graphql_devise/resolvers/base.rb +2 -0
  57. data/lib/graphql_devise/resolvers/check_password_token.rb +2 -0
  58. data/lib/graphql_devise/resolvers/confirm_account.rb +7 -2
  59. data/lib/graphql_devise/resolvers/dummy.rb +2 -0
  60. data/lib/graphql_devise/resource_loader.rb +2 -0
  61. data/lib/graphql_devise/schema.rb +2 -0
  62. data/lib/graphql_devise/schema_plugin.rb +30 -3
  63. data/lib/graphql_devise/types/authenticatable_type.rb +2 -0
  64. data/lib/graphql_devise/types/credential_type.rb +2 -0
  65. data/lib/graphql_devise/types/mutation_type.rb +2 -0
  66. data/lib/graphql_devise/types/query_type.rb +2 -0
  67. data/lib/graphql_devise/version.rb +3 -1
  68. data/spec/dummy/Rakefile +2 -0
  69. data/spec/dummy/app/controllers/api/v1/graphql_controller.rb +35 -4
  70. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  71. data/spec/dummy/app/graphql/dummy_schema.rb +14 -2
  72. data/spec/dummy/app/graphql/interpreter_schema.rb +2 -0
  73. data/spec/dummy/app/graphql/mutations/login.rb +2 -0
  74. data/spec/dummy/app/graphql/mutations/register_confirmed_user.rb +2 -0
  75. data/spec/dummy/app/graphql/mutations/sign_up.rb +2 -0
  76. data/spec/dummy/app/graphql/mutations/update_user.rb +22 -0
  77. data/spec/dummy/app/graphql/resolvers/public_user.rb +2 -0
  78. data/spec/dummy/app/graphql/resolvers/user_show.rb +2 -0
  79. data/spec/dummy/app/graphql/types/base_object.rb +2 -0
  80. data/spec/dummy/app/graphql/types/custom_admin_type.rb +2 -0
  81. data/spec/dummy/app/graphql/types/mutation_type.rb +3 -0
  82. data/spec/dummy/app/graphql/types/query_type.rb +2 -0
  83. data/spec/dummy/app/graphql/types/user_type.rb +2 -0
  84. data/spec/dummy/app/jobs/application_job.rb +2 -0
  85. data/spec/dummy/app/mailers/application_mailer.rb +2 -0
  86. data/spec/dummy/app/models/admin.rb +2 -0
  87. data/spec/dummy/app/models/application_record.rb +2 -0
  88. data/spec/dummy/app/models/guest.rb +2 -0
  89. data/spec/dummy/app/models/schema_user.rb +13 -0
  90. data/spec/dummy/app/models/user.rb +2 -0
  91. data/spec/dummy/app/models/users.rb +2 -0
  92. data/spec/dummy/app/models/users/customer.rb +2 -0
  93. data/spec/dummy/config.ru +2 -0
  94. data/spec/dummy/config/application.rb +2 -0
  95. data/spec/dummy/config/environment.rb +2 -0
  96. data/spec/dummy/config/environments/development.rb +2 -0
  97. data/spec/dummy/config/environments/production.rb +2 -0
  98. data/spec/dummy/config/environments/test.rb +2 -0
  99. data/spec/dummy/config/initializers/application_controller_renderer.rb +2 -0
  100. data/spec/dummy/config/initializers/backtrace_silencers.rb +2 -0
  101. data/spec/dummy/config/initializers/cors.rb +2 -0
  102. data/spec/dummy/config/initializers/devise_token_auth.rb +2 -0
  103. data/spec/dummy/config/initializers/filter_parameter_logging.rb +2 -0
  104. data/spec/dummy/config/initializers/i18n.rb +2 -0
  105. data/spec/dummy/config/initializers/inflections.rb +2 -0
  106. data/spec/dummy/config/initializers/mime_types.rb +2 -0
  107. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -0
  108. data/spec/dummy/config/puma.rb +2 -0
  109. data/spec/dummy/config/routes.rb +4 -0
  110. data/spec/dummy/config/spring.rb +2 -0
  111. data/spec/dummy/db/migrate/20190815114303_create_users.rb +2 -0
  112. data/spec/dummy/db/migrate/20190824215150_add_auth_available_to_users.rb +2 -0
  113. data/spec/dummy/db/migrate/20190916012505_create_admins.rb +2 -0
  114. data/spec/dummy/db/migrate/20191013213045_create_guests.rb +2 -0
  115. data/spec/dummy/db/migrate/20200321121807_create_users_customers.rb +2 -0
  116. data/spec/dummy/db/migrate/20200621182414_remove_uncofirmed_email_from_admins.rb +7 -0
  117. data/spec/dummy/db/migrate/20200623003142_create_schema_users.rb +46 -0
  118. data/spec/dummy/db/schema.rb +30 -2
  119. data/spec/dummy/db/seeds.rb +2 -0
  120. data/spec/factories/admins.rb +2 -0
  121. data/spec/factories/guests.rb +2 -0
  122. data/spec/factories/schema_users.rb +13 -0
  123. data/spec/factories/users.rb +2 -0
  124. data/spec/factories/users_customers.rb +2 -0
  125. data/spec/generators/graphql_devise/install_generator_spec.rb +3 -1
  126. data/spec/graphql_devise/model/with_email_updater_spec.rb +131 -0
  127. data/spec/graphql_devise_spec.rb +2 -0
  128. data/spec/models/user_spec.rb +2 -0
  129. data/spec/rails_helper.rb +3 -0
  130. data/spec/requests/graphql_controller_spec.rb +2 -0
  131. data/spec/requests/mutations/additional_mutations_spec.rb +2 -0
  132. data/spec/requests/mutations/additional_queries_spec.rb +2 -0
  133. data/spec/requests/mutations/login_spec.rb +2 -0
  134. data/spec/requests/mutations/logout_spec.rb +2 -0
  135. data/spec/requests/mutations/resend_confirmation_spec.rb +45 -16
  136. data/spec/requests/mutations/send_password_reset_spec.rb +37 -12
  137. data/spec/requests/mutations/sign_up_spec.rb +15 -2
  138. data/spec/requests/mutations/update_password_spec.rb +2 -0
  139. data/spec/requests/queries/check_password_token_spec.rb +2 -0
  140. data/spec/requests/queries/confirm_account_spec.rb +9 -1
  141. data/spec/requests/user_controller_spec.rb +65 -7
  142. data/spec/services/mount_method/operation_preparer_spec.rb +2 -0
  143. data/spec/services/mount_method/operation_preparers/custom_operation_preparer_spec.rb +2 -0
  144. data/spec/services/mount_method/operation_preparers/default_operation_preparer_spec.rb +2 -0
  145. data/spec/services/mount_method/operation_preparers/gql_name_setter_spec.rb +2 -0
  146. data/spec/services/mount_method/operation_preparers/mutation_field_setter_spec.rb +2 -0
  147. data/spec/services/mount_method/operation_preparers/resolver_type_setter_spec.rb +2 -0
  148. data/spec/services/mount_method/operation_preparers/resource_name_setter_spec.rb +2 -0
  149. data/spec/services/mount_method/operation_sanitizer_spec.rb +2 -0
  150. data/spec/services/mount_method/option_sanitizer_spec.rb +2 -0
  151. data/spec/services/mount_method/option_sanitizers/array_checker_spec.rb +2 -0
  152. data/spec/services/mount_method/option_sanitizers/class_checker_spec.rb +2 -0
  153. data/spec/services/mount_method/option_sanitizers/hash_checker_spec.rb +2 -0
  154. data/spec/services/mount_method/option_sanitizers/string_checker_spec.rb +2 -0
  155. data/spec/services/mount_method/option_validators/provided_operations_validator_spec.rb +2 -0
  156. data/spec/services/mount_method/option_validators/skip_only_validator_spec.rb +2 -0
  157. data/spec/services/mount_method/option_validators/supported_operations_validator_spec.rb +2 -0
  158. data/spec/services/mount_method/options_validator_spec.rb +2 -0
  159. data/spec/services/resource_loader_spec.rb +2 -0
  160. data/spec/services/schema_plugin_spec.rb +2 -0
  161. data/spec/spec_helper.rb +2 -0
  162. data/spec/support/contexts/graphql_request.rb +2 -0
  163. data/spec/support/factory_bot.rb +2 -0
  164. data/spec/support/matchers/auth_headers_matcher.rb +2 -0
  165. data/spec/support/matchers/not_change_matcher.rb +2 -0
  166. data/spec/support/requests/auth_helpers.rb +2 -0
  167. data/spec/support/requests/json_helpers.rb +2 -0
  168. metadata +17 -4
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OperationPreparers::ResolverTypeSetter do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OperationPreparers::ResourceNameSetter do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OperationSanitizer do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionSanitizer do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionSanitizers::ArrayChecker do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionSanitizers::ClassChecker do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionSanitizers::HashChecker do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionSanitizers::StringChecker do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionValidators::ProvidedOperationsValidator do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionValidators::SkipOnlyValidator do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionValidators::SupportedOperationsValidator do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::MountMethod::OptionsValidator do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::ResourceLoader do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe GraphqlDevise::SchemaPlugin do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ENV['CI'] && !ENV['SKIP_COVERALLS']
2
4
  require 'simplecov'
3
5
  require 'coveralls'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.shared_context 'with graphql query request' do
2
4
  let(:headers) { {} }
3
5
  let(:variables) { {} }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.include FactoryBot::Syntax::Methods
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Matchers.define :include_auth_headers do
2
4
  match do |response|
3
5
  auth_headers = %w[uid access-token client].map { |key| response.headers[key] }
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec::Matchers.define_negated_matcher :not_change, :change
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Requests
2
4
  module AuthHelpers
3
5
  def auth_headers_for(user)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Requests
2
4
  module JsonHelpers
3
5
  def json_response
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.12.1
4
+ version: 0.13.2
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: 2020-06-12 00:00:00.000000000 Z
12
+ date: 2020-08-12 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.11.0
43
+ version: 1.12.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.11.0
53
+ version: 1.12.0
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: rails
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -314,6 +314,7 @@ files:
314
314
  - lib/graphql_devise/errors/error_codes.rb
315
315
  - lib/graphql_devise/errors/execution_error.rb
316
316
  - lib/graphql_devise/errors/user_error.rb
317
+ - lib/graphql_devise/model/with_email_updater.rb
317
318
  - lib/graphql_devise/mount_method/operation_preparer.rb
318
319
  - lib/graphql_devise/mount_method/operation_preparers/custom_operation_preparer.rb
319
320
  - lib/graphql_devise/mount_method/operation_preparers/default_operation_preparer.rb
@@ -362,6 +363,7 @@ files:
362
363
  - spec/dummy/app/graphql/mutations/login.rb
363
364
  - spec/dummy/app/graphql/mutations/register_confirmed_user.rb
364
365
  - spec/dummy/app/graphql/mutations/sign_up.rb
366
+ - spec/dummy/app/graphql/mutations/update_user.rb
365
367
  - spec/dummy/app/graphql/resolvers/public_user.rb
366
368
  - spec/dummy/app/graphql/resolvers/user_show.rb
367
369
  - spec/dummy/app/graphql/types/base_object.rb
@@ -374,6 +376,7 @@ files:
374
376
  - spec/dummy/app/models/admin.rb
375
377
  - spec/dummy/app/models/application_record.rb
376
378
  - spec/dummy/app/models/guest.rb
379
+ - spec/dummy/app/models/schema_user.rb
377
380
  - spec/dummy/app/models/user.rb
378
381
  - spec/dummy/app/models/users.rb
379
382
  - spec/dummy/app/models/users/customer.rb
@@ -412,14 +415,18 @@ files:
412
415
  - spec/dummy/db/migrate/20190916012505_create_admins.rb
413
416
  - spec/dummy/db/migrate/20191013213045_create_guests.rb
414
417
  - spec/dummy/db/migrate/20200321121807_create_users_customers.rb
418
+ - spec/dummy/db/migrate/20200621182414_remove_uncofirmed_email_from_admins.rb
419
+ - spec/dummy/db/migrate/20200623003142_create_schema_users.rb
415
420
  - spec/dummy/db/schema.rb
416
421
  - spec/dummy/db/seeds.rb
417
422
  - spec/dummy/public/robots.txt
418
423
  - spec/factories/admins.rb
419
424
  - spec/factories/guests.rb
425
+ - spec/factories/schema_users.rb
420
426
  - spec/factories/users.rb
421
427
  - spec/factories/users_customers.rb
422
428
  - spec/generators/graphql_devise/install_generator_spec.rb
429
+ - spec/graphql_devise/model/with_email_updater_spec.rb
423
430
  - spec/graphql_devise_spec.rb
424
431
  - spec/models/user_spec.rb
425
432
  - spec/rails_helper.rb
@@ -497,6 +504,7 @@ test_files:
497
504
  - spec/dummy/app/graphql/mutations/login.rb
498
505
  - spec/dummy/app/graphql/mutations/register_confirmed_user.rb
499
506
  - spec/dummy/app/graphql/mutations/sign_up.rb
507
+ - spec/dummy/app/graphql/mutations/update_user.rb
500
508
  - spec/dummy/app/graphql/resolvers/public_user.rb
501
509
  - spec/dummy/app/graphql/resolvers/user_show.rb
502
510
  - spec/dummy/app/graphql/types/base_object.rb
@@ -509,6 +517,7 @@ test_files:
509
517
  - spec/dummy/app/models/admin.rb
510
518
  - spec/dummy/app/models/application_record.rb
511
519
  - spec/dummy/app/models/guest.rb
520
+ - spec/dummy/app/models/schema_user.rb
512
521
  - spec/dummy/app/models/user.rb
513
522
  - spec/dummy/app/models/users.rb
514
523
  - spec/dummy/app/models/users/customer.rb
@@ -547,14 +556,18 @@ test_files:
547
556
  - spec/dummy/db/migrate/20190916012505_create_admins.rb
548
557
  - spec/dummy/db/migrate/20191013213045_create_guests.rb
549
558
  - spec/dummy/db/migrate/20200321121807_create_users_customers.rb
559
+ - spec/dummy/db/migrate/20200621182414_remove_uncofirmed_email_from_admins.rb
560
+ - spec/dummy/db/migrate/20200623003142_create_schema_users.rb
550
561
  - spec/dummy/db/schema.rb
551
562
  - spec/dummy/db/seeds.rb
552
563
  - spec/dummy/public/robots.txt
553
564
  - spec/factories/admins.rb
554
565
  - spec/factories/guests.rb
566
+ - spec/factories/schema_users.rb
555
567
  - spec/factories/users.rb
556
568
  - spec/factories/users_customers.rb
557
569
  - spec/generators/graphql_devise/install_generator_spec.rb
570
+ - spec/graphql_devise/model/with_email_updater_spec.rb
558
571
  - spec/graphql_devise_spec.rb
559
572
  - spec/models/user_spec.rb
560
573
  - spec/rails_helper.rb