commons_yellowme 0.11.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +62 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +12 -0
  5. data/Gemfile.lock +218 -0
  6. data/bin/test +5 -0
  7. data/commons.gemspec +36 -0
  8. data/lib/commons.rb +1 -1
  9. data/lib/commons/concerns/extensions/soft_deleted.rb +34 -0
  10. data/lib/commons/formatter/regex_constants.rb +2 -0
  11. data/lib/commons/repositories/base_repository.rb +59 -54
  12. data/lib/commons/services/concerns/callable.rb +7 -2
  13. data/lib/commons/version.rb +1 -1
  14. data/spec/commons/authentication/authenticate_by_jwt_spec.rb +37 -0
  15. data/spec/commons/authentication/json_web_token_spec.rb +41 -0
  16. data/spec/commons/concerns/attributes/sex_spec.rb +24 -0
  17. data/spec/commons/concerns/extensions/deleted_spec.rb +40 -0
  18. data/spec/commons/concerns/guard/capitalizable_spec.rb +13 -0
  19. data/spec/commons/concerns/validations/undestroyable_spec.rb +9 -0
  20. data/spec/commons/errors/bad_request_spec.rb +62 -0
  21. data/spec/commons/errors/conflict_spec.rb +62 -0
  22. data/spec/commons/errors/forbidden_spec.rb +62 -0
  23. data/spec/commons/errors/internal_server_error_spec.rb +62 -0
  24. data/spec/commons/errors/invalid_resource_spec.rb +62 -0
  25. data/spec/commons/errors/maintenance_mode_spec.rb +49 -0
  26. data/spec/commons/errors/missing_parameter_spec.rb +49 -0
  27. data/spec/commons/errors/not_unique_spec.rb +62 -0
  28. data/spec/commons/errors/payment_required_spec.rb +62 -0
  29. data/spec/commons/errors/precondition_failed_spec.rb +62 -0
  30. data/spec/commons/errors/resource_not_found_spec.rb +49 -0
  31. data/spec/commons/errors/route_not_found_spec.rb +49 -0
  32. data/spec/commons/errors/unauthorized_spec.rb +62 -0
  33. data/spec/commons/errors/unprocessable_entity_spec.rb +62 -0
  34. data/spec/commons/formatter/e164_phone_spec.rb +155 -0
  35. data/spec/commons/formatter/regex_constants_spec.rb +165 -0
  36. data/spec/commons/formatter/string_utils_spec.rb +19 -0
  37. data/spec/commons/repositories/base_repository_spec.rb +516 -0
  38. data/spec/commons/repositories/catalogs/base_catalog_spec.rb +55 -0
  39. data/spec/commons/serializers/bad_request_spec.rb +46 -0
  40. data/spec/commons/serializers/conflict_spec.rb +46 -0
  41. data/spec/commons/serializers/forbidden_spec.rb +46 -0
  42. data/spec/commons/serializers/internal_server_error_spec.rb +46 -0
  43. data/spec/commons/serializers/invalid_resource_spec.rb +46 -0
  44. data/spec/commons/serializers/maintenance_mode_spec.rb +46 -0
  45. data/spec/commons/serializers/missing_parameter_spec.rb +44 -0
  46. data/spec/commons/serializers/not_unique_spec.rb +46 -0
  47. data/spec/commons/serializers/payment_required_spec.rb +46 -0
  48. data/spec/commons/serializers/precondition_failed_spec.rb +46 -0
  49. data/spec/commons/serializers/route_not_found_spec.rb +46 -0
  50. data/spec/commons/serializers/unauthorized_spec.rb +46 -0
  51. data/spec/commons/serializers/unprocessable_entity_spec.rb +46 -0
  52. data/spec/commons/shared-examples/user_spec.rb +18 -0
  53. data/spec/dummy/.ruby-version +1 -0
  54. data/spec/dummy/Rakefile +6 -0
  55. data/spec/dummy/app/assets/config/manifest.js +2 -0
  56. data/spec/dummy/app/assets/images/.keep +0 -0
  57. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  58. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  59. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  60. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  61. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  62. data/spec/dummy/app/controllers/miscellaneous_controller.rb +13 -0
  63. data/spec/dummy/app/errors/default_handling.rb +35 -0
  64. data/spec/dummy/app/errors/error_notifier.rb +12 -0
  65. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  66. data/spec/dummy/app/javascript/packs/application.js +15 -0
  67. data/spec/dummy/app/jobs/application_job.rb +7 -0
  68. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  69. data/spec/dummy/app/models/application_record.rb +3 -0
  70. data/spec/dummy/app/models/catalogs/application_parameter.rb +6 -0
  71. data/spec/dummy/app/models/concerns/.keep +0 -0
  72. data/spec/dummy/app/models/employee.rb +3 -0
  73. data/spec/dummy/app/models/user.rb +16 -0
  74. data/spec/dummy/app/repositories/catalogs/application_parameter_repository.rb +4 -0
  75. data/spec/dummy/app/repositories/employee_repository.rb +2 -0
  76. data/spec/dummy/app/repositories/user_repository.rb +2 -0
  77. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  78. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  79. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  80. data/spec/dummy/bin/rails +4 -0
  81. data/spec/dummy/bin/rake +4 -0
  82. data/spec/dummy/bin/setup +33 -0
  83. data/spec/dummy/config.ru +5 -0
  84. data/spec/dummy/config/application.rb +29 -0
  85. data/spec/dummy/config/boot.rb +5 -0
  86. data/spec/dummy/config/cable.yml +10 -0
  87. data/spec/dummy/config/database.yml +25 -0
  88. data/spec/dummy/config/environment.rb +5 -0
  89. data/spec/dummy/config/environments/development.rb +62 -0
  90. data/spec/dummy/config/environments/production.rb +112 -0
  91. data/spec/dummy/config/environments/test.rb +48 -0
  92. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  93. data/spec/dummy/config/initializers/assets.rb +12 -0
  94. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  95. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  96. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  97. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  98. data/spec/dummy/config/initializers/inflections.rb +16 -0
  99. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  100. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  101. data/spec/dummy/config/locales/en.yml +33 -0
  102. data/spec/dummy/config/puma.rb +38 -0
  103. data/spec/dummy/config/routes.rb +9 -0
  104. data/spec/dummy/config/spring.rb +6 -0
  105. data/spec/dummy/config/storage.yml +34 -0
  106. data/spec/dummy/db/migrate/20191212233443_create_user.rb +13 -0
  107. data/spec/dummy/db/migrate/20191213072543_create_application_parameters.rb +8 -0
  108. data/spec/dummy/db/migrate/20200101204534_create_employee.rb +8 -0
  109. data/spec/dummy/db/schema.rb +35 -0
  110. data/spec/dummy/lib/assets/.keep +0 -0
  111. data/spec/dummy/log/.keep +0 -0
  112. data/spec/dummy/public/404.html +67 -0
  113. data/spec/dummy/public/422.html +67 -0
  114. data/spec/dummy/public/500.html +66 -0
  115. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  116. data/spec/dummy/public/apple-touch-icon.png +0 -0
  117. data/spec/dummy/public/favicon.ico +0 -0
  118. data/spec/factories/catalogs/application_parameters.rb +6 -0
  119. data/spec/factories/employees.rb +6 -0
  120. data/spec/factories/users.rb +7 -0
  121. data/spec/rails_helper.rb +68 -0
  122. data/spec/spec_helper.rb +108 -0
  123. data/spec/support/shared-examples/capitalizable.rb +16 -0
  124. data/spec/support/shared-examples/deletable.rb +39 -0
  125. data/spec/support/shared-examples/dimorphic.rb +28 -0
  126. data/spec/support/shared-examples/stripable.rb +17 -0
  127. data/spec/support/shared-examples/undestroyable.rb +8 -0
  128. metadata +249 -13
  129. data/lib/commons/concerns/extensions/deleted.rb +0 -25
@@ -1,25 +0,0 @@
1
- module Commons
2
- module Concerns
3
- module Extensions
4
- module Deleted
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- before_validation :check_not_deleted, on: [:update]
9
-
10
- def deleted?
11
- raise ActiveModel::MissingAttributeError unless self.has_attribute?(:deleted_at)
12
- self.deleted_at.present?
13
- end
14
- end
15
-
16
- private
17
-
18
- def check_not_deleted
19
- raise ActiveModel::MissingAttributeError unless self.has_attribute?(:deleted_at)
20
- raise ActiveRecord::RecordInvalid if self.deleted_at_in_database.present?
21
- end
22
- end
23
- end
24
- end
25
- end