Merge pull request #9215 from colinux/fix-flaky-tests

Tests: fix tests instables et colonne manquante dans le schema.rb
This commit is contained in:
Colin Darie 2023-06-20 07:05:49 +00:00 committed by GitHub
commit 4eaef72a22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 13 deletions

View file

@ -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

View file

@ -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 }

View file

@ -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" }

View file

@ -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

View file

@ -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

View file

@ -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