test: ensure travel_back is automatically called at the right time

This commit is contained in:
Colin Darie 2023-06-20 00:04:55 +02:00
parent d41d69d167
commit 33617a4c44
5 changed files with 3 additions and 12 deletions

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