From 6c6ae62e5a4367a7ce8e02e8adeac93d5d835dc6 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Tue, 17 Dec 2024 00:46:01 +0100 Subject: [PATCH 01/25] Define model and endpoints to store affinity between group pairs --- app/controllers/affinities_controller.rb | 36 +++++++++++++ app/models/group.rb | 4 ++ app/models/group_affinity.rb | 38 ++++++++++++++ app/services/tables/discomfort_calculator.rb | 16 +++--- config/routes.rb | 7 ++- .../20241216231415_create_group_affinities.rb | 27 ++++++++++ db/schema.rb | 19 +++++-- docker-compose.yml | 18 ++++++- spec/factories/group_affinities.rb | 7 +++ spec/models/group_affinity_spec.rb | 40 +++++++++++++++ spec/requests/affinities_spec.rb | 50 +++++++++++++++++++ 11 files changed, 250 insertions(+), 12 deletions(-) create mode 100644 app/controllers/affinities_controller.rb create mode 100644 app/models/group_affinity.rb create mode 100644 db/migrate/20241216231415_create_group_affinities.rb create mode 100644 spec/factories/group_affinities.rb create mode 100644 spec/models/group_affinity_spec.rb create mode 100644 spec/requests/affinities_spec.rb diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb new file mode 100644 index 0000000..9a2122c --- /dev/null +++ b/app/controllers/affinities_controller.rb @@ -0,0 +1,36 @@ +# Copyright (C) 2024 Manuel Bustillo + +# frozen_string_literal: true + +class AffinitiesController < ApplicationController + before_action :set_group + + def index + overridden_affinities = @group.affinities + .each_with_object({}) { |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort } + Group.pluck(:id).index_with { |group_id| overridden_affinities[group_id] || GroupAffinity::NEUTRAL } + .then { |affinities| render json: affinities } + end + + def bulk_update + params.expect(affinities: [[:group_id, :discomfort]]).map(&:to_h).map do |affinity| + { + group_a_id: @group.id, + group_b_id: affinity[:group_id], + discomfort: affinity[:discomfort] + } + end.then { |affinities| GroupAffinity.upsert_all(affinities) } + render json: {}, status: :ok + + rescue ActiveRecord::InvalidForeignKey + render json: { error: 'At least one of the group IDs provided does not exist.' }, status: :bad_request + rescue ActiveRecord::StatementInvalid + render json: { error: 'Invalid group ID or discomfort provided.' } + end + + private + + def set_group + @group = Group.find(params[:group_id]) + end +end diff --git a/app/models/group.rb b/app/models/group.rb index a00a671..6552214 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -53,6 +53,10 @@ class Group < ApplicationRecord child.colorize_children(generation + 1) end end + + def affinities + GroupAffinity.where(group_a_id: id).or(GroupAffinity.where(group_b_id: id)) + end private diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb new file mode 100644 index 0000000..c33364c --- /dev/null +++ b/app/models/group_affinity.rb @@ -0,0 +1,38 @@ +# == Schema Information +# +# Table name: group_affinities +# +# id :bigint not null, primary key +# discomfort :float not null +# created_at :datetime not null +# updated_at :datetime not null +# group_a_id :uuid not null +# group_b_id :uuid not null +# +# Indexes +# +# index_group_affinities_on_group_a_id (group_a_id) +# index_group_affinities_on_group_b_id (group_b_id) +# uindex_group_pair (LEAST(group_a_id, group_b_id), GREATEST(group_a_id, group_b_id)) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (group_a_id => groups.id) +# fk_rails_... (group_b_id => groups.id) +# +class GroupAffinity < ApplicationRecord + NEUTRAL = 1 + MIN_DISCOMFORT = 0 + MAX_DISCOMFORT = 2 + + belongs_to :group_a, class_name: 'Group' + belongs_to :group_b, class_name: 'Group' + + validates :discomfort, numericality: { greater_than_or_equal_to: MIN_DISCOMFORT, less_than_or_equal_to: MAX_DISCOMFORT } + + def another_group(group) + return nil if group != group_a && group != group_b + + group == group_a ? group_b : group_a + end +end diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index 35da8ce..c4ef54a 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -2,6 +2,15 @@ module Tables class DiscomfortCalculator + class << self + def cohesion_discomfort(id_a:, id_b:) + distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) + + return 1 if distance.nil? + Rational(distance, distance + 1) + end + end + private attr_reader :table def initialize(table:) @table = table @@ -45,12 +54,7 @@ module Tables # def cohesion_discomfort table.map(&:group_id).tally.to_a.combination(2).sum do |(a, count_a), (b, count_b)| - distance = AffinityGroupsHierarchy.instance.distance(a, b) - - next count_a * count_b if distance.nil? - next 0 if distance.zero? - - count_a * count_b * Rational(distance, distance + 1) + count_a * count_b * self.class.cohesion_discomfort(id_a: a, id_b: b) end end end diff --git a/config/routes.rb b/config/routes.rb index c3bc335..9e2b004 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,7 +23,12 @@ Rails.application.routes.draw do get '/users/confirmation', to: 'users/confirmations#show', as: :confirmation end - resources :groups, only: %i[index create update destroy] + resources :groups, only: %i[index create update destroy] do + resources :affinities, only: %i[index] do + put :bulk_update, on: :collection + end + end + resources :guests, only: %i[index create update destroy] do post :bulk_update, on: :collection end diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb new file mode 100644 index 0000000..1c6789d --- /dev/null +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -0,0 +1,27 @@ +class CreateGroupAffinities < ActiveRecord::Migration[8.0] + disable_ddl_transaction! + + def change + create_table :group_affinities, if_not_exists: true do |t| + t.references :group_a, type: :uuid, null: false, foreign_key: { to_table: :groups } + t.references :group_b, type: :uuid, null: false, foreign_key: { to_table: :groups } + t.float :discomfort, null: false + t.timestamps + end + + add_check_constraint :group_affinities, 'group_a_id != group_b_id', name: :check_distinct_groups, if_not_exists: true + add_check_constraint :group_affinities, 'discomfort >= 0 AND discomfort <= 2', if_not_exists: true + + reversible do |dir| + dir.up do + execute <<~SQL + CREATE UNIQUE INDEX CONCURRENTLY uindex_group_pair ON group_affinities (least(group_a_id, group_b_id), greatest(group_a_id, group_b_id)); + SQL + end + + dir.down do + remove_index :group_affinities, name: :uindex_group_pair, if_exists: true + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 0684e19..5e4178c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# Copyright (C) 2024 Manuel Bustillo - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do +ActiveRecord::Schema[8.0].define(version: 2024_12_16_231415) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -30,6 +28,19 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do t.index ["wedding_id"], name: "index_expenses_on_wedding_id" end + create_table "group_affinities", force: :cascade do |t| + t.uuid "group_a_id", null: false + t.uuid "group_b_id", null: false + t.float "discomfort", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index "LEAST(group_a_id, group_b_id), GREATEST(group_a_id, group_b_id)", name: "uindex_group_pair", unique: true + t.index ["group_a_id"], name: "index_group_affinities_on_group_a_id" + t.index ["group_b_id"], name: "index_group_affinities_on_group_b_id" + t.check_constraint "discomfort >= 0::double precision AND discomfort <= 2::double precision" + t.check_constraint "group_a_id <> group_b_id", name: "check_distinct_groups" + end + create_table "groups", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name", null: false t.string "icon" @@ -228,6 +239,8 @@ ActiveRecord::Schema[8.0].define(version: 2024_12_08_102932) do end add_foreign_key "expenses", "weddings" + add_foreign_key "group_affinities", "groups", column: "group_a_id" + add_foreign_key "group_affinities", "groups", column: "group_b_id" add_foreign_key "groups", "groups", column: "parent_id" add_foreign_key "groups", "weddings" add_foreign_key "guests", "groups" diff --git a/docker-compose.yml b/docker-compose.yml index df2c035..93cff59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,13 @@ services: environment: DATABASE_URL: postgres://postgres:postgres@db:5432/postgres RAILS_ENV: development + tty: true + stdin_open: true + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/up"] + interval: 10s + timeout: 5s + retries: 5 volumes: - .:/rails workers: @@ -32,6 +39,11 @@ services: dockerfile: Dockerfile.dev ports: - 3000 + healthcheck: + test: wget -qO - http://localhost:3000/api/health || exit 1 + interval: 10s + timeout: 5s + retries: 5 depends_on: - backend volumes: @@ -50,8 +62,10 @@ services: volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - - frontend - - backend + frontend: + condition: service_healthy + backend: + condition: service_healthy db: image: postgres:17 ports: diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb new file mode 100644 index 0000000..6877218 --- /dev/null +++ b/spec/factories/group_affinities.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :group_affinity do + association :group_a, factory: :group + association :group_b, factory: :group + discomfort { GroupAffinity::NEUTRAL } + end +end diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb new file mode 100644 index 0000000..d346110 --- /dev/null +++ b/spec/models/group_affinity_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe GroupAffinity, type: :model do + let(:wedding) { create(:wedding) } + let(:group_a) { create(:group, wedding:) } + let(:group_b) { create(:group, wedding:) } + let(:group_c) { create(:group, wedding:) } + + subject { build(:group_affinity, group_a:, group_b: ) } + + describe 'validations' do + it { should validate_numericality_of(:discomfort).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(2) } + end + + describe '.create' do + before do + create(:group_affinity, group_a: group_a, group_b: group_b) + end + + it 'disallows the creation of a group affinity with the same group on both sides' do + expect do + create(:group_affinity, group_a: group_c, group_b: group_c) + end.to raise_error(ActiveRecord::StatementInvalid) + end + + it 'disallows the creation of a group affinity that already exists' do + expect do + create(:group_affinity, group_a: group_a, group_b: group_b) + end.to raise_error(ActiveRecord::StatementInvalid) + end + + it 'disallows the creation of a group affinity with the same groups in reverse order' do + expect do + create(:group_affinity, group_a: group_b, group_b: group_a) + end.to raise_error(ActiveRecord::StatementInvalid) + end + end +end diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb new file mode 100644 index 0000000..a78d569 --- /dev/null +++ b/spec/requests/affinities_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require 'swagger_helper' + +RSpec.describe 'affinities', type: :request do + path '/{slug}/groups/{group_id}/affinities' do + parameter Swagger::Schema::SLUG + parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' + + get('list affinities') do + tags 'Affinities' + produces 'application/json' + + response(200, 'successful') do + schema type: :object, additionalProperties: { type: :integer, minimum: 0, maximum: 2 } + xit + end + end + end + + path '/{slug}/groups/{group_id}/affinities/bulk_update' do + parameter Swagger::Schema::SLUG + parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' + + put('bulk update affinities') do + tags 'Affinities' + produces 'application/json' + consumes 'application/json' + parameter name: :body, in: :body, schema: { + type: :object, + required: [:affinities], + properties: { + affinities: { + type: :array, + items: { + type: :object, + required: %i[group_id discomfort], + properties: { + group_id: { type: :string, format: :uuid, description: 'ID of the associated group' }, + discomfort: { type: :integer, minimum: 0, maximum: 2 } + } + } + } + } + } + + response_empty_200 + end + end +end From 0780b17f4b4f9a6ab844b91face897edf1252857 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 26 Dec 2024 19:30:32 +0000 Subject: [PATCH 02/25] Add copyright notice --- app/models/group_affinity.rb | 2 ++ db/migrate/20241216231415_create_group_affinities.rb | 2 ++ db/schema.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/models/group_affinity_spec.rb | 2 ++ spec/requests/affinities_spec.rb | 2 ++ 6 files changed, 12 insertions(+) diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index c33364c..31e1503 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # == Schema Information # # Table name: group_affinities diff --git a/db/migrate/20241216231415_create_group_affinities.rb b/db/migrate/20241216231415_create_group_affinities.rb index 1c6789d..2b03897 100644 --- a/db/migrate/20241216231415_create_group_affinities.rb +++ b/db/migrate/20241216231415_create_group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + class CreateGroupAffinities < ActiveRecord::Migration[8.0] disable_ddl_transaction! diff --git a/db/schema.rb b/db/schema.rb index 5e4178c..f723b74 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index 6877218..bc57226 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + FactoryBot.define do factory :group_affinity do association :group_a, factory: :group diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index d346110..05f9330 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true require 'rails_helper' diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index a78d569..39f6afd 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true require 'swagger_helper' From 5784c89b79331a2670d2d82d9760b99c7d4c41cc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 14:18:59 +0100 Subject: [PATCH 03/25] Refine endpoint to receive an affinity value and transform it into a discomfort equivalent --- app/controllers/affinities_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index 9a2122c..fab690a 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -8,16 +8,16 @@ class AffinitiesController < ApplicationController def index overridden_affinities = @group.affinities .each_with_object({}) { |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort } - Group.pluck(:id).index_with { |group_id| overridden_affinities[group_id] || GroupAffinity::NEUTRAL } + Group.where.not(id: @group.id).pluck(:id).index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden_affinities[group_id] || GroupAffinity::NEUTRAL) } .then { |affinities| render json: affinities } end def bulk_update - params.expect(affinities: [[:group_id, :discomfort]]).map(&:to_h).map do |affinity| + params.expect(affinities: [[:group_id, :affinity]]).map(&:to_h).map do |affinity| { group_a_id: @group.id, group_b_id: affinity[:group_id], - discomfort: affinity[:discomfort] + discomfort: GroupAffinity::MAX_DISCOMFORT - affinity[:affinity] } end.then { |affinities| GroupAffinity.upsert_all(affinities) } render json: {}, status: :ok @@ -25,7 +25,7 @@ class AffinitiesController < ApplicationController rescue ActiveRecord::InvalidForeignKey render json: { error: 'At least one of the group IDs provided does not exist.' }, status: :bad_request rescue ActiveRecord::StatementInvalid - render json: { error: 'Invalid group ID or discomfort provided.' } + render json: { error: 'Invalid group ID or discomfort provided.' }, status: :bad_request end private From 9fe649f8b84ac7dc327f612b9b7a174732d8675a Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 16:43:58 +0100 Subject: [PATCH 04/25] Update swagger documentation --- spec/requests/affinities_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 39f6afd..6e113d2 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -36,10 +36,10 @@ RSpec.describe 'affinities', type: :request do type: :array, items: { type: :object, - required: %i[group_id discomfort], + required: %i[group_id affinity], properties: { group_id: { type: :string, format: :uuid, description: 'ID of the associated group' }, - discomfort: { type: :integer, minimum: 0, maximum: 2 } + affinity: { type: :integer, minimum: 0, maximum: 2 } } } } From 5fcac34a521591fbd24fe8b08164473d86cc6cec Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:08:57 +0100 Subject: [PATCH 05/25] Install Rubocop extensions --- .rubocop.yml | 13 +++ Gemfile | 20 ++-- Gemfile.lock | 323 +++++++++++++++++++++++++++------------------------ 3 files changed, 196 insertions(+), 160 deletions(-) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..c316e05 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +require: + - rubocop-rails + - rubocop-factory_bot + - rubocop-rspec + - rubocop-rspec_rails +AllCops: + NewCops: enable + Exclude: + - 'db/**/*' + - 'config/**/*' + - 'script/**/*' + - 'bin/{rails,rake}' + - '*.yml' \ No newline at end of file diff --git a/Gemfile b/Gemfile index 0a618dd..8471272 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'https://rubygems.org' +# frozen_string_literal: true ruby '3.3.6' gem 'bootsnap', require: false @@ -15,15 +15,15 @@ gem 'stimulus-rails' gem 'turbo-rails' gem 'tzinfo-data', platforms: %i[windows jruby] +gem 'acts_as_tenant' gem 'faker' +gem 'httparty' gem 'jsonapi-rails' +gem 'pluck_to_hash' gem 'rack-cors' gem 'react-rails' -gem 'rubytree' -gem 'acts_as_tenant' -gem 'httparty' gem 'rswag' -gem 'pluck_to_hash' +gem 'rubytree' group :development, :test do gem 'annotaterb' @@ -36,12 +36,16 @@ group :development, :test do end group :development do - gem 'rubocop' - gem 'web-console' gem 'letter_opener_web' + gem 'rubocop' + gem 'rubocop-factory_bot', require: false + gem 'rubocop-rails', require: false + gem 'rubocop-rspec', require: false + gem 'rubocop-rspec_rails', require: false + gem 'web-console' end gem 'chroma' gem 'solid_queue', '~> 1.0' -gem "devise", "~> 4.9" +gem 'devise', '~> 4.9' diff --git a/Gemfile.lock b/Gemfile.lock index f55a087..df07989 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,4 @@ GEM - remote: https://rubygems.org/ specs: actioncable (8.0.1) actionpack (= 8.0.1) @@ -339,6 +338,18 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.36.2) parser (>= 3.3.1.0) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-rails (2.28.0) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.3.0) + rubocop (~> 1.61) + rubocop-rspec_rails (2.30.0) + rubocop (~> 1.61) + rubocop-rspec (~> 3, >= 3.0.1) ruby-progressbar (1.13.0) rubytree (2.1.0) json (~> 2.0, > 2.3.1) @@ -426,6 +437,10 @@ DEPENDENCIES rspec-rails (~> 7.1.0) rswag rubocop + rubocop-factory_bot + rubocop-rails + rubocop-rspec + rubocop-rspec_rails rubytree shoulda-matchers (~> 6.0) solid_queue (~> 1.0) @@ -436,157 +451,161 @@ DEPENDENCIES web-console CHECKSUMS - actioncable (8.0.1) sha256=808bff2a4e3aba36f66f0cd65d7a1579ad52fb65e99304442c46051a79689d9b - actionmailbox (8.0.1) sha256=bbc7db779be857fb6eb5b53f313d3881cd8cda38a150c3aa25f89f2f9977b08c - actionmailer (8.0.1) sha256=7b074e9590e4ec5cebd2fc91d1f9ba4c61bbd4bbd4376f731527da187cd39952 - actionpack (8.0.1) sha256=c764e4bfc0ad9d3505c09ef9b6fbf9eca4292793550c6b7e2ea93167181bfcba - actiontext (8.0.1) sha256=f232d303e854db2098f34d7331fe493a72dc2e53dfce80fbd517c7b93d4b05b2 - actionview (8.0.1) sha256=3005e3de5ca49ea789bf1ad46002d63fe5aa543c61c341239d3c533757e64f8a - activejob (8.0.1) sha256=95acd9a32d498d3a458efbb317f6191fb678758cde0ebb6c68f0b25e0fe3477f - activemodel (8.0.1) sha256=f46292fd6dcc128e18d588854298a933fd9eb22544c412b414ec02821062dc78 - activerecord (8.0.1) sha256=34a7f0610660bb704f0363025d4b8d35ffe8ddc8f5b8147e0809171f724b5306 - activestorage (8.0.1) sha256=91a8f156638568fac971ff25962a617d9c58fdc0e44eb6bd0edff36aff7df205 - activesupport (8.0.1) sha256=fd5bc74641c24ac3541055c2879789198ff42adee3e39c2933289ba008912e37 - acts_as_tenant (1.0.1) sha256=6944e4d64533337938a8817a6b4ff9b11189c9dcc0b1333bb89f3821a4c14c53 - addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232 - annotaterb (4.13.0) sha256=6f472912002fefa735665b4132de47d0134ebf1efb76a7ef05f579cc4a6b2ff1 - ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 - babel-source (5.8.35) sha256=79ef222a9dcb867ac2efa3b0da35b4bcb15a4bfa67b6b2dcbf1e9a29104498d9 - babel-transpiler (0.7.0) sha256=4c06f4ad9e8e1cabe94f99e11df2f140bb72aca9ba067dbb49dc14d9b98d1570 - base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 - bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 - benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a - bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be - bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e - bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 - builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f - childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec - chroma (0.2.0) sha256=64bdcd36a4765fbcd45adc64960cc153101300b4918f90ffdd89f4e2eb954b54 - coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b - concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 - connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 - crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d - csv (3.3.2) sha256=6ff0c135e65e485d1864dde6c1703b60d34cc9e19bed8452834a0b28a519bd4e - date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f - debug (1.10.0) sha256=11e28ca74875979e612444104f3972bd5ffb9e79179907d7ad46dba44bd2e7a4 - devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 - diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe - drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 - erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 - et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 - execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb - factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 - factory_bot_rails (6.4.3) sha256=ea73ceac1c0ff3dc11fff390bf2ea8a2604066525ed8ecd3b3bc2c267226dcc8 - faker (3.5.1) sha256=1ad1fbea279d882f486059c23fe3ddb816ccd1d7052c05a45014b4450d859bfc - fugit (1.11.1) sha256=e89485e7be22226d8e9c6da411664d0660284b4b1c08cacb540f505907869868 - globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 - httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c - i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c - importmap-rails (2.1.0) sha256=9f10c67d60651a547579f448100d033df311c5d5db578301374aeb774faae741 - io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 - irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 - jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 - json (2.8.2) sha256=dd4fa6c9c81daecf72b86ea36e56ed8955fdbb4d4dc379c93d313a59344486cf - json-schema (5.0.1) sha256=bef71a82c600a42594911553522e143f7634affc198ed507ef3ded2f920a74a9 - jsonapi-deserializable (0.2.0) sha256=5f0ca2d3f8404cce1584a314e8a3753be32a56054c942adfe997b87e92bce147 - jsonapi-parser (0.1.1) sha256=9ee0dc031e88fc7548d56fab66f9716d1e1c06f972b529b8c4617bc42a097020 - jsonapi-rails (0.4.1) sha256=fa68b927b58f194e8b81f578c0bf18e61575638f45a390f66c832de2e6d179ba - jsonapi-rb (0.5.0) sha256=7922a164278f506c43d56277f6bd0800a0b603cc985f7f63fe7241b2628bd105 - jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b - jsonapi-serializable (0.3.1) sha256=221e657677659d798e268a33ec97a83ec5ea0e4233f931358db84e88056552e9 - language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f - launchy (3.0.1) sha256=b7fa60bda0197cf57614e271a250a8ca1f6a34ab889a3c73f67ec5d57c8a7f2c - letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 - letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 - license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 - logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 - loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e - mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad - marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 - method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 - mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef - minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947 - money (6.19.0) sha256=ec936fa1e42f2783719241ed9fd52725d0efa628f928feea1eb5c37d5de7daf3 - msgpack (1.7.2) sha256=59ab62fd8a4d0dfbde45009f87eb6f158ab2628a7c48886b0256f175166baaa8 - multi_xml (0.7.1) sha256=4fce100c68af588ff91b8ba90a0bb3f0466f06c909f21a32f4962059140ba61b - net-imap (0.5.2) sha256=e955b55e539712518bdb4eb747c6514f9c8d56ec4eb8eb573a82a6885a9effea - net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 - net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 - net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a - nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 - nokogiri (1.17.2-aarch64-linux) sha256=585c8cac6380848b7973bacfd0584628d116810e5f209db25e22d0c32313e681 - nokogiri (1.17.2-arm-linux) sha256=3d033ad9b09d5b8a203f0f2156053e93a9327a9c7887c0ceb9fa78c71d27280d - nokogiri (1.17.2-arm64-darwin) sha256=0c5eb06ba1c112d33c2bb29973b07e2f21c4ddb66c67c9386fd97ff1c5d84686 - nokogiri (1.17.2-x86-linux) sha256=8c4dd75e35810bdeb7c74943f383ca665baf6aed8fc2b78c1d305094a72794aa - nokogiri (1.17.2-x86_64-darwin) sha256=dc5977eb3416e1d501b22b0ed4737bf7604121491405865b887975eacfb3e896 - nokogiri (1.17.2-x86_64-linux) sha256=e8614ae8d776bd9adb535ca814375e7ae05d7cfa6aa01909e561484f6d70be0b - orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 - parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef - parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b - pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc - pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e - pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b - psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab - public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f - puma (6.5.0) sha256=94d1b75cab7f356d52e4f1b17b9040a090889b341dbeee6ee3703f441dc189f2 - raabro (1.4.0) sha256=d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882 - racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f - rack (3.1.8) sha256=d3fbcbca43dc2b43c9c6d7dfbac01667ae58643c42cea10013d0da970218a1b1 - rack-cors (2.0.2) sha256=415d4e1599891760c5dc9ef0349c7fecdf94f7c6a03e75b2e7c2b54b82adda1b - rack-session (2.0.0) sha256=db04b2063e180369192a9046b4559af311990af38c6a93d4c600cee4eb6d4e81 - rack-test (2.1.0) sha256=0c61fc61904049d691922ea4bb99e28004ed3f43aa5cfd495024cc345f125dfb - rackup (2.2.1) sha256=f737191fd5c5b348b7f0a4412a3b86383f88c43e13b8217b63d4c8d90b9e798d - rails (8.0.1) sha256=c86f4cd7834a67c1e5d04a77d35c88a5f56a20e2022ec416fa52c1af2cdc9491 - rails-dom-testing (2.2.0) sha256=e515712e48df1f687a1d7c380fd7b07b8558faa26464474da64183a7426fa93b - rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560 - railties (8.0.1) sha256=8f653c6b1b0721b553045bd0deda1f22074b9ddc2209526e6f7285fcf607ac51 - rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a - rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d - rdoc (6.10.0) sha256=db665021883ac9df3ba29cdf71aece960749888db1bf9615b4a584cfa3fa3eda - react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64 - redis (5.3.0) sha256=6bf810c5ae889187f0c45f77db503310980310afa57cf1640d57f419ccda72b1 - redis-client (0.22.2) sha256=31fee4b7cf04109b227327fabeaaf1fc5b652cf48a186a03bc607e40767bacc0 - regexp_parser (2.9.3) sha256=4b620657ed8349d82e1331a076415c79b9dd714a5546162ddd790ea9988f6379 - reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 - responders (3.1.1) sha256=92f2a87e09028347368639cfb468f5fefa745cb0dc2377ef060db1cdd79a341a - rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9 - rspec-core (3.13.2) sha256=94fbda6e4738e478f1c7532b7cc241272fcdc8b9eac03a97338b1122e4573300 - rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 - rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef - rspec-rails (7.1.0) sha256=94585b69c4086ca79afae5cc8d2c5e314f6ad32a88c927f9c065b99596e3ee47 - rspec-support (3.13.1) sha256=48877d4f15b772b7538f3693c22225f2eda490ba65a0515c4e7cf6f2f17de70f - rswag (2.16.0) sha256=f07ce41548b9bb51464c38bc7b95af22fee84b90f2d1197a515a623906353086 - rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 - rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 - rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f - rubocop (1.69.2) sha256=762fb0f30a379bf6054588d39f1815a2a1df8f067bc0337d3fe500e346924bb8 - rubocop-ast (1.36.2) sha256=566405b7f983eb9aa3b91d28aca6bc6566e356a97f59e89851dd910aef1dd1ca - ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 - rubytree (2.1.0) sha256=30e8759ba060dff0dabf7e40cbaaa4df892fa34cbe9f1b3fbb00e83a3f321e4b - rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f - securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 - shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 - solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c - sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 - sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e - stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 - stringio (3.1.2) sha256=204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131 - thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda - tilt (2.4.0) sha256=df74f29a451daed26591a85e8e0cebb198892cb75b6573394303acda273fba4d - timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e - tomlrb (2.0.3) sha256=c2736acf24919f793334023a4ff396c0647d93fce702a73c9d348deaa815d4f7 - turbo-rails (2.0.11) sha256=fc47674736372780abd2a4dc0d84bef242f5ca156a457cd7fa6308291e397fcf - tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b - unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a - uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27 - useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 - warden (1.2.9) sha256=46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0 - web-console (4.2.1) sha256=e7bcf37a10ea2b4ec4281649d1cee461b32232d0a447e82c786e6841fd22fe20 - websocket-driver (0.7.6) sha256=f69400be7bc197879726ad8e6f5869a61823147372fd8928836a53c2c741d0db - websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 - with_env (1.1.0) sha256=50b3e4f0a6cda8f90d8a6bd87a6261f6c381429abafb161c4c69ad4a0cd0b6e4 - xml-simple (1.1.9) sha256=d21131e519c86f1a5bc2b6d2d57d46e6998e47f18ed249b25cad86433dbd695d - zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 + actioncable (8.0.1) + actionmailbox (8.0.1) + actionmailer (8.0.1) + actionpack (8.0.1) + actiontext (8.0.1) + actionview (8.0.1) + activejob (8.0.1) + activemodel (8.0.1) + activerecord (8.0.1) + activestorage (8.0.1) + activesupport (8.0.1) + acts_as_tenant (1.0.1) + addressable (2.8.7) + annotaterb (4.13.0) + ast (2.4.2) + babel-source (5.8.35) + babel-transpiler (0.7.0) + base64 (0.2.0) + bcrypt (3.1.20) + benchmark (0.4.0) + bigdecimal (3.1.8) + bindex (0.8.1) + bootsnap (1.18.4) + builder (3.3.0) + childprocess (5.1.0) + chroma (0.2.0) + coderay (1.1.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + crass (1.0.6) + csv (3.3.2) + date (3.4.1) + debug (1.10.0) + devise (4.9.4) + diff-lcs (1.5.1) + drb (2.2.1) + erubi (1.13.1) + et-orbi (1.2.11) + execjs (2.9.1) + factory_bot (6.4.6) + factory_bot_rails (6.4.3) + faker (3.5.1) + fugit (1.11.1) + globalid (1.2.1) + httparty (0.22.0) + i18n (1.14.6) + importmap-rails (2.1.0) + io-console (0.8.0) + irb (1.14.3) + jbuilder (2.13.0) + json (2.8.2) + json-schema (5.0.1) + jsonapi-deserializable (0.2.0) + jsonapi-parser (0.1.1) + jsonapi-rails (0.4.1) + jsonapi-rb (0.5.0) + jsonapi-renderer (0.2.2) + jsonapi-serializable (0.3.1) + language_server-protocol (3.17.0.3) + launchy (3.0.1) + letter_opener (1.10.0) + letter_opener_web (3.0.0) + license_finder (7.2.1) + logger (1.6.4) + loofah (2.23.1) + mail (2.8.1) + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.4) + money (6.19.0) + msgpack (1.7.2) + multi_xml (0.7.1) + net-imap (0.5.2) + net-pop (0.1.2) + net-protocol (0.2.2) + net-smtp (0.5.0) + nio4r (2.7.4) + nokogiri (1.17.2-aarch64-linux) + nokogiri (1.17.2-arm-linux) + nokogiri (1.17.2-arm64-darwin) + nokogiri (1.17.2-x86-linux) + nokogiri (1.17.2-x86_64-darwin) + nokogiri (1.17.2-x86_64-linux) + orm_adapter (0.5.0) + parallel (1.26.3) + parser (3.3.6.0) + pg (1.5.9) + pluck_to_hash (1.0.2) + pry (0.15.2) + psych (5.2.2) + public_suffix (6.0.1) + puma (6.5.0) + raabro (1.4.0) + racc (1.8.1) + rack (3.1.8) + rack-cors (2.0.2) + rack-session (2.0.0) + rack-test (2.1.0) + rackup (2.2.1) + rails (8.0.1) + rails-dom-testing (2.2.0) + rails-html-sanitizer (1.6.2) + railties (8.0.1) + rainbow (3.1.1) + rake (13.2.1) + rdoc (6.10.0) + react-rails (3.2.1) + redis (5.3.0) + redis-client (0.22.2) + regexp_parser (2.9.3) + reline (0.6.0) + responders (3.1.1) + rexml (3.3.9) + rspec-core (3.13.2) + rspec-expectations (3.13.3) + rspec-mocks (3.13.2) + rspec-rails (7.1.0) + rspec-support (3.13.1) + rswag (2.16.0) + rswag-api (2.16.0) + rswag-specs (2.16.0) + rswag-ui (2.16.0) + rubocop (1.69.2) + rubocop-ast (1.36.2) + rubocop-factory_bot (2.26.1) + rubocop-rails (2.28.0) + rubocop-rspec (3.3.0) + rubocop-rspec_rails (2.30.0) + ruby-progressbar (1.13.0) + rubytree (2.1.0) + rubyzip (2.3.2) + securerandom (0.4.1) + shoulda-matchers (6.4.0) + solid_queue (1.1.0) + sprockets (4.2.1) + sprockets-rails (3.5.2) + stimulus-rails (1.3.4) + stringio (3.1.2) + thor (1.3.2) + tilt (2.4.0) + timeout (0.4.3) + tomlrb (2.0.3) + turbo-rails (2.0.11) + tzinfo (2.0.6) + unicode-display_width (2.6.0) + uri (1.0.2) + useragent (0.16.11) + warden (1.2.9) + web-console (4.2.1) + websocket-driver (0.7.6) + websocket-extensions (0.1.5) + with_env (1.1.0) + xml-simple (1.1.9) + zeitwerk (2.7.1) RUBY VERSION ruby 3.3.6p108 From 4d6986397417f71c0abfc26ecbeb1eeb83908385 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:27:28 +0100 Subject: [PATCH 06/25] Run Rubocop autocorrect on spec/models --- .rubocop.yml | 6 +++++- spec/models/expense_spec.rb | 12 +++++++----- spec/models/group_affinity_spec.rb | 12 ++++++++---- spec/models/group_spec.rb | 6 ++++-- spec/models/guest_spec.rb | 15 +++++++++----- spec/models/seat_spec.rb | 4 +++- spec/models/tables_arrangement_spec.rb | 4 +++- spec/models/user_spec.rb | 4 +++- spec/models/wedding_spec.rb | 27 ++++++++++++++------------ 9 files changed, 58 insertions(+), 32 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c316e05..3ec2fa4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,4 +10,8 @@ AllCops: - 'config/**/*' - 'script/**/*' - 'bin/{rails,rake}' - - '*.yml' \ No newline at end of file + - '*.yml' +Layout/LineLength: + Max: 120 +RSpec/ExampleLength: + Max: 10 \ No newline at end of file diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 973ccf2..d6d5f89 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,12 +1,14 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Expense, type: :model do +RSpec.describe Expense do describe 'validations' do - it { should validate_presence_of(:name) } - it { should validate_presence_of(:amount) } - it { should validate_numericality_of(:amount).is_greater_than(0) } - it { should validate_presence_of(:pricing_type) } + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_presence_of(:amount) } + it { is_expected.to validate_numericality_of(:amount).is_greater_than(0) } + it { is_expected.to validate_presence_of(:pricing_type) } end end diff --git a/spec/models/group_affinity_spec.rb b/spec/models/group_affinity_spec.rb index 05f9330..9d56d08 100644 --- a/spec/models/group_affinity_spec.rb +++ b/spec/models/group_affinity_spec.rb @@ -4,16 +4,20 @@ require 'rails_helper' -RSpec.describe GroupAffinity, type: :model do +RSpec.describe GroupAffinity do + subject(:affinity) { build(:group_affinity, group_a:, group_b:) } + let(:wedding) { create(:wedding) } let(:group_a) { create(:group, wedding:) } let(:group_b) { create(:group, wedding:) } let(:group_c) { create(:group, wedding:) } - subject { build(:group_affinity, group_a:, group_b: ) } - describe 'validations' do - it { should validate_numericality_of(:discomfort).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(2) } + it do + expect(affinity).to validate_numericality_of(:discomfort) + .is_greater_than_or_equal_to(0) + .is_less_than_or_equal_to(2) + end end describe '.create' do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 10102f4..1bf6ae3 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Group, type: :model do +RSpec.describe Group do describe 'callbacks' do - it 'should set color before create' do + it 'sets color before create' do expect(create(:group).color).to be_present end end diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 6786271..711e5ca 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,12 +1,17 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Guest, type: :model do +RSpec.describe Guest do describe 'validations' do - it { should validate_presence_of(:name) } + subject(:guest) { build(:guest) } + + it { is_expected.to validate_presence_of(:name) } + it do - should define_enum_for(:status).with_values( + expect(guest).to define_enum_for(:status).with_values( considered: 0, invited: 10, confirmed: 20, @@ -16,7 +21,7 @@ RSpec.describe Guest, type: :model do end end - it { should belong_to(:group).optional } + it { is_expected.to belong_to(:group).optional } describe 'scopes' do describe '.potential' do @@ -27,7 +32,7 @@ RSpec.describe Guest, type: :model do confirmed_guest = create(:guest, status: :confirmed) tentative_guest = create(:guest, status: :tentative) - expect(Guest.potential).to match_array([invited_guest, confirmed_guest, tentative_guest]) + expect(described_class.potential).to contain_exactly(invited_guest, confirmed_guest, tentative_guest) end end end diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 2020f33..86140a2 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Seat, type: :model do +RSpec.describe Seat do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 4db0859..66e61ac 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe TablesArrangement, type: :model do +RSpec.describe TablesArrangement do describe 'callbacks' do it 'assigns a name before creation' do expect(create(:tables_arrangement).name).to be_present diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0277d58..ae4a2d5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe User, type: :model do +RSpec.describe User do pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 6ec8a3e..5664367 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,22 +1,25 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' -RSpec.describe Wedding, type: :model do +RSpec.describe Wedding do describe 'validations' do subject { build(:wedding) } - describe 'slug' do - it { should allow_value('foo').for(:slug) } - it { should allow_value('foo-bar').for(:slug) } - it { should allow_value('foo-123').for(:slug) } - it { should allow_value('foo-123-').for(:slug) } - it { should allow_value('foo--123').for(:slug) } - it { should_not allow_value('Foo').for(:slug) } - it { should_not allow_value('/foo').for(:slug) } - it { should_not allow_value('foo/123').for(:slug) } - it { should_not allow_value('foo_123').for(:slug) } - it { should_not allow_value('foo/').for(:slug) } + describe 'slug' do + it { is_expected.to allow_value('foo').for(:slug) } + it { is_expected.to allow_value('foo-bar').for(:slug) } + it { is_expected.to allow_value('foo-123').for(:slug) } + it { is_expected.to allow_value('foo-123-').for(:slug) } + it { is_expected.to allow_value('foo--123').for(:slug) } + + it { is_expected.not_to allow_value('Foo').for(:slug) } + it { is_expected.not_to allow_value('/foo').for(:slug) } + it { is_expected.not_to allow_value('foo/123').for(:slug) } + it { is_expected.not_to allow_value('foo_123').for(:slug) } + it { is_expected.not_to allow_value('foo/').for(:slug) } end end end From 82f17056be4b63c537720003ef6ff1b692d51de5 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:28:16 +0100 Subject: [PATCH 07/25] Run rubocop autocorrect on factory files --- spec/factories/expense.rb | 31 +++++++++++++++-------------- spec/factories/group_affinities.rb | 6 ++++-- spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 3 ++- spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ 7 files changed, 30 insertions(+), 18 deletions(-) diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index 726d94d..d2db7cd 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,19 +1,20 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do - factory :expense do - wedding - sequence(:name) { |i| "Expense #{i}" } - pricing_type { "fixed" } - amount { 100 } - end - - trait :fixed do - pricing_type { "fixed" } - end - - trait :per_person do - pricing_type { "per_person" } - end + factory :expense do + wedding + sequence(:name) { |i| "Expense #{i}" } + pricing_type { 'fixed' } + amount { 100 } end - \ No newline at end of file + + trait :fixed do + pricing_type { 'fixed' } + end + + trait :per_person do + pricing_type { 'per_person' } + end +end diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index bc57226..217f2a9 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do factory :group_affinity do - association :group_a, factory: :group - association :group_b, factory: :group + group_a factory: %i[group] + group_b factory: %i[group] discomfort { GroupAffinity::NEUTRAL } end end diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index ccd1156..659b125 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 28f3b80..5a81e22 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index 693e68a..e91e807 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do @@ -5,4 +7,3 @@ FactoryBot.define do wedding end end - \ No newline at end of file diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 2aa8a37..fd61bfa 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 5a765a1..14f7d96 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo FactoryBot.define do From c7b9c83f37c6da967f4341480304d3196a372b47 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 16:31:27 +0000 Subject: [PATCH 08/25] Add copyright notice --- spec/factories/expense.rb | 2 ++ spec/factories/group_affinities.rb | 2 ++ spec/factories/groups.rb | 2 ++ spec/factories/guest.rb | 2 ++ spec/factories/table_arrangement.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/factories/weddings.rb | 2 ++ spec/models/expense_spec.rb | 2 ++ spec/models/group_spec.rb | 2 ++ spec/models/guest_spec.rb | 2 ++ spec/models/seat_spec.rb | 2 ++ spec/models/tables_arrangement_spec.rb | 2 ++ spec/models/user_spec.rb | 2 ++ spec/models/wedding_spec.rb | 2 ++ 14 files changed, 28 insertions(+) diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index d2db7cd..f794723 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index 217f2a9..de2069e 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 659b125..3b73bdb 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 5a81e22..5fe1ad7 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index e91e807..fd48313 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/users.rb b/spec/factories/users.rb index fd61bfa..69b6b6e 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 14f7d96..70f947a 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index d6d5f89..6858913 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 1bf6ae3..2dbbe0b 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 711e5ca..30b927e 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 86140a2..8d77e35 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 66e61ac..653fe66 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ae4a2d5..e5bbef4 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 5664367..5840b0a 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,3 +1,5 @@ +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true # Copyright (C) 2024 Manuel Bustillo From b85e2ef93269bdaa4a8c2282637135da3b60b41b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:30:55 +0100 Subject: [PATCH 09/25] Run Rubocop autocorrect on spec/extensions --- spec/extensions/tree_spec.rb | 44 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 6629197..328158d 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -5,66 +7,66 @@ require 'rails_helper' module Tree RSpec.describe TreeNode do describe '#distance_to_common_ancestor' do - def assert_distance(node_1, node_2, distance) + def assert_distance(node1, node2, distance) aggregate_failures do - expect(node_1.distance_to_common_ancestor(node_2)).to eq(distance) - expect(node_2.distance_to_common_ancestor(node_1)).to eq(distance) + expect(node1.distance_to_common_ancestor(node2)).to eq(distance) + expect(node2.distance_to_common_ancestor(node1)).to eq(distance) end end context 'when the two nodes are the same' do it 'returns 0 when comparing the root itself' do - root = Tree::TreeNode.new('root') + root = described_class.new('root') assert_distance(root, root, 0) end it 'returns 0 when comparing a child to itself' do - root = Tree::TreeNode.new('root') - child = root << Tree::TreeNode.new('child') + root = described_class.new('root') + child = root << described_class.new('child') assert_distance(child, child, 0) end end context 'when the two nodes are siblings' do it 'returns 1 when comparing siblings' do - root = Tree::TreeNode.new('root') - child1 = root << Tree::TreeNode.new('child1') - child2 = root << Tree::TreeNode.new('child2') + root = described_class.new('root') + child1 = root << described_class.new('child1') + child2 = root << described_class.new('child2') assert_distance(child1, child2, 1) end end context 'when one node is parent of the other' do it 'returns 1 when comparing parent to child' do - root = Tree::TreeNode.new('root') - child = root << Tree::TreeNode.new('child') + root = described_class.new('root') + child = root << described_class.new('child') assert_distance(root, child, 1) end end context 'when one node is grandparent of the other' do it 'returns 2 when comparing grandparent to grandchild' do - root = Tree::TreeNode.new('root') - child = root << Tree::TreeNode.new('child') - grandchild = child << Tree::TreeNode.new('grandchild') + root = described_class.new('root') + child = root << described_class.new('child') + grandchild = child << described_class.new('grandchild') assert_distance(root, grandchild, 2) end end context 'when the two nodes are cousins' do it 'returns 2 when comparing cousins' do - root = Tree::TreeNode.new('root') - child1 = root << Tree::TreeNode.new('child1') - child2 = root << Tree::TreeNode.new('child2') - grandchild1 = child1 << Tree::TreeNode.new('grandchild1') - grandchild2 = child2 << Tree::TreeNode.new('grandchild2') + root = described_class.new('root') + child1 = root << described_class.new('child1') + child2 = root << described_class.new('child2') + grandchild1 = child1 << described_class.new('grandchild1') + grandchild2 = child2 << described_class.new('grandchild2') assert_distance(grandchild1, grandchild2, 2) end end context 'when the two nodes are not related' do it 'returns nil' do - root = Tree::TreeNode.new('root') - another_root = Tree::TreeNode.new('another_root') + root = described_class.new('root') + another_root = described_class.new('another_root') assert_distance(root, another_root, nil) end end From 27c7feebeecdc34b20b50527a9b8b93a1a408665 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:36:06 +0100 Subject: [PATCH 10/25] Run Rubocop autocorrect on spec/queries --- .rubocop.yml | 2 +- spec/queries/expenses/total_query_spec.rb | 6 ++++-- spec/queries/groups/summary_query_spec.rb | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3ec2fa4..ed6bf9a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,4 +14,4 @@ AllCops: Layout/LineLength: Max: 120 RSpec/ExampleLength: - Max: 10 \ No newline at end of file + Max: 30 \ No newline at end of file diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index f721844..371dc1a 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -61,8 +63,8 @@ module Expenses end it 'returns the sum of fixed and variable expenses', :aggregate_failures do - expect(response['total_confirmed']).to eq(100 + 200 + 50 * 2) - expect(response['total_projected']).to eq(100 + 200 + 11 * 50) + expect(response['total_confirmed']).to eq(100 + 200 + (50 * 2)) + expect(response['total_projected']).to eq(100 + 200 + (11 * 50)) expect(response['confirmed_guests']).to eq(2) expect(response['projected_guests']).to eq(2 + 4 + 5) end diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 6e2c3d2..0aa1490 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -5,7 +7,7 @@ require 'rails_helper' module Groups RSpec.describe SummaryQuery do describe '#call' do - subject { described_class.new.call } + subject(:result) { described_class.new.call } context 'when there are no groups' do it { is_expected.to eq([]) } @@ -17,7 +19,7 @@ module Groups context 'when there are no guests' do it 'returns the summary of groups' do - is_expected.to contain_exactly( + expect(result).to contain_exactly( { 'id' => parent.id, 'name' => 'Friends', 'icon' => 'icon-1', @@ -58,11 +60,11 @@ module Groups create_list(:guest, 8, group: child, status: :invited) create_list(:guest, 9, group: child, status: :confirmed) create_list(:guest, 10, group: child, status: :declined) - create_list(:guest, 11, group: child, status: :tentative) + create_list(:guest, 11, group: child, status: :tentative) # rubocop:disable FactoryBot/ExcessiveCreateList end it 'returns the summary of groups' do - is_expected.to contain_exactly( + expect(result).to contain_exactly( { 'id' => parent.id, 'name' => 'Friends', From c15d0806a80806ff73f81572b80cf4710841194b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 17:49:00 +0100 Subject: [PATCH 11/25] Add exception to some Rubocop offenses --- spec/requests/schemas.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index eb51216..066405e 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Swagger @@ -7,13 +9,13 @@ module Swagger email: { type: :string, format: :email }, created_at: SwaggerResponseHelper::TIMESTAMP, updated_at: SwaggerResponseHelper::TIMESTAMP - } + }.freeze - ID = { + ID = { # rubocop:disable Style/MutableConstant -- rswag modifies in: :path parameters name: 'id', in: :path, type: :string, - format: :uuid, + format: :uuid } GROUP = { @@ -21,18 +23,18 @@ module Swagger icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, parent_id: { type: :string, format: :uuid }, color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' } - } + }.freeze EXPENSE = { name: { type: :string }, amount: { type: :number, minimum: 0 }, pricing_type: { type: :string, enum: Expense.pricing_types.keys } - } + }.freeze - SLUG = { + SLUG = { # rubocop:disable Style/MutableConstant -- rswag modifies in: :path parameters name: 'slug', in: :path, - type: :string, + type: :string, pattern: Wedding::SLUG_REGEX, example: :default, description: 'Wedding slug' @@ -47,6 +49,6 @@ module Swagger answer: { type: :string } } } - } + }.freeze end -end \ No newline at end of file +end From 2fc8a6340beacfae99a5f54b09c7b0a857dcd826 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:07:22 +0100 Subject: [PATCH 12/25] Run Rubocop autocorrect on spec/ --- .rubocop.yml | 6 +- spec/rails_helper.rb | 4 +- spec/requests/affinities_spec.rb | 4 +- spec/requests/captcha_spec.rb | 17 ++-- spec/requests/expenses_spec.rb | 18 ++-- spec/requests/groups_spec.rb | 52 +++++----- spec/requests/guests_spec.rb | 18 ++-- spec/requests/summary_spec.rb | 4 +- spec/requests/tables_arrangements_spec.rb | 4 +- spec/requests/tokens_spec.rb | 14 +-- spec/requests/users/confirmations_spec.rb | 7 +- spec/requests/users/registrations_spec.rb | 11 ++- spec/requests/users/sessions_spec.rb | 8 +- .../tables/discomfort_calculator_spec.rb | 12 ++- spec/services/tables/distribution_spec.rb | 12 ++- spec/services/tables/shift_spec.rb | 4 +- spec/services/tables/swap_spec.rb | 4 +- spec/services/vns/engine_spec.rb | 2 + spec/spec_helper.rb | 94 +++++++++---------- spec/swagger_helper.rb | 6 +- spec/swagger_response_helper.rb | 27 +++--- 21 files changed, 175 insertions(+), 153 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ed6bf9a..b62b4ea 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,4 +14,8 @@ AllCops: Layout/LineLength: Max: 120 RSpec/ExampleLength: - Max: 30 \ No newline at end of file + Enabled: false +Metrics/ModuleLength: + Enabled: false +RSpec/MultipleMemoizedHelpers: + Enabled: false \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index fa81db3..a68d8b3 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # This file is copied to spec/ when you run 'rails generate rspec:install' @@ -5,7 +7,7 @@ require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' # Prevent database truncation if the environment is production -abort("The Rails environment is running in production mode!") if Rails.env.production? +abort('The Rails environment is running in production mode!') if Rails.env.production? require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! diff --git a/spec/requests/affinities_spec.rb b/spec/requests/affinities_spec.rb index 6e113d2..c964018 100644 --- a/spec/requests/affinities_spec.rb +++ b/spec/requests/affinities_spec.rb @@ -4,7 +4,7 @@ require 'swagger_helper' -RSpec.describe 'affinities', type: :request do +RSpec.describe 'affinities' do path '/{slug}/groups/{group_id}/affinities' do parameter Swagger::Schema::SLUG parameter name: 'group_id', in: :path, type: :string, format: :uuid, description: 'group_id' @@ -46,7 +46,7 @@ RSpec.describe 'affinities', type: :request do } } - response_empty_200 + response_empty200 end end end diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 607a2d9..4441304 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,22 +1,23 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'captcha', type: :request do +RSpec.describe 'captcha' do path '/captcha' do - post('create a CAPTCHA challenge') do tags 'CAPTCHA' consumes 'application/json' produces 'application/json' - + response(201, 'created') do schema type: :object, - required: %i[id], - properties: { - id: { type: :string, format: :uuid }, - media_url: { type: :string, format: :uri }, - } + required: %i[id], + properties: { + id: { type: :string, format: :uuid }, + media_url: { type: :string, format: :uri } + } xit end end diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 068fec5..4bfa22f 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'expenses', type: :request do +RSpec.describe 'expenses' do path '/{slug}/expenses' do get('list expenses') do tags 'Expenses' @@ -42,8 +44,8 @@ RSpec.describe 'expenses', type: :request do } } - response_empty_201 - response_422 + response_empty201 + response422 regular_api_responses end end @@ -60,9 +62,9 @@ RSpec.describe 'expenses', type: :request do properties: Swagger::Schema::EXPENSE } - response_empty_200 - response_422 - response_404 + response_empty200 + response422 + response404 regular_api_responses end @@ -71,8 +73,8 @@ RSpec.describe 'expenses', type: :request do produces 'application/json' parameter Swagger::Schema::SLUG parameter Swagger::Schema::ID - response_empty_200 - response_404 + response_empty200 + response404 regular_api_responses end end diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index bc6267b..3496ad5 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'groups', type: :request do +RSpec.describe 'groups' do path '/{slug}/groups' do get('list groups') do tags 'Groups' @@ -10,29 +12,29 @@ RSpec.describe 'groups', type: :request do parameter Swagger::Schema::SLUG response(200, 'successful') do schema type: :array, - items: { - type: :object, - required: %i[id name icon parent_id color attendance], - properties: { - id: { type: :string, format: :uuid, required: true }, - name: { type: :string }, - icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, - parent_id: { type: :string, format: :uuid }, - color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, - attendance: { - type: :object, - required: %i[total considered invited confirmed declined tentative], - properties: { - total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, - considered: { type: :integer, minimum: 0 }, - invited: { type: :integer, minimum: 0 }, - confirmed: { type: :integer, minimum: 0 }, - declined: { type: :integer, minimum: 0 }, - tentative: { type: :integer, minimum: 0 } - } - } - } + items: { + type: :object, + required: %i[id name icon parent_id color attendance], + properties: { + id: { type: :string, format: :uuid, required: true }, + name: { type: :string }, + icon: { type: :string, example: 'pi pi-crown', description: 'The CSS classes used by the icon' }, + parent_id: { type: :string, format: :uuid }, + color: { type: :string, pattern: '^#(?:[0-9a-fA-F]{3}){1,2}$' }, + attendance: { + type: :object, + required: %i[total considered invited confirmed declined tentative], + properties: { + total: { type: :integer, minimum: 0, description: 'Total number of guests in any status' }, + considered: { type: :integer, minimum: 0 }, + invited: { type: :integer, minimum: 0 }, + confirmed: { type: :integer, minimum: 0 }, + declined: { type: :integer, minimum: 0 }, + tentative: { type: :integer, minimum: 0 } + } + } } + } xit end regular_api_responses @@ -99,8 +101,8 @@ RSpec.describe 'groups', type: :request do produces 'application/json' parameter Swagger::Schema::SLUG parameter name: :id, in: :path, type: :string, format: :uuid - - response_empty_200 + + response_empty200 regular_api_responses end end diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index bc73fbe..cd52ca0 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'guests', type: :request do +RSpec.describe 'guests' do path '/{slug}/guests' do get('list guests') do tags 'Guests' @@ -51,8 +53,8 @@ RSpec.describe 'guests', type: :request do } } - response_empty_201 - response_422 + response_empty201 + response422 regular_api_responses end end @@ -80,9 +82,9 @@ RSpec.describe 'guests', type: :request do } } - response_empty_200 - response_422 - response_404 + response_empty200 + response422 + response404 regular_api_responses end @@ -92,8 +94,8 @@ RSpec.describe 'guests', type: :request do parameter Swagger::Schema::SLUG parameter name: 'id', in: :path, type: :string, format: :uuid - response_empty_200 - response_404 + response_empty200 + response404 regular_api_responses end end diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 2b77892..569e4b9 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'summary', type: :request do +RSpec.describe 'summary' do path '/{slug}/summary' do get('list summaries') do tags 'Summary' diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index c48c127..eb4c9cd 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'tables_arrangements', type: :request do +RSpec.describe 'tables_arrangements' do path '/{slug}/tables_arrangements' do get('list tables arrangements') do tags 'Tables Arrangements' diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 5a08e05..077543d 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,15 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' - -RSpec.describe 'tokens', type: :request do - path '/token' do - get('get a cookie with CSRF token') do - tags 'CSRF token' - consumes 'application/json' - produces 'application/json' - - response_empty_200 - end - end -end diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 12bdfbc..88dd707 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'users/confirmations', type: :request do - +RSpec.describe 'users/confirmations' do path '/{slug}/users/confirmation' do get('confirm user email') do tags 'Users' @@ -17,7 +18,7 @@ RSpec.describe 'users/confirmations', type: :request do xit end - response_422 + response422 end end end diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index 2cbaeea..ac423c1 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,25 +1,26 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'users/registrations', type: :request do - +RSpec.describe 'users/registrations' do path '/{slug}/users' do post('create registration') do tags 'Users Registrations' consumes 'application/json' produces 'application/json' - + parameter Swagger::Schema::SLUG parameter name: :body, in: :body, schema: { type: :object, - required: [:user, :wedding], + required: %i[user wedding], properties: { user: { type: :object, required: %i[email password password_confirmation], properties: { - email: { type: :string, format: :email}, + email: { type: :string, format: :email }, password: SwaggerResponseHelper::PASSWORD, password_confirmation: SwaggerResponseHelper::PASSWORD } diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index a803965..1553aed 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,11 +1,11 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' -RSpec.describe 'users/sessions', type: :request do - +RSpec.describe 'users/sessions' do path '/{slug}/users/sign_in' do - post('create session') do tags 'Users Sessions' consumes 'application/json' @@ -32,7 +32,7 @@ RSpec.describe 'users/sessions', type: :request do xit end - response_401(message: 'Invalid Email or password.') + response401(message: 'Invalid Email or password.') end end diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index f5da2d1..a4eea1d 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -12,8 +14,7 @@ module Tables describe '#calculate' do before do - allow(calculator).to receive(:table_size_penalty).and_return(2) - allow(calculator).to receive(:cohesion_discomfort).and_return(3) + allow(calculator).to receive_messages(table_size_penalty: 2, cohesion_discomfort: 3) end let(:table) { Table.new(create_list(:guest, 6)) } @@ -29,6 +30,7 @@ module Tables table.min_per_table = 5 table.max_per_table = 7 end + context 'when the number of guests is in the lower bound' do let(:table) { Table.new(create_list(:guest, 5)) } @@ -88,6 +90,7 @@ module Tables allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(friends.id, school.id).and_return(4) allow(AffinityGroupsHierarchy.instance).to receive(:distance).with(work.id, school.id).and_return(5) end + context 'when the table contains just two guests' do context 'when they belong to the same group' do let(:table) { create_list(:guest, 2, group: family) } @@ -102,6 +105,7 @@ module Tables create(:guest, group: friends) ] end + it { expect(calculator.send(:cohesion_discomfort)).to eq(1) } end @@ -205,7 +209,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(4 * 1 + 4 * Rational(1, 2) + 4 * Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq((4 * 1) + (4 * Rational(1, 2)) + (4 * Rational(2, 3))) end end @@ -219,7 +223,7 @@ module Tables end it 'returns the sum of the penalties for each pair of guests' do - expect(calculator.send(:cohesion_discomfort)).to eq(6 * 1 + 2 * Rational(1, 2) + 3 * Rational(2, 3)) + expect(calculator.send(:cohesion_discomfort)).to eq((6 * 1) + (2 * Rational(1, 2)) + (3 * Rational(2, 3))) end end end diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index df88a85..26834c0 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -5,19 +7,19 @@ require 'rails_helper' module Tables RSpec.describe Distribution do describe '#random_distribution' do - let(:subject) { described_class.new(min_per_table: 5, max_per_table: 10) } + subject(:distribution) { described_class.new(min_per_table: 5, max_per_table: 10) } context 'when there are fewer people than the minimum per table' do it 'creates one table' do - subject.random_distribution([1, 2, 3, 4]) - expect(subject.tables.count).to eq(1) + distribution.random_distribution([1, 2, 3, 4]) + expect(distribution.tables.count).to eq(1) end end context 'when there are more people than the maximum per table' do it 'creates multiple tables' do - subject.random_distribution([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) - expect(subject.tables.count).to be > 1 + distribution.random_distribution([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) + expect(distribution.tables.count).to be > 1 end end end diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index e4c48af..08b2ca1 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -7,7 +9,7 @@ module Tables describe '#each' do let(:shifts) do acc = [] - described_class.new(initial_solution).each do |solution| + described_class.new(initial_solution).each do |solution| # rubocop:disable Style/MapIntoArray -- #map is not implemented acc << solution.tables.map(&:dup) end acc diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 159d998..067d4bc 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' @@ -7,7 +9,7 @@ module Tables describe '#each' do let(:swaps) do acc = [] - described_class.new(initial_solution).each do |solution| + described_class.new(initial_solution).each do |solution| # rubocop:disable Style/MapIntoArray -- #map is not implemented acc << solution.tables.map(&:dup) end acc diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index d4064f6..b7ff9a5 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'rails_helper' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 25cfd37..b2f85ad 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # This file was generated by the `rails generate rspec:install` command. Conventionally, all @@ -46,51 +48,49 @@ RSpec.configure do |config| # triggering implicit auto-inclusion in groups with matching metadata. config.shared_context_metadata_behavior = :apply_to_host_groups -# The settings below are suggested to provide a good initial experience -# with RSpec, but feel free to customize to your heart's content. -=begin - # This allows you to limit a spec run to individual examples or groups - # you care about by tagging them with `:focus` metadata. When nothing - # is tagged with `:focus`, all examples get run. RSpec also provides - # aliases for `it`, `describe`, and `context` that include `:focus` - # metadata: `fit`, `fdescribe` and `fcontext`, respectively. - config.filter_run_when_matching :focus - - # Allows RSpec to persist some state between runs in order to support - # the `--only-failures` and `--next-failure` CLI options. We recommend - # you configure your source control system to ignore this file. - config.example_status_persistence_file_path = "spec/examples.txt" - - # Limits the available syntax to the non-monkey patched syntax that is - # recommended. For more details, see: - # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ - config.disable_monkey_patching! - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = "doc" - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed -=end + # The settings below are suggested to provide a good initial experience + # with RSpec, but feel free to customize to your heart's content. + # # This allows you to limit a spec run to individual examples or groups + # # you care about by tagging them with `:focus` metadata. When nothing + # # is tagged with `:focus`, all examples get run. RSpec also provides + # # aliases for `it`, `describe`, and `context` that include `:focus` + # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + # config.filter_run_when_matching :focus + # + # # Allows RSpec to persist some state between runs in order to support + # # the `--only-failures` and `--next-failure` CLI options. We recommend + # # you configure your source control system to ignore this file. + # config.example_status_persistence_file_path = "spec/examples.txt" + # + # # Limits the available syntax to the non-monkey patched syntax that is + # # recommended. For more details, see: + # # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ + # config.disable_monkey_patching! + # + # # Many RSpec users commonly either run the entire suite or an individual + # # file, and it's useful to allow more verbose output when running an + # # individual spec file. + # if config.files_to_run.one? + # # Use the documentation formatter for detailed output, + # # unless a formatter has already been configured + # # (e.g. via a command-line flag). + # config.default_formatter = "doc" + # end + # + # # Print the 10 slowest examples and example groups at the + # # end of the spec run, to help surface which specs are running + # # particularly slow. + # config.profile_examples = 10 + # + # # Run specs in random order to surface order dependencies. If you find an + # # order dependency and want to debug it, you can fix the order by providing + # # the seed, which is printed after each run. + # # --seed 1234 + # config.order = :random + # + # # Seed global randomization in this process using the `--seed` CLI option. + # # Setting this allows you to use `--seed` to deterministically reproduce + # # test failures related to randomization by passing the same `--seed` value + # # as the one that triggered the failure. + # Kernel.srand config.seed end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 2b19be8..2c53057 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -3,10 +3,10 @@ # frozen_string_literal: true require 'rails_helper' -require_relative './swagger_response_helper' -require_relative './requests/schemas.rb' +require_relative 'swagger_response_helper' +require_relative 'requests/schemas' -include SwaggerResponseHelper +include SwaggerResponseHelper # rubocop:disable Style/MixinUsage RSpec.configure do |config| # Specify a root folder where Swagger JSON files are generated diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index d7f2e0e..424818a 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,18 +1,19 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module SwaggerResponseHelper TIMESTAMP_FORMAT = '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z' TIMESTAMP_EXAMPLE = Time.zone.now.iso8601(3) - TIMESTAMP = {type: :string,pattern: TIMESTAMP_FORMAT,example: TIMESTAMP_EXAMPLE}.freeze - PASSWORD = { type: :string, minLength: User.password_length.begin, maxLength: User.password_length.end } - + TIMESTAMP = { type: :string, pattern: TIMESTAMP_FORMAT, example: TIMESTAMP_EXAMPLE }.freeze + PASSWORD = { type: :string, minLength: User.password_length.begin, maxLength: User.password_length.end }.freeze def regular_api_responses - response_401 + response401 end - def response_422 + def response422 response(422, 'Validation errors in input parameters') do produces 'application/json' error_schema @@ -20,7 +21,7 @@ module SwaggerResponseHelper end end - def response_empty_200 + def response_empty200 response(200, 'Success') do produces 'application/json' schema type: :object @@ -28,7 +29,7 @@ module SwaggerResponseHelper end end - def response_empty_201 + def response_empty201 response(201, 'Created') do produces 'application/json' schema type: :object @@ -36,7 +37,7 @@ module SwaggerResponseHelper end end - def response_404 + def response404 response(404, 'Record not found') do produces 'application/json' error_schema @@ -44,14 +45,14 @@ module SwaggerResponseHelper end end - def response_401(message: nil) + def response401(message: nil) response(401, 'Unauthorized') do produces 'application/json' schema type: :object, - required: %i[error], - properties: { - error: { type: :string, example: message || 'You need to sign in or sign up before continuing.' } - } + required: %i[error], + properties: { + error: { type: :string, example: message || 'You need to sign in or sign up before continuing.' } + } xit end end From 19dcb551fa771399f78086e57e05f34435b40305 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:13:57 +0100 Subject: [PATCH 13/25] Run Rubocop autocorrect on app/models --- .rubocop.yml | 2 ++ app/models/application_record.rb | 2 ++ app/models/expense.rb | 2 ++ app/models/group.rb | 19 +++++++++++++------ app/models/group_affinity.rb | 5 ++++- app/models/guest.rb | 4 +++- app/models/seat.rb | 2 ++ app/models/tables_arrangement.rb | 4 +++- app/models/user.rb | 2 ++ app/models/wedding.rb | 2 ++ 10 files changed, 35 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b62b4ea..049b22d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,4 +18,6 @@ RSpec/ExampleLength: Metrics/ModuleLength: Enabled: false RSpec/MultipleMemoizedHelpers: + Enabled: false +Style/Documentation: Enabled: false \ No newline at end of file diff --git a/app/models/application_record.rb b/app/models/application_record.rb index e93781d..60a445b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationRecord < ActiveRecord::Base diff --git a/app/models/expense.rb b/app/models/expense.rb index 5601c30..5be0315 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information diff --git a/app/models/group.rb b/app/models/group.rb index 6552214..0a2c62a 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -31,7 +33,7 @@ class Group < ApplicationRecord validates :name, uniqueness: true validates :name, :order, presence: true - has_many :children, class_name: 'Group', foreign_key: 'parent_id' + has_many :children, class_name: 'Group', foreign_key: 'parent_id', dependent: :nullify, inverse_of: :parent belongs_to :parent, class_name: 'Group', optional: true before_create :set_color @@ -41,10 +43,7 @@ class Group < ApplicationRecord has_many :guests, dependent: :nullify def colorize_children(generation = 1) - derived_colors = generation == 1 ? color.paint.palette.analogous(size: children.count) : color.paint.palette.decreasing_saturation - - children.zip(derived_colors) do |child, raw_color| - + children.zip(palette(generation)) do |child, raw_color| final_color = raw_color.paint final_color.brighten(60) if final_color.dark? @@ -53,13 +52,21 @@ class Group < ApplicationRecord child.colorize_children(generation + 1) end end - + def affinities GroupAffinity.where(group_a_id: id).or(GroupAffinity.where(group_b_id: id)) end private + def palette(generation) + if generation == 1 + color.paint.palette.analogous(size: children.count) + else + color.paint.palette.decreasing_saturation + end + end + def set_color return if color.present? diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index 31e1503..d203589 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -30,7 +32,8 @@ class GroupAffinity < ApplicationRecord belongs_to :group_a, class_name: 'Group' belongs_to :group_b, class_name: 'Group' - validates :discomfort, numericality: { greater_than_or_equal_to: MIN_DISCOMFORT, less_than_or_equal_to: MAX_DISCOMFORT } + validates :discomfort, + numericality: { greater_than_or_equal_to: MIN_DISCOMFORT, less_than_or_equal_to: MAX_DISCOMFORT } def another_group(group) return nil if group != group_a && group != group_b diff --git a/app/models/guest.rb b/app/models/guest.rb index a0a2992..ed5254e 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -39,8 +41,8 @@ class Guest < ApplicationRecord scope :potential, -> { where.not(status: %i[declined considered]) } - after_save :recalculate_simulations, if: :saved_change_to_status? after_destroy :recalculate_simulations + after_save :recalculate_simulations, if: :saved_change_to_status? has_many :seats, dependent: :delete_all diff --git a/app/models/seat.rb b/app/models/seat.rb index 3f13629..c4dcefe 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 3080e49..2e11c3a 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information @@ -21,7 +23,7 @@ # class TablesArrangement < ApplicationRecord acts_as_tenant :wedding - has_many :seats + has_many :seats, dependent: :delete_all has_many :guests, through: :seats before_create :assign_name diff --git a/app/models/user.rb b/app/models/user.rb index 43c3a9e..80cbf28 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information diff --git a/app/models/wedding.rb b/app/models/wedding.rb index 125c58e..da4a50c 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo # == Schema Information From fbc6926402bad4368af16b8757be729799c16ecb Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:16:36 +0100 Subject: [PATCH 14/25] Run Rubocop autocorrect on app/queries --- app/queries/expenses/total_query.rb | 8 +++++--- app/queries/groups/summary_query.rb | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 7dc47d6..81feea7 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Expenses @@ -16,7 +18,7 @@ module Expenses private def query - <<~SQL + <<~SQL.squish WITH guest_count AS (#{guest_count_per_status}), expense_summary AS (#{expense_summary}) SELECT guest_count.confirmed as confirmed_guests, @@ -28,7 +30,7 @@ module Expenses end def expense_summary - <<~SQL + <<~SQL.squish SELECT coalesce(sum(amount) filter (where pricing_type = 'fixed'), 0) as fixed, coalesce(sum(amount) filter (where pricing_type = 'per_person'), 0) as variable FROM expenses @@ -37,7 +39,7 @@ module Expenses end def guest_count_per_status - <<~SQL + <<~SQL.squish SELECT COALESCE(count(*) filter(where status = #{Guest.statuses['confirmed']}), 0) as confirmed, COALESCE(count(*) filter(where status IN (#{Guest.statuses.values_at('confirmed', 'invited', 'tentative').join(',')})), 0) as projected FROM guests diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 0736496..595b6e1 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Groups @@ -9,13 +11,21 @@ module Groups :icon, :parent_id, :color, + *count_expressions + ) + end + + private + + def count_expressions + [ Arel.sql('count(*) filter (where status IS NOT NULL) as total'), Arel.sql('count(*) filter (where status = 0) as considered'), Arel.sql('count(*) filter (where status = 10) as invited'), Arel.sql('count(*) filter (where status = 20) as confirmed'), Arel.sql('count(*) filter (where status = 30) as declined'), - Arel.sql('count(*) filter (where status = 40) as tentative'), - ) + Arel.sql('count(*) filter (where status = 40) as tentative') + ] end end end From 02fcd03b0e31df1e5013650203389e016876eea7 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:19:58 +0100 Subject: [PATCH 15/25] Run Rubocop autocorrect on app/services --- .rubocop.yml | 6 +++++ app/controllers/captcha_controller.rb | 4 ++- app/services/affinity_groups_hierarchy.rb | 2 ++ app/services/libre_captcha.rb | 26 ++++++++++---------- app/services/tables/discomfort_calculator.rb | 3 +++ app/services/tables/distribution.rb | 2 ++ app/services/tables/shift.rb | 2 ++ app/services/tables/swap.rb | 2 ++ app/services/tables/table.rb | 2 ++ app/services/vns/engine.rb | 2 ++ 10 files changed, 37 insertions(+), 14 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 049b22d..ff07d58 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,4 +20,10 @@ Metrics/ModuleLength: RSpec/MultipleMemoizedHelpers: Enabled: false Style/Documentation: + Enabled: false +Metrics/MethodLength: + Max: 20 +Rails/SkipsModelValidations: + Enabled: false +Metrics/AbcSize: Enabled: false \ No newline at end of file diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 351b324..77010bd 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class CaptchaController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant def create - id = LibreCaptcha.new.get_id + id = LibreCaptcha.new.id render json: { id:, media_url: media_captcha_index_url(id:) diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index e20de97..3e15551 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class AffinityGroupsHierarchy < Array diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index 8684e9f..cfd8028 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,20 +1,20 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class LibreCaptcha - def get_id - HTTParty.post("http://libre-captcha:8888/v2/captcha", - body: { - input_type: "text", - level: :hard, - media: 'image/png', - size: '350x100' - }.to_json - ).then { |raw| JSON.parse(raw)['id'] } + def id + HTTParty.post('http://libre-captcha:8888/v2/captcha', + body: { + input_type: 'text', + level: :hard, + media: 'image/png', + size: '350x100' + }.to_json).then { |raw| JSON.parse(raw)['id'] } end def valid?(id:, answer:) - HTTParty.post("http://libre-captcha:8888/v2/answer", - body: { id:, answer: }.to_json - ).then { |raw| JSON.parse(raw)['result'] == 'True' } + HTTParty.post('http://libre-captcha:8888/v2/answer', + body: { id:, answer: }.to_json).then { |raw| JSON.parse(raw)['result'] == 'True' } end -end \ No newline at end of file +end diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index c4ef54a..df5eeb4 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables @@ -7,6 +9,7 @@ module Tables distance = AffinityGroupsHierarchy.instance.distance(id_a, id_b) return 1 if distance.nil? + Rational(distance, distance + 1) end end diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 9236007..8c8d152 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require_relative '../../extensions/tree_node_extension' diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index 6ae7c94..f3882cc 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index ae74294..e2f7b60 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 2c50435..7bec30f 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module Tables diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index ee50d45..555f7c7 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module VNS From 4fc95185fbba84343cf5985888b483c0228392b1 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:21:16 +0100 Subject: [PATCH 16/25] Run Rubocop autocorrect on app/helpers --- app/helpers/application_helper.rb | 2 ++ app/helpers/expenses_helper.rb | 2 ++ app/helpers/groups_helper.rb | 2 ++ app/helpers/guests_helper.rb | 2 ++ app/helpers/tables_arrangements_helper.rb | 2 ++ 5 files changed, 10 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5e869ad..10aa281 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ApplicationHelper diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index af8a78e..2806ac9 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ExpensesHelper diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 311c1a2..aa6ffcc 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module GroupsHelper diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index ca740f6..d381a71 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module GuestsHelper diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 637e079..1ec0aab 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module TablesArrangementsHelper From 0c7c69ee5eb0cd4099b9bde0118df63dc46f36ee Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:28:28 +0100 Subject: [PATCH 17/25] Run Rubocop autocorrect on app/controllers --- app/controllers/affinities_controller.rb | 19 ++++--- app/controllers/application_controller.rb | 8 +-- app/controllers/expenses_controller.rb | 4 +- app/controllers/groups_controller.rb | 4 +- app/controllers/guests_controller.rb | 4 +- app/controllers/summary_controller.rb | 54 ++++++++++++------- .../tables_arrangements_controller.rb | 4 +- app/controllers/tokens_controller.rb | 2 + .../users/confirmations_controller.rb | 36 +++++++------ .../users/registrations_controller.rb | 40 +++++++------- app/controllers/users/sessions_controller.rb | 12 +++-- 11 files changed, 115 insertions(+), 72 deletions(-) diff --git a/app/controllers/affinities_controller.rb b/app/controllers/affinities_controller.rb index fab690a..f8b7052 100644 --- a/app/controllers/affinities_controller.rb +++ b/app/controllers/affinities_controller.rb @@ -6,22 +6,27 @@ class AffinitiesController < ApplicationController before_action :set_group def index - overridden_affinities = @group.affinities - .each_with_object({}) { |affinity, acc| acc[affinity.another_group(@group).id] = affinity.discomfort } - Group.where.not(id: @group.id).pluck(:id).index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden_affinities[group_id] || GroupAffinity::NEUTRAL) } - .then { |affinities| render json: affinities } + overridden = @group.affinities.each_with_object({}) do |affinity, acc| + acc[affinity.another_group(@group).id] = affinity.discomfort + end + Group.where.not(id: @group.id) + .pluck(:id) + .index_with { |group_id| GroupAffinity::MAX_DISCOMFORT - (overridden[group_id] || GroupAffinity::NEUTRAL) } + .then { |affinities| render json: affinities } end def bulk_update - params.expect(affinities: [[:group_id, :affinity]]).map(&:to_h).map do |affinity| + affinities = params.expect(affinities: [%i[group_id affinity]]).map(&:to_h).map do |affinity| { group_a_id: @group.id, group_b_id: affinity[:group_id], discomfort: GroupAffinity::MAX_DISCOMFORT - affinity[:affinity] } - end.then { |affinities| GroupAffinity.upsert_all(affinities) } - render json: {}, status: :ok + end + GroupAffinity.upsert_all(affinities) + + render json: {}, status: :ok rescue ActiveRecord::InvalidForeignKey render json: { error: 'At least one of the group IDs provided does not exist.' }, status: :bad_request rescue ActiveRecord::StatementInvalid diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7cb39a8..e1bebb9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationController < ActionController::Base @@ -40,9 +42,9 @@ class ApplicationController < ActionController::Base end def captcha_params - params.expect(captcha: [:id, :answer]) + params.expect(captcha: %i[id answer]) end - + def default_url_options(options = {}) options.merge(path_params: { slug: ActsAsTenant.current_tenant&.slug }) end @@ -53,7 +55,7 @@ class ApplicationController < ActionController::Base def development_swagger? Rails.env.test? || - Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html') + (Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html')) end def set_csrf_cookie diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 2a125d9..0b86498 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ExpensesController < ApplicationController @@ -6,7 +8,7 @@ class ExpensesController < ApplicationController end def index - render json: Expense.all.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) + render json: Expense.order(pricing_type: :asc, amount: :desc).as_json(only: %i[id name amount pricing_type]) end def create diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index f53ed35..6ba61ca 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class GroupsController < ApplicationController @@ -39,6 +41,6 @@ class GroupsController < ApplicationController end def group_params - params.expect(group: [:name, :icon, :color]) + params.expect(group: %i[name icon color]) end end diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index 54975b6..e8b1cd0 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo require 'csv' class GuestsController < ApplicationController def index - render json: Guest.all.includes(:group) + render json: Guest.includes(:group) .left_joins(:group) .order('groups.name' => :asc, name: :asc) .as_json(only: %i[id name status], include: { group: { only: %i[id name] } }) diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 55983dc..0959d4d 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,29 +1,43 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class SummaryController < ApplicationController def index - expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call - guest_summary = Guest.group(:status).count render json: { - expenses: { - projected: { - total: expense_summary['total_projected'], - guests: expense_summary['projected_guests'] - }, - confirmed: { - total: expense_summary['total_confirmed'], - guests: expense_summary['confirmed_guests'] - }, - status: { - paid: 0 - } + expenses:, + guests: + } + end + + private + + def guests + guest_summary = Guest.group(:status).count + + { + total: guest_summary.except('considered').values.sum, + confirmed: guest_summary['confirmed'].to_i, + declined: guest_summary['declined'].to_i, + tentative: guest_summary['tentative'].to_i, + invited: guest_summary['invited'].to_i + } + end + + def expenses + expense_summary = Expenses::TotalQuery.new(wedding: ActsAsTenant.current_tenant).call + + { + projected: { + total: expense_summary['total_projected'], + guests: expense_summary['projected_guests'] }, - guests: { - total: guest_summary.except('considered').values.sum, - confirmed: guest_summary['confirmed'].to_i, - declined: guest_summary['declined'].to_i, - tentative: guest_summary['tentative'].to_i, - invited: guest_summary['invited'].to_i + confirmed: { + total: expense_summary['total_confirmed'], + guests: expense_summary['confirmed_guests'] + }, + status: { + paid: 0 } } end diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index 00ba8b1..c042b6c 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class TablesArrangementsController < ApplicationController def index - render json: TablesArrangement.all.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) + render json: TablesArrangement.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) end def show diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index c3dabba..58cf243 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class TokensController < ApplicationController diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 660d263..d073fef 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,23 +1,27 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo -class Users::ConfirmationsController < Devise::ConfirmationsController - clear_respond_to - respond_to :json +module Users + class ConfirmationsController < Devise::ConfirmationsController + clear_respond_to + respond_to :json - def show - super do |resource| - if resource.errors.empty? - respond_to do |format| - format.json { render json: resource, status: :ok } - format.any { redirect_to root_path } + def show + super do |resource| + if resource.errors.empty? + respond_to do |format| + format.json { render json: resource, status: :ok } + format.any { redirect_to root_path } + end + else + render json: { + message: 'Record invalid', + errors: resource.errors.full_messages + }, status: :unprocessable_entity end - else - render json: { - message: 'Record invalid', - errors: resource.errors.full_messages - }, status: :unprocessable_entity + return end - return end end -end \ No newline at end of file +end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 0aae89d..7a9560b 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,28 +1,32 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo -class Users::RegistrationsController < Devise::RegistrationsController - clear_respond_to - respond_to :json +module Users + class RegistrationsController < Devise::RegistrationsController + clear_respond_to + respond_to :json - before_action :validate_captcha!, only: :create + before_action :validate_captcha!, only: :create - def create - wedding = Wedding.create(slug: params[:slug]) - unless wedding.persisted? - render json: { errors: wedding.errors.full_messages }, status: :unprocessable_entity - return - end + def create + wedding = Wedding.create(slug: params[:slug]) + unless wedding.persisted? + render json: { errors: wedding.errors.full_messages }, status: :unprocessable_entity + return + end - ActsAsTenant.with_tenant(wedding) do - super do |user| - wedding.destroy unless user.persisted? + ActsAsTenant.with_tenant(wedding) do + super do |user| + wedding.destroy unless user.persisted? + end end end - end - private + private - def set_tenant - set_current_tenant(nil) + def set_tenant + set_current_tenant(nil) + end end -end \ No newline at end of file +end diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 0de9af5..4b7c7d6 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,6 +1,10 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo -class Users::SessionsController < Devise::SessionsController - clear_respond_to - respond_to :json -end \ No newline at end of file +module Users + class SessionsController < Devise::SessionsController + clear_respond_to + respond_to :json + end +end From b16ef1e237f6132f1391cc8d8c871394a2619139 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:30:54 +0100 Subject: [PATCH 18/25] Run Rubocop autocorrect on the rest of the project --- .rubocop.yml | 2 +- Rakefile | 4 +++- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/extensions/tree_node_extension.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/jobs/table_simulator_job.rb | 2 ++ app/mailers/application_mailer.rb | 6 ++++-- app/serializers/serializable_group.rb | 2 ++ app/serializers/serializable_guest.rb | 2 ++ config.ru | 4 +++- lib/tasks/annotate_rb.rake | 6 ++++-- 12 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ff07d58..ca1ed81 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,7 +9,7 @@ AllCops: - 'db/**/*' - 'config/**/*' - 'script/**/*' - - 'bin/{rails,rake}' + - 'bin/*' - '*.yml' Layout/LineLength: Max: 120 diff --git a/Rakefile b/Rakefile index 9a5ea73..488c551 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require_relative "config/application" +require_relative 'config/application' Rails.application.load_tasks diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 3073f1e..12b8f3d 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ApplicationCable diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 1cc97c6..02dcb5d 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module ApplicationCable diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 630b011..80104c3 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo module TreeNodeExtension diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 3498a49..438f83d 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationJob < ActiveJob::Base diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index 7cbe659..fe46a6d 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class TableSimulatorJob < ApplicationJob diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 94e1656..dc388c7 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class ApplicationMailer < ActionMailer::Base - default from: "from@example.com" - layout "mailer" + default from: 'from@example.com' + layout 'mailer' end diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index f7cc103..f0c18e9 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class SerializableGroup < JSONAPI::Serializable::Resource diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index e411307..9c34d8d 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Copyright (C) 2024 Manuel Bustillo class SerializableGuest < JSONAPI::Serializable::Resource diff --git a/config.ru b/config.ru index 4a3c09a..6dc8321 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require_relative "config/environment" +require_relative 'config/environment' run Rails.application Rails.application.load_server diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake index 1ad0ec3..e8368b2 100644 --- a/lib/tasks/annotate_rb.rake +++ b/lib/tasks/annotate_rb.rake @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # This rake task was added by annotate_rb gem. # Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this -if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil? - require "annotate_rb" +if Rails.env.development? && ENV['ANNOTATERB_SKIP_ON_DB_TASKS'].nil? + require 'annotate_rb' AnnotateRb::Core.load_rake_tasks end From cb10d50d9eb60b6c43485488dcac4e7b87629c73 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:32:46 +0100 Subject: [PATCH 19/25] Rename .github -> .gitea --- {.github => .gitea}/workflows/build.yml | 0 {.github => .gitea}/workflows/copyright_notice.yml | 0 {.github => .gitea}/workflows/license_finder.yml | 0 {.github => .gitea}/workflows/tests.yml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {.github => .gitea}/workflows/build.yml (100%) rename {.github => .gitea}/workflows/copyright_notice.yml (100%) rename {.github => .gitea}/workflows/license_finder.yml (100%) rename {.github => .gitea}/workflows/tests.yml (100%) diff --git a/.github/workflows/build.yml b/.gitea/workflows/build.yml similarity index 100% rename from .github/workflows/build.yml rename to .gitea/workflows/build.yml diff --git a/.github/workflows/copyright_notice.yml b/.gitea/workflows/copyright_notice.yml similarity index 100% rename from .github/workflows/copyright_notice.yml rename to .gitea/workflows/copyright_notice.yml diff --git a/.github/workflows/license_finder.yml b/.gitea/workflows/license_finder.yml similarity index 100% rename from .github/workflows/license_finder.yml rename to .gitea/workflows/license_finder.yml diff --git a/.github/workflows/tests.yml b/.gitea/workflows/tests.yml similarity index 100% rename from .github/workflows/tests.yml rename to .gitea/workflows/tests.yml From 20cca87cddd9d822678024919596e8ff0adaf8b2 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:35:04 +0100 Subject: [PATCH 20/25] Run rubocop checks as part of CI --- .gitea/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 36f5b06..c07776a 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Run unit tests +name: Run unit tests and Rubocop on: push: branches: @@ -24,6 +24,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: ruby/setup-ruby@v1.202.0 - run: bundle install + - run: bundle exec rubocop --force-exclusion --parallel - name: Wait until Postgres is ready to accept connections run: | apt-get update && apt-get install -f -y postgresql-client From 5f2778c97ab91e02b8fb2b8cea8cd197cdb3bea8 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:35:42 +0100 Subject: [PATCH 21/25] Restore original name --- .gitea/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index c07776a..6166ed7 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Run unit tests and Rubocop +name: Run unit tests on: push: branches: From 55e6cfcd364ec0fd24b73f71fb472c7181fa39dc Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:37:47 +0100 Subject: [PATCH 22/25] Fix order of Ruby's magic string comment and Copyright assignment --- app/channels/application_cable/channel.rb | 4 ++-- app/channels/application_cable/connection.rb | 4 ++-- app/controllers/application_controller.rb | 4 ++-- app/controllers/captcha_controller.rb | 4 ++-- app/controllers/expenses_controller.rb | 4 ++-- app/controllers/groups_controller.rb | 4 ++-- app/controllers/guests_controller.rb | 4 ++-- app/controllers/summary_controller.rb | 4 ++-- app/controllers/tables_arrangements_controller.rb | 4 ++-- app/controllers/tokens_controller.rb | 4 ++-- app/controllers/users/confirmations_controller.rb | 4 ++-- app/controllers/users/registrations_controller.rb | 4 ++-- app/controllers/users/sessions_controller.rb | 4 ++-- app/extensions/tree_node_extension.rb | 4 ++-- app/helpers/application_helper.rb | 4 ++-- app/helpers/expenses_helper.rb | 4 ++-- app/helpers/groups_helper.rb | 4 ++-- app/helpers/guests_helper.rb | 4 ++-- app/helpers/tables_arrangements_helper.rb | 4 ++-- app/jobs/application_job.rb | 4 ++-- app/jobs/table_simulator_job.rb | 4 ++-- app/mailers/application_mailer.rb | 4 ++-- app/models/application_record.rb | 4 ++-- app/models/expense.rb | 4 ++-- app/models/group.rb | 4 ++-- app/models/group_affinity.rb | 4 ++-- app/models/guest.rb | 4 ++-- app/models/seat.rb | 4 ++-- app/models/tables_arrangement.rb | 4 ++-- app/models/user.rb | 4 ++-- app/models/wedding.rb | 4 ++-- app/queries/expenses/total_query.rb | 4 ++-- app/queries/groups/summary_query.rb | 4 ++-- app/serializers/serializable_group.rb | 4 ++-- app/serializers/serializable_guest.rb | 4 ++-- app/services/affinity_groups_hierarchy.rb | 4 ++-- app/services/libre_captcha.rb | 4 ++-- app/services/tables/discomfort_calculator.rb | 4 ++-- app/services/tables/distribution.rb | 4 ++-- app/services/tables/shift.rb | 4 ++-- app/services/tables/swap.rb | 4 ++-- app/services/tables/table.rb | 4 ++-- app/services/vns/engine.rb | 4 ++-- spec/extensions/tree_spec.rb | 4 ++-- spec/factories/expense.rb | 4 ++-- spec/factories/group_affinities.rb | 4 ++-- spec/factories/groups.rb | 4 ++-- spec/factories/guest.rb | 4 ++-- spec/factories/table_arrangement.rb | 4 ++-- spec/factories/users.rb | 4 ++-- spec/factories/weddings.rb | 4 ++-- spec/models/expense_spec.rb | 4 ++-- spec/models/group_spec.rb | 4 ++-- spec/models/guest_spec.rb | 2 -- spec/models/seat_spec.rb | 4 ++-- spec/models/tables_arrangement_spec.rb | 4 ++-- spec/models/user_spec.rb | 4 ++-- spec/models/wedding_spec.rb | 4 ++-- spec/queries/expenses/total_query_spec.rb | 4 ++-- spec/queries/groups/summary_query_spec.rb | 4 ++-- spec/rails_helper.rb | 4 ++-- spec/requests/captcha_spec.rb | 4 ++-- spec/requests/expenses_spec.rb | 4 ++-- spec/requests/groups_spec.rb | 4 ++-- spec/requests/guests_spec.rb | 4 ++-- spec/requests/schemas.rb | 4 ++-- spec/requests/summary_spec.rb | 4 ++-- spec/requests/tables_arrangements_spec.rb | 4 ++-- spec/requests/tokens_spec.rb | 4 ++-- spec/requests/users/confirmations_spec.rb | 4 ++-- spec/requests/users/registrations_spec.rb | 4 ++-- spec/requests/users/sessions_spec.rb | 4 ++-- spec/services/tables/discomfort_calculator_spec.rb | 4 ++-- spec/services/tables/distribution_spec.rb | 4 ++-- spec/services/tables/shift_spec.rb | 4 ++-- spec/services/tables/swap_spec.rb | 4 ++-- spec/services/vns/engine_spec.rb | 4 ++-- spec/spec_helper.rb | 4 ++-- spec/swagger_response_helper.rb | 4 ++-- 79 files changed, 156 insertions(+), 158 deletions(-) diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index 12b8f3d..72b2bf5 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 02dcb5d..d45ff4d 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e1bebb9..b1baa15 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationController < ActionController::Base set_current_tenant_through_filter before_action :set_tenant diff --git a/app/controllers/captcha_controller.rb b/app/controllers/captcha_controller.rb index 77010bd..57dac61 100644 --- a/app/controllers/captcha_controller.rb +++ b/app/controllers/captcha_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class CaptchaController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant diff --git a/app/controllers/expenses_controller.rb b/app/controllers/expenses_controller.rb index 0b86498..6e1b63b 100644 --- a/app/controllers/expenses_controller.rb +++ b/app/controllers/expenses_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ExpensesController < ApplicationController def summary render json: Expenses::TotalQuery.new.call diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 6ba61ca..77a347f 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class GroupsController < ApplicationController def index query_result = Groups::SummaryQuery.new.call.as_json.map(&:deep_symbolize_keys).map do |group| diff --git a/app/controllers/guests_controller.rb b/app/controllers/guests_controller.rb index e8b1cd0..e7f9ff0 100644 --- a/app/controllers/guests_controller.rb +++ b/app/controllers/guests_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'csv' class GuestsController < ApplicationController diff --git a/app/controllers/summary_controller.rb b/app/controllers/summary_controller.rb index 0959d4d..e165127 100644 --- a/app/controllers/summary_controller.rb +++ b/app/controllers/summary_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class SummaryController < ApplicationController def index render json: { diff --git a/app/controllers/tables_arrangements_controller.rb b/app/controllers/tables_arrangements_controller.rb index c042b6c..23b99ba 100644 --- a/app/controllers/tables_arrangements_controller.rb +++ b/app/controllers/tables_arrangements_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class TablesArrangementsController < ApplicationController def index render json: TablesArrangement.order(discomfort: :asc).limit(3).as_json(only: %i[id name discomfort]) diff --git a/app/controllers/tokens_controller.rb b/app/controllers/tokens_controller.rb index 58cf243..5a8490d 100644 --- a/app/controllers/tokens_controller.rb +++ b/app/controllers/tokens_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class TokensController < ApplicationController skip_before_action :authenticate_user! skip_before_action :set_tenant diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index d073fef..7e5c048 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Users class ConfirmationsController < Devise::ConfirmationsController clear_respond_to diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 7a9560b..0849d96 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Users class RegistrationsController < Devise::RegistrationsController clear_respond_to diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 4b7c7d6..5e3ad06 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Users class SessionsController < Devise::SessionsController clear_respond_to diff --git a/app/extensions/tree_node_extension.rb b/app/extensions/tree_node_extension.rb index 80104c3..9bd1ed4 100644 --- a/app/extensions/tree_node_extension.rb +++ b/app/extensions/tree_node_extension.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module TreeNodeExtension def distance_to_common_ancestor(another_node) return 0 if self == another_node diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 10aa281..1bc40d8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ApplicationHelper end diff --git a/app/helpers/expenses_helper.rb b/app/helpers/expenses_helper.rb index 2806ac9..287c70f 100644 --- a/app/helpers/expenses_helper.rb +++ b/app/helpers/expenses_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module ExpensesHelper end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index aa6ffcc..b0492f2 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module GroupsHelper end diff --git a/app/helpers/guests_helper.rb b/app/helpers/guests_helper.rb index d381a71..849ddb8 100644 --- a/app/helpers/guests_helper.rb +++ b/app/helpers/guests_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module GuestsHelper end diff --git a/app/helpers/tables_arrangements_helper.rb b/app/helpers/tables_arrangements_helper.rb index 1ec0aab..bd95809 100644 --- a/app/helpers/tables_arrangements_helper.rb +++ b/app/helpers/tables_arrangements_helper.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module TablesArrangementsHelper end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 438f83d..02ef80e 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base # Automatically retry jobs that encountered a deadlock # retry_on ActiveRecord::Deadlocked diff --git a/app/jobs/table_simulator_job.rb b/app/jobs/table_simulator_job.rb index fe46a6d..50fe728 100644 --- a/app/jobs/table_simulator_job.rb +++ b/app/jobs/table_simulator_job.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class TableSimulatorJob < ApplicationJob queue_as :default diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index dc388c7..b168ff3 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base default from: 'from@example.com' layout 'mailer' diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 60a445b..1a28db5 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base primary_abstract_class end diff --git a/app/models/expense.rb b/app/models/expense.rb index 5be0315..a34cfc5 100644 --- a/app/models/expense.rb +++ b/app/models/expense.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: expenses diff --git a/app/models/group.rb b/app/models/group.rb index 0a2c62a..ddf6e52 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: groups diff --git a/app/models/group_affinity.rb b/app/models/group_affinity.rb index d203589..1e85485 100644 --- a/app/models/group_affinity.rb +++ b/app/models/group_affinity.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: group_affinities diff --git a/app/models/guest.rb b/app/models/guest.rb index ed5254e..8687767 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: guests diff --git a/app/models/seat.rb b/app/models/seat.rb index c4dcefe..a00ec99 100644 --- a/app/models/seat.rb +++ b/app/models/seat.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: seats diff --git a/app/models/tables_arrangement.rb b/app/models/tables_arrangement.rb index 2e11c3a..72f13d5 100644 --- a/app/models/tables_arrangement.rb +++ b/app/models/tables_arrangement.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: tables_arrangements diff --git a/app/models/user.rb b/app/models/user.rb index 80cbf28..5a9683e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: users diff --git a/app/models/wedding.rb b/app/models/wedding.rb index da4a50c..c94d83d 100644 --- a/app/models/wedding.rb +++ b/app/models/wedding.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # == Schema Information # # Table name: weddings diff --git a/app/queries/expenses/total_query.rb b/app/queries/expenses/total_query.rb index 81feea7..fc46a6b 100644 --- a/app/queries/expenses/total_query.rb +++ b/app/queries/expenses/total_query.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Expenses class TotalQuery private attr_reader :wedding diff --git a/app/queries/groups/summary_query.rb b/app/queries/groups/summary_query.rb index 595b6e1..28fe6a5 100644 --- a/app/queries/groups/summary_query.rb +++ b/app/queries/groups/summary_query.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Groups class SummaryQuery def call diff --git a/app/serializers/serializable_group.rb b/app/serializers/serializable_group.rb index f0c18e9..eb30b10 100644 --- a/app/serializers/serializable_group.rb +++ b/app/serializers/serializable_group.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class SerializableGroup < JSONAPI::Serializable::Resource type 'group' diff --git a/app/serializers/serializable_guest.rb b/app/serializers/serializable_guest.rb index 9c34d8d..981e58b 100644 --- a/app/serializers/serializable_guest.rb +++ b/app/serializers/serializable_guest.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class SerializableGuest < JSONAPI::Serializable::Resource type 'guest' diff --git a/app/services/affinity_groups_hierarchy.rb b/app/services/affinity_groups_hierarchy.rb index 3e15551..310bac8 100644 --- a/app/services/affinity_groups_hierarchy.rb +++ b/app/services/affinity_groups_hierarchy.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class AffinityGroupsHierarchy < Array include Singleton diff --git a/app/services/libre_captcha.rb b/app/services/libre_captcha.rb index cfd8028..314c186 100644 --- a/app/services/libre_captcha.rb +++ b/app/services/libre_captcha.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + class LibreCaptcha def id HTTParty.post('http://libre-captcha:8888/v2/captcha', diff --git a/app/services/tables/discomfort_calculator.rb b/app/services/tables/discomfort_calculator.rb index df5eeb4..48dacce 100644 --- a/app/services/tables/discomfort_calculator.rb +++ b/app/services/tables/discomfort_calculator.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class DiscomfortCalculator class << self diff --git a/app/services/tables/distribution.rb b/app/services/tables/distribution.rb index 8c8d152..04d1e6a 100644 --- a/app/services/tables/distribution.rb +++ b/app/services/tables/distribution.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require_relative '../../extensions/tree_node_extension' module Tables diff --git a/app/services/tables/shift.rb b/app/services/tables/shift.rb index f3882cc..2326b1e 100644 --- a/app/services/tables/shift.rb +++ b/app/services/tables/shift.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class Shift private attr_reader :initial_solution diff --git a/app/services/tables/swap.rb b/app/services/tables/swap.rb index e2f7b60..1fe6944 100644 --- a/app/services/tables/swap.rb +++ b/app/services/tables/swap.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class Swap private attr_reader :initial_solution diff --git a/app/services/tables/table.rb b/app/services/tables/table.rb index 7bec30f..8877e7c 100644 --- a/app/services/tables/table.rb +++ b/app/services/tables/table.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Tables class Table < Set attr_accessor :discomfort, :min_per_table, :max_per_table diff --git a/app/services/vns/engine.rb b/app/services/vns/engine.rb index 555f7c7..9f600df 100644 --- a/app/services/vns/engine.rb +++ b/app/services/vns/engine.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module VNS class Engine class << self diff --git a/spec/extensions/tree_spec.rb b/spec/extensions/tree_spec.rb index 328158d..1d3e6d0 100644 --- a/spec/extensions/tree_spec.rb +++ b/spec/extensions/tree_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tree diff --git a/spec/factories/expense.rb b/spec/factories/expense.rb index f794723..e122a43 100644 --- a/spec/factories/expense.rb +++ b/spec/factories/expense.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :expense do wedding diff --git a/spec/factories/group_affinities.rb b/spec/factories/group_affinities.rb index de2069e..f5f2b65 100644 --- a/spec/factories/group_affinities.rb +++ b/spec/factories/group_affinities.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :group_affinity do group_a factory: %i[group] diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 3b73bdb..84ae9ec 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :group do wedding diff --git a/spec/factories/guest.rb b/spec/factories/guest.rb index 5fe1ad7..25a5c5e 100644 --- a/spec/factories/guest.rb +++ b/spec/factories/guest.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :guest do group diff --git a/spec/factories/table_arrangement.rb b/spec/factories/table_arrangement.rb index fd48313..19c5f14 100644 --- a/spec/factories/table_arrangement.rb +++ b/spec/factories/table_arrangement.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :tables_arrangement do wedding diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 69b6b6e..3616935 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :user do wedding diff --git a/spec/factories/weddings.rb b/spec/factories/weddings.rb index 70f947a..1e6f555 100644 --- a/spec/factories/weddings.rb +++ b/spec/factories/weddings.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - FactoryBot.define do factory :wedding do sequence(:slug) { |i| "wedding-#{i}" } diff --git a/spec/models/expense_spec.rb b/spec/models/expense_spec.rb index 6858913..b002e78 100644 --- a/spec/models/expense_spec.rb +++ b/spec/models/expense_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Expense do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 2dbbe0b..f7e7fd3 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Group do diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index 30b927e..a63da70 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -2,8 +2,6 @@ # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Guest do diff --git a/spec/models/seat_spec.rb b/spec/models/seat_spec.rb index 8d77e35..40e63f2 100644 --- a/spec/models/seat_spec.rb +++ b/spec/models/seat_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Seat do diff --git a/spec/models/tables_arrangement_spec.rb b/spec/models/tables_arrangement_spec.rb index 653fe66..493318c 100644 --- a/spec/models/tables_arrangement_spec.rb +++ b/spec/models/tables_arrangement_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe TablesArrangement do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e5bbef4..ae1be79 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe User do diff --git a/spec/models/wedding_spec.rb b/spec/models/wedding_spec.rb index 5840b0a..84db4f1 100644 --- a/spec/models/wedding_spec.rb +++ b/spec/models/wedding_spec.rb @@ -1,9 +1,9 @@ # Copyright (C) 2024 Manuel Bustillo +# Copyright (C) 2024 Manuel Bustillo + # frozen_string_literal: true -# Copyright (C) 2024 Manuel Bustillo - require 'rails_helper' RSpec.describe Wedding do diff --git a/spec/queries/expenses/total_query_spec.rb b/spec/queries/expenses/total_query_spec.rb index 371dc1a..7847abe 100644 --- a/spec/queries/expenses/total_query_spec.rb +++ b/spec/queries/expenses/total_query_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Expenses diff --git a/spec/queries/groups/summary_query_spec.rb b/spec/queries/groups/summary_query_spec.rb index 0aa1490..1ef1a33 100644 --- a/spec/queries/groups/summary_query_spec.rb +++ b/spec/queries/groups/summary_query_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Groups diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a68d8b3..7058316 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' diff --git a/spec/requests/captcha_spec.rb b/spec/requests/captcha_spec.rb index 4441304..17dc9bf 100644 --- a/spec/requests/captcha_spec.rb +++ b/spec/requests/captcha_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'captcha' do diff --git a/spec/requests/expenses_spec.rb b/spec/requests/expenses_spec.rb index 4bfa22f..557f2e3 100644 --- a/spec/requests/expenses_spec.rb +++ b/spec/requests/expenses_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'expenses' do diff --git a/spec/requests/groups_spec.rb b/spec/requests/groups_spec.rb index 3496ad5..30c512e 100644 --- a/spec/requests/groups_spec.rb +++ b/spec/requests/groups_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'groups' do diff --git a/spec/requests/guests_spec.rb b/spec/requests/guests_spec.rb index cd52ca0..1ef80d4 100644 --- a/spec/requests/guests_spec.rb +++ b/spec/requests/guests_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'guests' do diff --git a/spec/requests/schemas.rb b/spec/requests/schemas.rb index 066405e..ee914b3 100644 --- a/spec/requests/schemas.rb +++ b/spec/requests/schemas.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module Swagger module Schema USER = { diff --git a/spec/requests/summary_spec.rb b/spec/requests/summary_spec.rb index 569e4b9..f39ab7a 100644 --- a/spec/requests/summary_spec.rb +++ b/spec/requests/summary_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'summary' do diff --git a/spec/requests/tables_arrangements_spec.rb b/spec/requests/tables_arrangements_spec.rb index eb4c9cd..34c686f 100644 --- a/spec/requests/tables_arrangements_spec.rb +++ b/spec/requests/tables_arrangements_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'tables_arrangements' do diff --git a/spec/requests/tokens_spec.rb b/spec/requests/tokens_spec.rb index 077543d..406e041 100644 --- a/spec/requests/tokens_spec.rb +++ b/spec/requests/tokens_spec.rb @@ -1,5 +1,5 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' diff --git a/spec/requests/users/confirmations_spec.rb b/spec/requests/users/confirmations_spec.rb index 88dd707..8628683 100644 --- a/spec/requests/users/confirmations_spec.rb +++ b/spec/requests/users/confirmations_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'users/confirmations' do diff --git a/spec/requests/users/registrations_spec.rb b/spec/requests/users/registrations_spec.rb index ac423c1..f1dd82c 100644 --- a/spec/requests/users/registrations_spec.rb +++ b/spec/requests/users/registrations_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'users/registrations' do diff --git a/spec/requests/users/sessions_spec.rb b/spec/requests/users/sessions_spec.rb index 1553aed..775f56c 100644 --- a/spec/requests/users/sessions_spec.rb +++ b/spec/requests/users/sessions_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'swagger_helper' RSpec.describe 'users/sessions' do diff --git a/spec/services/tables/discomfort_calculator_spec.rb b/spec/services/tables/discomfort_calculator_spec.rb index a4eea1d..3851bbf 100644 --- a/spec/services/tables/discomfort_calculator_spec.rb +++ b/spec/services/tables/discomfort_calculator_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables RSpec.describe DiscomfortCalculator do diff --git a/spec/services/tables/distribution_spec.rb b/spec/services/tables/distribution_spec.rb index 26834c0..d22b817 100644 --- a/spec/services/tables/distribution_spec.rb +++ b/spec/services/tables/distribution_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables diff --git a/spec/services/tables/shift_spec.rb b/spec/services/tables/shift_spec.rb index 08b2ca1..590d62b 100644 --- a/spec/services/tables/shift_spec.rb +++ b/spec/services/tables/shift_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables diff --git a/spec/services/tables/swap_spec.rb b/spec/services/tables/swap_spec.rb index 067d4bc..94ccced 100644 --- a/spec/services/tables/swap_spec.rb +++ b/spec/services/tables/swap_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module Tables diff --git a/spec/services/vns/engine_spec.rb b/spec/services/vns/engine_spec.rb index b7ff9a5..e3f379c 100644 --- a/spec/services/vns/engine_spec.rb +++ b/spec/services/vns/engine_spec.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + require 'rails_helper' module VNS diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b2f85ad..2aa37f6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause diff --git a/spec/swagger_response_helper.rb b/spec/swagger_response_helper.rb index 424818a..b3f3e0b 100644 --- a/spec/swagger_response_helper.rb +++ b/spec/swagger_response_helper.rb @@ -1,7 +1,7 @@ -# frozen_string_literal: true - # Copyright (C) 2024 Manuel Bustillo +# frozen_string_literal: true + module SwaggerResponseHelper TIMESTAMP_FORMAT = '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z' TIMESTAMP_EXAMPLE = Time.zone.now.iso8601(3) From eded3946de85f5406ffd450f3c096a17cd95c355 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 28 Dec 2024 18:39:14 +0100 Subject: [PATCH 23/25] Restore source in gemfile --- Gemfile | 2 + Gemfile.lock | 311 ++++++++++++++++++++++++++------------------------- 2 files changed, 158 insertions(+), 155 deletions(-) diff --git a/Gemfile b/Gemfile index 8471272..2a789df 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ # frozen_string_literal: true +source 'https://rubygems.org' + ruby '3.3.6' gem 'bootsnap', require: false gem 'csv' diff --git a/Gemfile.lock b/Gemfile.lock index df07989..edd02e2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,4 +1,5 @@ GEM + remote: https://rubygems.org/ specs: actioncable (8.0.1) actionpack (= 8.0.1) @@ -451,161 +452,161 @@ DEPENDENCIES web-console CHECKSUMS - actioncable (8.0.1) - actionmailbox (8.0.1) - actionmailer (8.0.1) - actionpack (8.0.1) - actiontext (8.0.1) - actionview (8.0.1) - activejob (8.0.1) - activemodel (8.0.1) - activerecord (8.0.1) - activestorage (8.0.1) - activesupport (8.0.1) - acts_as_tenant (1.0.1) - addressable (2.8.7) - annotaterb (4.13.0) - ast (2.4.2) - babel-source (5.8.35) - babel-transpiler (0.7.0) - base64 (0.2.0) - bcrypt (3.1.20) - benchmark (0.4.0) - bigdecimal (3.1.8) - bindex (0.8.1) - bootsnap (1.18.4) - builder (3.3.0) - childprocess (5.1.0) - chroma (0.2.0) - coderay (1.1.3) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) - crass (1.0.6) - csv (3.3.2) - date (3.4.1) - debug (1.10.0) - devise (4.9.4) - diff-lcs (1.5.1) - drb (2.2.1) - erubi (1.13.1) - et-orbi (1.2.11) - execjs (2.9.1) - factory_bot (6.4.6) - factory_bot_rails (6.4.3) - faker (3.5.1) - fugit (1.11.1) - globalid (1.2.1) - httparty (0.22.0) - i18n (1.14.6) - importmap-rails (2.1.0) - io-console (0.8.0) - irb (1.14.3) - jbuilder (2.13.0) - json (2.8.2) - json-schema (5.0.1) - jsonapi-deserializable (0.2.0) - jsonapi-parser (0.1.1) - jsonapi-rails (0.4.1) - jsonapi-rb (0.5.0) - jsonapi-renderer (0.2.2) - jsonapi-serializable (0.3.1) - language_server-protocol (3.17.0.3) - launchy (3.0.1) - letter_opener (1.10.0) - letter_opener_web (3.0.0) - license_finder (7.2.1) - logger (1.6.4) - loofah (2.23.1) - mail (2.8.1) - marcel (1.0.4) - method_source (1.1.0) - mini_mime (1.1.5) - minitest (5.25.4) - money (6.19.0) - msgpack (1.7.2) - multi_xml (0.7.1) - net-imap (0.5.2) - net-pop (0.1.2) - net-protocol (0.2.2) - net-smtp (0.5.0) - nio4r (2.7.4) - nokogiri (1.17.2-aarch64-linux) - nokogiri (1.17.2-arm-linux) - nokogiri (1.17.2-arm64-darwin) - nokogiri (1.17.2-x86-linux) - nokogiri (1.17.2-x86_64-darwin) - nokogiri (1.17.2-x86_64-linux) - orm_adapter (0.5.0) - parallel (1.26.3) - parser (3.3.6.0) - pg (1.5.9) - pluck_to_hash (1.0.2) - pry (0.15.2) - psych (5.2.2) - public_suffix (6.0.1) - puma (6.5.0) - raabro (1.4.0) - racc (1.8.1) - rack (3.1.8) - rack-cors (2.0.2) - rack-session (2.0.0) - rack-test (2.1.0) - rackup (2.2.1) - rails (8.0.1) - rails-dom-testing (2.2.0) - rails-html-sanitizer (1.6.2) - railties (8.0.1) - rainbow (3.1.1) - rake (13.2.1) - rdoc (6.10.0) - react-rails (3.2.1) - redis (5.3.0) - redis-client (0.22.2) - regexp_parser (2.9.3) - reline (0.6.0) - responders (3.1.1) - rexml (3.3.9) - rspec-core (3.13.2) - rspec-expectations (3.13.3) - rspec-mocks (3.13.2) - rspec-rails (7.1.0) - rspec-support (3.13.1) - rswag (2.16.0) - rswag-api (2.16.0) - rswag-specs (2.16.0) - rswag-ui (2.16.0) - rubocop (1.69.2) - rubocop-ast (1.36.2) - rubocop-factory_bot (2.26.1) - rubocop-rails (2.28.0) - rubocop-rspec (3.3.0) - rubocop-rspec_rails (2.30.0) - ruby-progressbar (1.13.0) - rubytree (2.1.0) - rubyzip (2.3.2) - securerandom (0.4.1) - shoulda-matchers (6.4.0) - solid_queue (1.1.0) - sprockets (4.2.1) - sprockets-rails (3.5.2) - stimulus-rails (1.3.4) - stringio (3.1.2) - thor (1.3.2) - tilt (2.4.0) - timeout (0.4.3) - tomlrb (2.0.3) - turbo-rails (2.0.11) - tzinfo (2.0.6) - unicode-display_width (2.6.0) - uri (1.0.2) - useragent (0.16.11) - warden (1.2.9) - web-console (4.2.1) - websocket-driver (0.7.6) - websocket-extensions (0.1.5) - with_env (1.1.0) - xml-simple (1.1.9) - zeitwerk (2.7.1) + actioncable (8.0.1) sha256=808bff2a4e3aba36f66f0cd65d7a1579ad52fb65e99304442c46051a79689d9b + actionmailbox (8.0.1) sha256=bbc7db779be857fb6eb5b53f313d3881cd8cda38a150c3aa25f89f2f9977b08c + actionmailer (8.0.1) sha256=7b074e9590e4ec5cebd2fc91d1f9ba4c61bbd4bbd4376f731527da187cd39952 + actionpack (8.0.1) sha256=c764e4bfc0ad9d3505c09ef9b6fbf9eca4292793550c6b7e2ea93167181bfcba + actiontext (8.0.1) sha256=f232d303e854db2098f34d7331fe493a72dc2e53dfce80fbd517c7b93d4b05b2 + actionview (8.0.1) sha256=3005e3de5ca49ea789bf1ad46002d63fe5aa543c61c341239d3c533757e64f8a + activejob (8.0.1) sha256=95acd9a32d498d3a458efbb317f6191fb678758cde0ebb6c68f0b25e0fe3477f + activemodel (8.0.1) sha256=f46292fd6dcc128e18d588854298a933fd9eb22544c412b414ec02821062dc78 + activerecord (8.0.1) sha256=34a7f0610660bb704f0363025d4b8d35ffe8ddc8f5b8147e0809171f724b5306 + activestorage (8.0.1) sha256=91a8f156638568fac971ff25962a617d9c58fdc0e44eb6bd0edff36aff7df205 + activesupport (8.0.1) sha256=fd5bc74641c24ac3541055c2879789198ff42adee3e39c2933289ba008912e37 + acts_as_tenant (1.0.1) sha256=6944e4d64533337938a8817a6b4ff9b11189c9dcc0b1333bb89f3821a4c14c53 + addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232 + annotaterb (4.13.0) sha256=6f472912002fefa735665b4132de47d0134ebf1efb76a7ef05f579cc4a6b2ff1 + ast (2.4.2) sha256=1e280232e6a33754cde542bc5ef85520b74db2aac73ec14acef453784447cc12 + babel-source (5.8.35) sha256=79ef222a9dcb867ac2efa3b0da35b4bcb15a4bfa67b6b2dcbf1e9a29104498d9 + babel-transpiler (0.7.0) sha256=4c06f4ad9e8e1cabe94f99e11df2f140bb72aca9ba067dbb49dc14d9b98d1570 + base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 + bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 + benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a + bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be + bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e + bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 + builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f + childprocess (5.1.0) sha256=9a8d484be2fd4096a0e90a0cd3e449a05bc3aa33f8ac9e4d6dcef6ac1455b6ec + chroma (0.2.0) sha256=64bdcd36a4765fbcd45adc64960cc153101300b4918f90ffdd89f4e2eb954b54 + coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b + concurrent-ruby (1.3.4) sha256=d4aa926339b0a86b5b5054a0a8c580163e6f5dcbdfd0f4bb916b1a2570731c32 + connection_pool (2.4.1) sha256=0f40cf997091f1f04ff66da67eabd61a9fe0d4928b9a3645228532512fab62f4 + crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d + csv (3.3.2) sha256=6ff0c135e65e485d1864dde6c1703b60d34cc9e19bed8452834a0b28a519bd4e + date (3.4.1) sha256=bf268e14ef7158009bfeaec40b5fa3c7271906e88b196d958a89d4b408abe64f + debug (1.10.0) sha256=11e28ca74875979e612444104f3972bd5ffb9e79179907d7ad46dba44bd2e7a4 + devise (4.9.4) sha256=920042fe5e704c548aa4eb65ebdd65980b83ffae67feb32c697206bfd975a7f8 + diff-lcs (1.5.1) sha256=273223dfb40685548436d32b4733aa67351769c7dea621da7d9dd4813e63ddfe + drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 + et-orbi (1.2.11) sha256=d26e868cc21db88280a9ec1a50aa3da5d267eb9b2037ba7b831d6c2731f5df64 + execjs (2.9.1) sha256=e8fd066f6df60c8e8fbebc32c6fb356b5212c77374e8416a9019ca4bb154dcfb + factory_bot (6.4.6) sha256=1a9486ce98d318d740d8f5804b885a8265a28f326ecf2bcd4ce9fb27a71a6e04 + factory_bot_rails (6.4.3) sha256=ea73ceac1c0ff3dc11fff390bf2ea8a2604066525ed8ecd3b3bc2c267226dcc8 + faker (3.5.1) sha256=1ad1fbea279d882f486059c23fe3ddb816ccd1d7052c05a45014b4450d859bfc + fugit (1.11.1) sha256=e89485e7be22226d8e9c6da411664d0660284b4b1c08cacb540f505907869868 + globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9 + httparty (0.22.0) sha256=78652a5c9471cf0093d3b2083c2295c9c8f12b44c65112f1846af2b71430fa6c + i18n (1.14.6) sha256=dc229a74f5d181f09942dd60ab5d6e667f7392c4ee826f35096db36d1fe3614c + importmap-rails (2.1.0) sha256=9f10c67d60651a547579f448100d033df311c5d5db578301374aeb774faae741 + io-console (0.8.0) sha256=cd6a9facbc69871d69b2cb8b926fc6ea7ef06f06e505e81a64f14a470fddefa2 + irb (1.14.3) sha256=c457f1f2f1438ae9ce5c5be3981ae2138dec7fb894c7d73777eeeb0a6c0d0752 + jbuilder (2.13.0) sha256=7200a38a1c0081aa81b7a9757e7a299db75bc58cf1fd45ca7919a91627d227d6 + json (2.8.2) sha256=dd4fa6c9c81daecf72b86ea36e56ed8955fdbb4d4dc379c93d313a59344486cf + json-schema (5.0.1) sha256=bef71a82c600a42594911553522e143f7634affc198ed507ef3ded2f920a74a9 + jsonapi-deserializable (0.2.0) sha256=5f0ca2d3f8404cce1584a314e8a3753be32a56054c942adfe997b87e92bce147 + jsonapi-parser (0.1.1) sha256=9ee0dc031e88fc7548d56fab66f9716d1e1c06f972b529b8c4617bc42a097020 + jsonapi-rails (0.4.1) sha256=fa68b927b58f194e8b81f578c0bf18e61575638f45a390f66c832de2e6d179ba + jsonapi-rb (0.5.0) sha256=7922a164278f506c43d56277f6bd0800a0b603cc985f7f63fe7241b2628bd105 + jsonapi-renderer (0.2.2) sha256=b5c44b033d61b4abdb6500fa4ab84807ca0b36ea0e59e47a2c3ca7095a6e447b + jsonapi-serializable (0.3.1) sha256=221e657677659d798e268a33ec97a83ec5ea0e4233f931358db84e88056552e9 + language_server-protocol (3.17.0.3) sha256=3d5c58c02f44a20d972957a9febe386d7e7468ab3900ce6bd2b563dd910c6b3f + launchy (3.0.1) sha256=b7fa60bda0197cf57614e271a250a8ca1f6a34ab889a3c73f67ec5d57c8a7f2c + letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2 + letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860 + license_finder (7.2.1) sha256=179ead19b64b170638b72fd16024233813673ac9d20d5ba75ae0b4444887ef14 + logger (1.6.4) sha256=b627b91c922231050932e7bf8ee886fe54790ba2238a468ead52ba21911f2ee7 + loofah (2.23.1) sha256=d0a07422cb3b69272e124afa914ef6d517e30d5496b7f1c1fc5b95481f13f75e + mail (2.8.1) sha256=ec3b9fadcf2b3755c78785cb17bc9a0ca9ee9857108a64b6f5cfc9c0b5bfc9ad + marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4 + method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 + mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef + minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947 + money (6.19.0) sha256=ec936fa1e42f2783719241ed9fd52725d0efa628f928feea1eb5c37d5de7daf3 + msgpack (1.7.2) sha256=59ab62fd8a4d0dfbde45009f87eb6f158ab2628a7c48886b0256f175166baaa8 + multi_xml (0.7.1) sha256=4fce100c68af588ff91b8ba90a0bb3f0466f06c909f21a32f4962059140ba61b + net-imap (0.5.2) sha256=e955b55e539712518bdb4eb747c6514f9c8d56ec4eb8eb573a82a6885a9effea + net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3 + net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8 + net-smtp (0.5.0) sha256=5fc0415e6ea1cc0b3dfea7270438ec22b278ca8d524986a3ae4e5ae8d087b42a + nio4r (2.7.4) sha256=d95dee68e0bb251b8ff90ac3423a511e3b784124e5db7ff5f4813a220ae73ca9 + nokogiri (1.17.2-aarch64-linux) sha256=585c8cac6380848b7973bacfd0584628d116810e5f209db25e22d0c32313e681 + nokogiri (1.17.2-arm-linux) sha256=3d033ad9b09d5b8a203f0f2156053e93a9327a9c7887c0ceb9fa78c71d27280d + nokogiri (1.17.2-arm64-darwin) sha256=0c5eb06ba1c112d33c2bb29973b07e2f21c4ddb66c67c9386fd97ff1c5d84686 + nokogiri (1.17.2-x86-linux) sha256=8c4dd75e35810bdeb7c74943f383ca665baf6aed8fc2b78c1d305094a72794aa + nokogiri (1.17.2-x86_64-darwin) sha256=dc5977eb3416e1d501b22b0ed4737bf7604121491405865b887975eacfb3e896 + nokogiri (1.17.2-x86_64-linux) sha256=e8614ae8d776bd9adb535ca814375e7ae05d7cfa6aa01909e561484f6d70be0b + orm_adapter (0.5.0) sha256=aa5d0be5d540cbb46d3a93e88061f4ece6a25f6e97d6a47122beb84fe595e9b9 + parallel (1.26.3) sha256=d86babb7a2b814be9f4b81587bf0b6ce2da7d45969fab24d8ae4bf2bb4d4c7ef + parser (3.3.6.0) sha256=25d4e67cc4f0f7cab9a2ae1f38e2005b6904d2ea13c34734511d0faad038bc3b + pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc + pluck_to_hash (1.0.2) sha256=1599906239716f98262a41493dd7d4cb72e8d83ad3d76d666deacfc5de50a47e + pry (0.15.2) sha256=12d54b8640d3fa29c9211dd4ffb08f3fd8bf7a4fd9b5a73ce5b59c8709385b6b + psych (5.2.2) sha256=a4a9477c85d3e858086c38cf64e7096abe40d1b1eed248b01020dec0ff9906ab + public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f + puma (6.5.0) sha256=94d1b75cab7f356d52e4f1b17b9040a090889b341dbeee6ee3703f441dc189f2 + raabro (1.4.0) sha256=d4fa9ff5172391edb92b242eed8be802d1934b1464061ae5e70d80962c5da882 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rack (3.1.8) sha256=d3fbcbca43dc2b43c9c6d7dfbac01667ae58643c42cea10013d0da970218a1b1 + rack-cors (2.0.2) sha256=415d4e1599891760c5dc9ef0349c7fecdf94f7c6a03e75b2e7c2b54b82adda1b + rack-session (2.0.0) sha256=db04b2063e180369192a9046b4559af311990af38c6a93d4c600cee4eb6d4e81 + rack-test (2.1.0) sha256=0c61fc61904049d691922ea4bb99e28004ed3f43aa5cfd495024cc345f125dfb + rackup (2.2.1) sha256=f737191fd5c5b348b7f0a4412a3b86383f88c43e13b8217b63d4c8d90b9e798d + rails (8.0.1) sha256=c86f4cd7834a67c1e5d04a77d35c88a5f56a20e2022ec416fa52c1af2cdc9491 + rails-dom-testing (2.2.0) sha256=e515712e48df1f687a1d7c380fd7b07b8558faa26464474da64183a7426fa93b + rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560 + railties (8.0.1) sha256=8f653c6b1b0721b553045bd0deda1f22074b9ddc2209526e6f7285fcf607ac51 + rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a + rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d + rdoc (6.10.0) sha256=db665021883ac9df3ba29cdf71aece960749888db1bf9615b4a584cfa3fa3eda + react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64 + redis (5.3.0) sha256=6bf810c5ae889187f0c45f77db503310980310afa57cf1640d57f419ccda72b1 + redis-client (0.22.2) sha256=31fee4b7cf04109b227327fabeaaf1fc5b652cf48a186a03bc607e40767bacc0 + regexp_parser (2.9.3) sha256=4b620657ed8349d82e1331a076415c79b9dd714a5546162ddd790ea9988f6379 + reline (0.6.0) sha256=57620375dcbe56ec09bac7192bfb7460c716bbf0054dc94345ecaa5438e539d2 + responders (3.1.1) sha256=92f2a87e09028347368639cfb468f5fefa745cb0dc2377ef060db1cdd79a341a + rexml (3.3.9) sha256=d71875b85299f341edf47d44df0212e7658cbdf35aeb69cefdb63f57af3137c9 + rspec-core (3.13.2) sha256=94fbda6e4738e478f1c7532b7cc241272fcdc8b9eac03a97338b1122e4573300 + rspec-expectations (3.13.3) sha256=0e6b5af59b900147698ea0ff80456c4f2e69cac4394fbd392fbd1ca561f66c58 + rspec-mocks (3.13.2) sha256=2327335def0e1665325a9b617e3af9ae20272741d80ac550336309a7c59abdef + rspec-rails (7.1.0) sha256=94585b69c4086ca79afae5cc8d2c5e314f6ad32a88c927f9c065b99596e3ee47 + rspec-support (3.13.1) sha256=48877d4f15b772b7538f3693c22225f2eda490ba65a0515c4e7cf6f2f17de70f + rswag (2.16.0) sha256=f07ce41548b9bb51464c38bc7b95af22fee84b90f2d1197a515a623906353086 + rswag-api (2.16.0) sha256=b653f7bd92e98be18b01ab4525d88950d7b0960e293a99f856b9efcee3ae6074 + rswag-specs (2.16.0) sha256=8ba26085c408b0bd2ed21dc8015c80f417c7d34c63720ab7133c2549b5bd2a91 + rswag-ui (2.16.0) sha256=a1f49e927dceda92e6e6e7c1000f1e217ee66c565f69e28131dc98b33cd3a04f + rubocop (1.69.2) sha256=762fb0f30a379bf6054588d39f1815a2a1df8f067bc0337d3fe500e346924bb8 + rubocop-ast (1.36.2) sha256=566405b7f983eb9aa3b91d28aca6bc6566e356a97f59e89851dd910aef1dd1ca + rubocop-factory_bot (2.26.1) sha256=8de13cd4edcee5ca800f255188167ecef8dbfc3d1fae9f15734e9d2e755392aa + rubocop-rails (2.28.0) sha256=4967bed9ea13e6dcab566fea4265a6dd0381db739b305e48930aba1282da2715 + rubocop-rspec (3.3.0) sha256=79e1b281a689044d1516fefbc52e2e6c06cd367c25ebeaf06a7a198e9071cd7d + rubocop-rspec_rails (2.30.0) sha256=888112e83f9d7ef7ad2397e9d69a0b9614a4bae24f072c399804a180f80c4c46 + ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + rubytree (2.1.0) sha256=30e8759ba060dff0dabf7e40cbaaa4df892fa34cbe9f1b3fbb00e83a3f321e4b + rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 + solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c + sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 + sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e + stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 + stringio (3.1.2) sha256=204f1828f85cdb39d57cac4abc6dc44b04505a223f131587f2e20ae3729ba131 + thor (1.3.2) sha256=eef0293b9e24158ccad7ab383ae83534b7ad4ed99c09f96f1a6b036550abbeda + tilt (2.4.0) sha256=df74f29a451daed26591a85e8e0cebb198892cb75b6573394303acda273fba4d + timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e + tomlrb (2.0.3) sha256=c2736acf24919f793334023a4ff396c0647d93fce702a73c9d348deaa815d4f7 + turbo-rails (2.0.11) sha256=fc47674736372780abd2a4dc0d84bef242f5ca156a457cd7fa6308291e397fcf + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a + uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27 + useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844 + warden (1.2.9) sha256=46684f885d35a69dbb883deabf85a222c8e427a957804719e143005df7a1efd0 + web-console (4.2.1) sha256=e7bcf37a10ea2b4ec4281649d1cee461b32232d0a447e82c786e6841fd22fe20 + websocket-driver (0.7.6) sha256=f69400be7bc197879726ad8e6f5869a61823147372fd8928836a53c2c741d0db + websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241 + with_env (1.1.0) sha256=50b3e4f0a6cda8f90d8a6bd87a6261f6c381429abafb161c4c69ad4a0cd0b6e4 + xml-simple (1.1.9) sha256=d21131e519c86f1a5bc2b6d2d57d46e6998e47f18ed249b25cad86433dbd695d + zeitwerk (2.7.1) sha256=0945986050e4907140895378e74df1fe882a2271ed087cc6c6d6b00d415a2756 RUBY VERSION ruby 3.3.6p108 From d2841a449e939d2c1d4f184efe7ed136e30ca58b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 29 Dec 2024 01:08:54 +0000 Subject: [PATCH 24/25] Update dependency solid_queue to v1.1.2 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index edd02e2..4295b50 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM base64 (0.2.0) bcrypt (3.1.20) benchmark (0.4.0) - bigdecimal (3.1.8) + bigdecimal (3.1.9) bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) @@ -358,7 +358,7 @@ GEM securerandom (0.4.1) shoulda-matchers (6.4.0) activesupport (>= 5.2.0) - solid_queue (1.1.0) + solid_queue (1.1.2) activejob (>= 7.1) activerecord (>= 7.1) concurrent-ruby (>= 1.3.1) @@ -472,7 +472,7 @@ CHECKSUMS base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507 bcrypt (3.1.20) sha256=8410f8c7b3ed54a3c00cd2456bf13917d695117f033218e2483b2e40b0784099 benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a - bigdecimal (3.1.8) sha256=a89467ed5a44f8ae01824af49cbc575871fa078332e8f77ea425725c1ffe27be + bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e bootsnap (1.18.4) sha256=ac4c42af397f7ee15521820198daeff545e4c360d2772c601fbdc2c07d92af55 builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f @@ -586,7 +586,7 @@ CHECKSUMS rubyzip (2.3.2) sha256=3f57e3935dc2255c414484fbf8d673b4909d8a6a57007ed754dde39342d2373f securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0 - solid_queue (1.1.0) sha256=55c7b1d65f2943ec8f3deee36fcb0cae91d5fa60410b294775db9da22be8353c + solid_queue (1.1.2) sha256=178c9396d1cf0dac595c7508da90ddb397d25848ca007b5c5ed48e6ac6fc360c sprockets (4.2.1) sha256=951b13dd2f2fcae840a7184722689a803e0ff9d2702d902bd844b196da773f97 sprockets-rails (3.5.2) sha256=a9e88e6ce9f8c912d349aa5401509165ec42326baf9e942a85de4b76dbc4119e stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06 From 9c3c76617537ebbdbeff2e5036dc7a5cb0b7f637 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 29 Dec 2024 13:25:02 +0100 Subject: [PATCH 25/25] Configure build and cache for intermediate layers --- .gitea/workflows/build.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 1118afa..71d3c1b 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,8 +1,6 @@ name: Build Nginx-based docker image on: push: - branches: - - main concurrency: group: ${{ github.ref }} cancel-in-progress: true @@ -24,13 +22,22 @@ jobs: registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} - - - name: Build and push + + - name: Build and push intermediate stages (build) uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name != 'pull_request' }} - tags: | - ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest - cache-from: type=registry,ref=user/app:latest + target: build + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-to: type=inline + + - name: Build and push (final) + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest cache-to: type=inline \ No newline at end of file