From d41d69d1670babffe4ebc05797c88d9206f87561 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 19 Jun 2023 23:56:23 +0200 Subject: [PATCH 1/2] fix(schema): missing column addition declaration in ce1429b --- db/schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index aa4573a09..0c885ec88 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_05_16_132925) do +ActiveRecord::Schema[7.0].define(version: 2023_05_17_085816) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -385,6 +385,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_16_132925) do t.datetime "en_construction_close_to_expiration_notice_sent_at", precision: 6 t.datetime "en_instruction_at", precision: 6 t.boolean "for_procedure_preview", default: false + t.boolean "forced_groupe_instructeur", default: false, null: false t.bigint "groupe_instructeur_id" t.datetime "groupe_instructeur_updated_at", precision: 6 t.datetime "hidden_at", precision: 6 From 33617a4c44973fc2ce7c6129efc72961aeb643af Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Tue, 20 Jun 2023 00:04:55 +0200 Subject: [PATCH 2/2] test: ensure travel_back is automatically called at the right time --- spec/jobs/process_stalled_declarative_dossier_job_spec.rb | 2 -- spec/models/api_entreprise_token_spec.rb | 2 -- spec/models/dossier_spec.rb | 6 +----- spec/models/stat_spec.rb | 4 +--- spec/rails_helper.rb | 1 + 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/spec/jobs/process_stalled_declarative_dossier_job_spec.rb b/spec/jobs/process_stalled_declarative_dossier_job_spec.rb index a5eeaa60c..89ca96e19 100644 --- a/spec/jobs/process_stalled_declarative_dossier_job_spec.rb +++ b/spec/jobs/process_stalled_declarative_dossier_job_spec.rb @@ -1,6 +1,4 @@ RSpec.describe ProcessStalledDeclarativeDossierJob, type: :job do - include ActiveSupport::Testing::TimeHelpers - describe "perform" do let(:procedure) { create(:procedure, :published, :for_individual, :with_instructeur, declarative_with_state: state) } let(:last_operation) { dossier.dossier_operation_logs.last } diff --git a/spec/models/api_entreprise_token_spec.rb b/spec/models/api_entreprise_token_spec.rb index 3a5e1998d..03f0377c5 100644 --- a/spec/models/api_entreprise_token_spec.rb +++ b/spec/models/api_entreprise_token_spec.rb @@ -120,8 +120,6 @@ describe APIEntrepriseToken, type: :model do end context "with a valid expiring token" do - include ActiveSupport::Testing::TimeHelpers - # expire on Jul 4, 2023 14:58:34 let(:token) { "eyJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiI2NjRkZWEyMS02YWFlLTQwZmYtYWM0Mi1kZmQ3ZGE4YjQ3NmUiLCJqdGkiOiJhcGktZW50cmVwcmlzZS1zdGFnaW5nIiwicm9sZXMiOlsiY2VydGlmaWNhdF9jbmV0cCIsInByb2J0cCIsImV0YWJsaXNzZW1lbnRzIiwicHJpdmlsZWdlcyIsInVwdGltZSIsImF0dGVzdGF0aW9uc19hZ2VmaXBoIiwiYWN0ZXNfaW5waSIsImJpbGFuc19pbnBpIiwiYWlkZXNfY292aWRfZWZmZWN0aWZzIiwiY2VydGlmaWNhdF9yZ2VfYWRlbWUiLCJhdHRlc3RhdGlvbnNfc29jaWFsZXMiLCJlbnRyZXByaXNlX2FydGlzYW5hbGUiLCJmbnRwX2NhcnRlX3BybyIsImNvbnZlbnRpb25zX2NvbGxlY3RpdmVzIiwiZXh0cmFpdHNfcmNzIiwiZXh0cmFpdF9jb3VydF9pbnBpIiwiY2VydGlmaWNhdF9hZ2VuY2VfYmlvIiwibXNhX2NvdGlzYXRpb25zIiwiZG9jdW1lbnRzX2Fzc29jaWF0aW9uIiwiZW9yaV9kb3VhbmVzIiwiYXNzb2NpYXRpb25zIiwiYmlsYW5zX2VudHJlcHJpc2VfYmRmIiwiZW50cmVwcmlzZXMiLCJxdWFsaWJhdCIsImNlcnRpZmljYXRfb3BxaWJpIiwiZW50cmVwcmlzZSIsImV0YWJsaXNzZW1lbnQiXSwic3ViIjoic3RhZ2luZyBkZXZlbG9wbWVudCIsImlhdCI6MTY0MTMwNDcxNCwidmVyc2lvbiI6IjEuMCIsImV4cCI6MTY4ODQ3NTUxNH0.xID66pIlMnBR5_6nG-GidFBzK4Tuuy5ZsWfkMEVB_Ek" } diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 6673a1a35..74f76d93f 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -1,6 +1,4 @@ -describe Dossier do - include ActiveJob::TestHelper - +describe Dossier, type: :model do let(:user) { create(:user) } describe 'scopes' do @@ -1757,8 +1755,6 @@ describe Dossier do end describe '#processed_in_month' do - include ActiveSupport::Testing::TimeHelpers - let(:dossier_accepte_at) { DateTime.new(2022, 3, 31, 12, 0) } before do travel_to(dossier_accepte_at) do diff --git a/spec/models/stat_spec.rb b/spec/models/stat_spec.rb index 726d67819..fa63b3099 100644 --- a/spec/models/stat_spec.rb +++ b/spec/models/stat_spec.rb @@ -1,6 +1,4 @@ -include ActiveSupport::Testing::TimeHelpers - -describe Stat do +describe Stat, type: :model do describe '.deleted_dossiers_states' do subject { Stat.send(:deleted_dossiers_states) } it 'find counts for columns' do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6e1b9fb87..a45eeceb5 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -125,6 +125,7 @@ RSpec.configure do |config| Flipper.instance = Flipper.new(Flipper::Adapters::Memory.new) end + config.include ActiveSupport::Testing::TimeHelpers config.include Shoulda::Matchers::ActiveRecord, type: :model config.include Shoulda::Matchers::ActiveModel, type: :model config.include Devise::Test::ControllerHelpers, type: :controller