diff --git a/spec/controllers/api/v2/graphql_controller_stored_queries_spec.rb b/spec/controllers/api/v2/graphql_controller_stored_queries_spec.rb index 380007607..6fa77c40b 100644 --- a/spec/controllers/api/v2/graphql_controller_stored_queries_spec.rb +++ b/spec/controllers/api/v2/graphql_controller_stored_queries_spec.rb @@ -160,7 +160,7 @@ describe API::V2::GraphqlController do context 'include Dossiers' do def cursor_for(item, column) - cursor = [item.read_attribute(column).utc.strftime("%Y-%m-%dT%H:%M:%S.%NZ"), item.id].join(';') + cursor = [item.reload.read_attribute(column).utc.strftime("%Y-%m-%dT%H:%M:%S.%NZ"), item.id].join(';') API::V2::Schema.cursor_encoder.encode(cursor, nonce: true) end @@ -456,7 +456,7 @@ describe API::V2::GraphqlController do context 'include deleted Dossiers' do def cursor_for(item) - cursor = [item.deleted_at.utc.strftime("%Y-%m-%dT%H:%M:%S.%NZ"), item.id].join(';') + cursor = [item.reload.deleted_at.utc.strftime("%Y-%m-%dT%H:%M:%S.%NZ"), item.id].join(';') API::V2::Schema.cursor_encoder.encode(cursor, nonce: true) end @@ -575,7 +575,7 @@ describe API::V2::GraphqlController do context 'include pending deleted Dossiers' do def cursor_for(item) - cursor = [(item.en_construction? ? item.hidden_by_user_at : item.hidden_by_administration_at).utc.strftime("%Y-%m-%dT%H:%M:%S.%NZ"), item.id].join(';') + cursor = [(item.reload.en_construction? ? item.hidden_by_user_at : item.hidden_by_administration_at).utc.strftime("%Y-%m-%dT%H:%M:%S.%NZ"), item.id].join(';') API::V2::Schema.cursor_encoder.encode(cursor, nonce: true) end diff --git a/spec/models/concern/dossier_clone_concern_spec.rb b/spec/models/concern/dossier_clone_concern_spec.rb index b7922de61..e91674b51 100644 --- a/spec/models/concern/dossier_clone_concern_spec.rb +++ b/spec/models/concern/dossier_clone_concern_spec.rb @@ -173,6 +173,7 @@ RSpec.describe DossierCloneConcern do context "as a fork" do let(:new_dossier) { dossier.clone(fork: true) } + before { dossier.champs_public.reload } # we compare timestamps so we have to get the precision limit from the db } it { expect(new_dossier.editing_fork_origin).to eq(dossier) } it { expect(new_dossier.champs_public[0].id).not_to eq(dossier.champs_public[0].id) } @@ -181,7 +182,7 @@ RSpec.describe DossierCloneConcern do context "piece justificative champ" do let(:champ_pj) { create(:champ_piece_justificative, dossier_id: dossier.id) } - before { dossier.champs_public << champ_pj } + before { dossier.champs_public << champ_pj.reload } it { champ_pj_fork = Champs::PieceJustificativeChamp.where(dossier: new_dossier).first