abizvn-general 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/serializers/abizvn/general/general_setting_lite_serializer.rb +9 -9
  3. data/app/services/abizvn/general/general_setting_service.rb +11 -11
  4. data/lib/abizvn/general/version.rb +5 -5
  5. data/spec/dummy/Rakefile +6 -0
  6. data/spec/dummy/app/assets/config/manifest.js +3 -0
  7. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  8. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  9. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  10. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  11. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  12. data/spec/dummy/app/jobs/application_job.rb +7 -0
  13. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  14. data/spec/dummy/app/models/application_record.rb +3 -0
  15. data/spec/dummy/app/views/layouts/application.html.erb +22 -0
  16. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  17. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  18. data/spec/dummy/app/views/pwa/manifest.json.erb +22 -0
  19. data/spec/dummy/app/views/pwa/service-worker.js +26 -0
  20. data/spec/dummy/bin/rails +4 -0
  21. data/spec/dummy/bin/rake +4 -0
  22. data/spec/dummy/bin/rubocop +8 -0
  23. data/spec/dummy/bin/setup +37 -0
  24. data/spec/dummy/config/application.rb +42 -0
  25. data/spec/dummy/config/boot.rb +3 -0
  26. data/spec/dummy/config/cable.yml +10 -0
  27. data/spec/dummy/config/database.yml +32 -0
  28. data/spec/dummy/config/environment.rb +5 -0
  29. data/spec/dummy/config/environments/development.rb +81 -0
  30. data/spec/dummy/config/environments/production.rb +105 -0
  31. data/spec/dummy/config/environments/test.rb +67 -0
  32. data/spec/dummy/config/initializers/assets.rb +12 -0
  33. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  34. data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  35. data/spec/dummy/config/initializers/inflections.rb +16 -0
  36. data/spec/dummy/config/initializers/new_framework_defaults_7_2.rb +70 -0
  37. data/spec/dummy/config/initializers/permissions_policy.rb +13 -0
  38. data/spec/dummy/config/locales/en.yml +31 -0
  39. data/spec/dummy/config/puma.rb +34 -0
  40. data/spec/dummy/config/routes.rb +3 -0
  41. data/spec/dummy/config/storage.yml +34 -0
  42. data/spec/dummy/config.ru +6 -0
  43. data/spec/dummy/db/migrate/20250312042100_add_service_name_to_active_storage_blobs.active_storage.rb +22 -0
  44. data/spec/dummy/db/migrate/20250312042101_create_active_storage_variant_records.active_storage.rb +27 -0
  45. data/spec/dummy/db/migrate/20250312042102_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +8 -0
  46. data/spec/dummy/db/schema.rb +24 -0
  47. data/spec/dummy/log/development.log +168 -0
  48. data/spec/dummy/log/test.log +818 -0
  49. data/spec/dummy/public/404.html +67 -0
  50. data/spec/dummy/public/406-unsupported-browser.html +66 -0
  51. data/spec/dummy/public/422.html +67 -0
  52. data/spec/dummy/public/500.html +66 -0
  53. data/spec/dummy/public/icon.png +0 -0
  54. data/spec/dummy/public/icon.svg +3 -0
  55. data/spec/dummy/public/robots.txt +1 -0
  56. data/spec/dummy/storage/development.sqlite3 +0 -0
  57. data/spec/dummy/storage/test.sqlite3 +0 -0
  58. data/spec/dummy/tmp/local_secret.txt +1 -0
  59. data/spec/factories/abizvn/general/general_settings.rb +9 -0
  60. data/spec/lib/general_spec.rb +7 -0
  61. data/spec/models/abizvn/general/general_setting_spec.rb +47 -0
  62. data/spec/rails_helper.rb +84 -0
  63. data/spec/serializers/abizvn/general/general_setting_lite_serializer_spec.rb +14 -0
  64. data/spec/services/abizvn/general/general_setting_service_spec.rb +18 -0
  65. data/spec/spec_helper.rb +94 -0
  66. data/spec/support/general_validation_helpers.rb +21 -0
  67. metadata +64 -2
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Your browser is not supported (406)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/406-unsupported-browser.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>Your browser is not supported.</h1>
62
+ <p>Please upgrade your browser to continue.</p>
63
+ </div>
64
+ </div>
65
+ </body>
66
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
Binary file
@@ -0,0 +1,3 @@
1
+ <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="100%" height="100%" fill="red"/>
3
+ </svg>
@@ -0,0 +1 @@
1
+ # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
Binary file
@@ -0,0 +1 @@
1
+ 13e03245472dc9988f21609bad87faa919702aab03bc443b68ea81b282f12ff778e270e1e56c26a90846bc1aa166d2e716b5925813ca607e6175f54794304a3c
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :general_setting, class: 'Abizvn::General::GeneralSetting' do
3
+ group { "sample_group" }
4
+ active { true }
5
+ sequence(:code) { |n| "code#{n}" }
6
+ sequence(:value) { |n| "Value #{n}" }
7
+ sequence(:order) { |n| (100 + n) }
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Abizvn::General do
4
+ it 'has a version number' do
5
+ expect(Abizvn::General::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,47 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Abizvn::General::GeneralSetting, type: :model do
4
+ describe "validations" do
5
+ context 'group validations' do
6
+ it { should validate_presence_of(:group) }
7
+ end
8
+
9
+ context 'code validations' do
10
+ it { should validate_presence_of(:code) }
11
+ end
12
+
13
+ context 'value validations' do
14
+ it { should validate_presence_of(:value) }
15
+ end
16
+
17
+ context 'order validations' do
18
+ it 'validates numericality of order' do
19
+ should validate_numericality_of(:order)
20
+ .only_integer
21
+ .is_greater_than_or_equal_to(0)
22
+ end
23
+ end
24
+ end
25
+
26
+ describe "uniqueness validations" do
27
+ context 'group and code validations' do
28
+ let! (:general_setting1) { FactoryBot.create(:general_setting) }
29
+
30
+ it 'group and code should be unique' do
31
+ new_setting = FactoryBot.build(:general_setting, group: general_setting1.group, code: general_setting1.code)
32
+ expect(new_setting).to be_invalid
33
+ expect(new_setting.errors[:code]).to include("with code must be unique")
34
+ end
35
+ end
36
+
37
+ context 'group and code validations' do
38
+ let! (:general_setting1) { FactoryBot.create(:general_setting) }
39
+
40
+ it 'group and value should be unique' do
41
+ new_setting = FactoryBot.build(:general_setting, group: general_setting1.group, value: general_setting1.value)
42
+ expect(new_setting).to be_invalid
43
+ expect(new_setting.errors[:value]).to include("with value must be unique")
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,84 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ require 'spec_helper'
3
+ ENV['RAILS_ENV'] ||= 'test'
4
+ require_relative '../spec/dummy/config/environment'
5
+ # Prevent database truncation if the environment is production
6
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
7
+ # Uncomment the line below in case you have `--require rails_helper` in the `.rspec` file
8
+ # that will avoid rails generators crashing because migrations haven't been run yet
9
+ # return unless Rails.env.test?
10
+ require 'rspec/rails'
11
+ # Add additional requires below this line. Rails is not loaded until this point!
12
+
13
+ # Requires supporting ruby files with custom matchers and macros, etc, in
14
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
15
+ # run as spec files by default. This means that files in spec/support that end
16
+ # in _spec.rb will both be required and run as specs, causing the specs to be
17
+ # run twice. It is recommended that you do not name files matching this glob to
18
+ # end with _spec.rb. You can configure this pattern with the --pattern
19
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
20
+ #
21
+ # The following line is provided for convenience purposes. It has the downside
22
+ # of increasing the boot-up time by auto-requiring all files in the support
23
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
24
+ # require only the support files necessary.
25
+ #
26
+ # Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
27
+
28
+ # Checks for pending migrations and applies them before tests are run.
29
+ # If you are not using ActiveRecord, you can remove these lines.
30
+ begin
31
+ ActiveRecord::Migration.maintain_test_schema!
32
+ rescue ActiveRecord::PendingMigrationError => e
33
+ abort e.to_s.strip
34
+ end
35
+
36
+ # Requires factories for testing
37
+ Dir.glob(File.join(File.dirname(__FILE__), 'factories', '**', '*.rb')).each { |file| require file }
38
+ Dir.glob(File.join(File.dirname(__FILE__), 'support', '*.rb')).each { |file| require file }
39
+
40
+ RSpec.configure do |config|
41
+ Shoulda::Matchers.configure do |shoulda_config|
42
+ shoulda_config.integrate do |with|
43
+ with.test_framework :rspec
44
+ with.library :rails
45
+ end
46
+ end
47
+
48
+ config.include Abizvn::General::GeneralValidationHelpers
49
+
50
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
51
+ config.fixture_paths = [
52
+ Rails.root.join('spec/fixtures')
53
+ ]
54
+
55
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
56
+ # examples within a transaction, remove the following line or assign false
57
+ # instead of true.
58
+ config.use_transactional_fixtures = true
59
+
60
+ # You can uncomment this line to turn off ActiveRecord support entirely.
61
+ # config.use_active_record = false
62
+
63
+ # RSpec Rails uses metadata to mix in different behaviours to your tests,
64
+ # for example enabling you to call `get` and `post` in request specs. e.g.:
65
+ #
66
+ # RSpec.describe UsersController, type: :request do
67
+ # # ...
68
+ # end
69
+ #
70
+ # The different available types are documented in the features, such as in
71
+ # https://rspec.info/features/7-1/rspec-rails
72
+ #
73
+ # You can also this infer these behaviours automatically by location, e.g.
74
+ # /spec/models would pull in the same behaviour as `type: :model` but this
75
+ # behaviour is considered legacy and will be removed in a future version.
76
+ #
77
+ # To enable this behaviour uncomment the line below.
78
+ # config.infer_spec_type_from_file_location!
79
+
80
+ # Filter lines from Rails gems in backtraces.
81
+ config.filter_rails_from_backtrace!
82
+ # arbitrary gems may also be filtered via:
83
+ # config.filter_gems_from_backtrace("gem name")
84
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Abizvn::General::GeneralSettingLiteSerializer, type: :serializer do
4
+ describe "serialization" do
5
+ context 'order validations' do
6
+ let! (:general_setting1) { FactoryBot.create(:general_setting) }
7
+
8
+ it 'returns required attributes' do
9
+ data = Abizvn::General::GeneralSettingLiteSerializer.new(general_setting1).serializable_hash
10
+ validate_general_setting_lite_hash(general_setting1, data)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Abizvn::General::GeneralSettingService, type: :service do
4
+ describe "find_by_group" do
5
+ context 'returns active groups' do
6
+ let! (:general_setting1) { FactoryBot.create(:general_setting) }
7
+ let! (:general_setting2) { FactoryBot.create(:general_setting, active: false) }
8
+ let! (:general_setting3) { FactoryBot.create(:general_setting) }
9
+
10
+ it 'returns required attributes' do
11
+ data = Abizvn::General::GeneralSettingService.find_by_group(general_setting1.group)
12
+ expect(data.first).to eq(general_setting1)
13
+ expect(data.last).to eq(general_setting3)
14
+ expect(data).not_to include(general_setting2)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,94 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
65
+ config.disable_monkey_patching!
66
+
67
+ # Many RSpec users commonly either run the entire suite or an individual
68
+ # file, and it's useful to allow more verbose output when running an
69
+ # individual spec file.
70
+ if config.files_to_run.one?
71
+ # Use the documentation formatter for detailed output,
72
+ # unless a formatter has already been configured
73
+ # (e.g. via a command-line flag).
74
+ config.default_formatter = "doc"
75
+ end
76
+
77
+ # Print the 10 slowest examples and example groups at the
78
+ # end of the spec run, to help surface which specs are running
79
+ # particularly slow.
80
+ config.profile_examples = 10
81
+
82
+ # Run specs in random order to surface order dependencies. If you find an
83
+ # order dependency and want to debug it, you can fix the order by providing
84
+ # the seed, which is printed after each run.
85
+ # --seed 1234
86
+ config.order = :random
87
+
88
+ # Seed global randomization in this process using the `--seed` CLI option.
89
+ # Setting this allows you to use `--seed` to deterministically reproduce
90
+ # test failures related to randomization by passing the same `--seed` value
91
+ # as the one that triggered the failure.
92
+ Kernel.srand config.seed
93
+ =end
94
+ end
@@ -0,0 +1,21 @@
1
+ module Abizvn
2
+ module General
3
+ module GeneralValidationHelpers
4
+ def validate_general_setting_lite_hash(general_setting, serializable_hash)
5
+ expect(serializable_hash).to have_key(:data)
6
+ expect(serializable_hash[:data]).to have_key(:id)
7
+ expect(serializable_hash[:data]).to have_key(:type)
8
+ expect(serializable_hash[:data]).to have_key(:attributes)
9
+ expect(serializable_hash[:data][:attributes]).to have_key(:id)
10
+ expect(serializable_hash[:data][:attributes]).to have_key(:code)
11
+ expect(serializable_hash[:data][:attributes]).to have_key(:value)
12
+
13
+ expect(serializable_hash[:data][:id]).to eq(general_setting.id.to_s)
14
+ expect(serializable_hash[:data][:type]).to eq(:general_setting_lite)
15
+ expect(serializable_hash[:data][:attributes][:id]).to eq(general_setting.id)
16
+ expect(serializable_hash[:data][:attributes][:code]).to eq(general_setting.code)
17
+ expect(serializable_hash[:data][:attributes][:value]).to eq(general_setting.value)
18
+ end
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abizvn-general
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-14 00:00:00.000000000 Z
11
+ date: 2025-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -140,6 +140,68 @@ files:
140
140
  - lib/abizvn/general/engine.rb
141
141
  - lib/abizvn/general/version.rb
142
142
  - lib/tasks/abizvn/general_tasks.rake
143
+ - spec/dummy/Rakefile
144
+ - spec/dummy/app/assets/config/manifest.js
145
+ - spec/dummy/app/assets/stylesheets/application.css
146
+ - spec/dummy/app/channels/application_cable/channel.rb
147
+ - spec/dummy/app/channels/application_cable/connection.rb
148
+ - spec/dummy/app/controllers/application_controller.rb
149
+ - spec/dummy/app/helpers/application_helper.rb
150
+ - spec/dummy/app/jobs/application_job.rb
151
+ - spec/dummy/app/mailers/application_mailer.rb
152
+ - spec/dummy/app/models/application_record.rb
153
+ - spec/dummy/app/views/layouts/application.html.erb
154
+ - spec/dummy/app/views/layouts/mailer.html.erb
155
+ - spec/dummy/app/views/layouts/mailer.text.erb
156
+ - spec/dummy/app/views/pwa/manifest.json.erb
157
+ - spec/dummy/app/views/pwa/service-worker.js
158
+ - spec/dummy/bin/rails
159
+ - spec/dummy/bin/rake
160
+ - spec/dummy/bin/rubocop
161
+ - spec/dummy/bin/setup
162
+ - spec/dummy/config.ru
163
+ - spec/dummy/config/application.rb
164
+ - spec/dummy/config/boot.rb
165
+ - spec/dummy/config/cable.yml
166
+ - spec/dummy/config/database.yml
167
+ - spec/dummy/config/environment.rb
168
+ - spec/dummy/config/environments/development.rb
169
+ - spec/dummy/config/environments/production.rb
170
+ - spec/dummy/config/environments/test.rb
171
+ - spec/dummy/config/initializers/assets.rb
172
+ - spec/dummy/config/initializers/content_security_policy.rb
173
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
174
+ - spec/dummy/config/initializers/inflections.rb
175
+ - spec/dummy/config/initializers/new_framework_defaults_7_2.rb
176
+ - spec/dummy/config/initializers/permissions_policy.rb
177
+ - spec/dummy/config/locales/en.yml
178
+ - spec/dummy/config/puma.rb
179
+ - spec/dummy/config/routes.rb
180
+ - spec/dummy/config/storage.yml
181
+ - spec/dummy/db/migrate/20250312042100_add_service_name_to_active_storage_blobs.active_storage.rb
182
+ - spec/dummy/db/migrate/20250312042101_create_active_storage_variant_records.active_storage.rb
183
+ - spec/dummy/db/migrate/20250312042102_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
184
+ - spec/dummy/db/schema.rb
185
+ - spec/dummy/log/development.log
186
+ - spec/dummy/log/test.log
187
+ - spec/dummy/public/404.html
188
+ - spec/dummy/public/406-unsupported-browser.html
189
+ - spec/dummy/public/422.html
190
+ - spec/dummy/public/500.html
191
+ - spec/dummy/public/icon.png
192
+ - spec/dummy/public/icon.svg
193
+ - spec/dummy/public/robots.txt
194
+ - spec/dummy/storage/development.sqlite3
195
+ - spec/dummy/storage/test.sqlite3
196
+ - spec/dummy/tmp/local_secret.txt
197
+ - spec/factories/abizvn/general/general_settings.rb
198
+ - spec/lib/general_spec.rb
199
+ - spec/models/abizvn/general/general_setting_spec.rb
200
+ - spec/rails_helper.rb
201
+ - spec/serializers/abizvn/general/general_setting_lite_serializer_spec.rb
202
+ - spec/services/abizvn/general/general_setting_service_spec.rb
203
+ - spec/spec_helper.rb
204
+ - spec/support/general_validation_helpers.rb
143
205
  homepage: https://github.com/abizvncom/abizvn-general
144
206
  licenses:
145
207
  - MIT