Merge pull request #2131 from betagouv/fix-rake-specs

spec: only load tasks once
This commit is contained in:
Mathieu Magnin 2018-06-21 12:15:32 +02:00 committed by GitHub
commit ef45f9d444
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 4 deletions

View file

@ -10,7 +10,6 @@ describe '2018_03_06_clean_html_textareas#clean' do
before do before do
Timecop.freeze(champ_date) { champ } Timecop.freeze(champ_date) { champ }
TPS::Application.load_tasks
Timecop.freeze(rake_date) { rake_task.invoke } Timecop.freeze(rake_date) { rake_task.invoke }
champ.reload champ.reload
end end

View file

@ -10,7 +10,6 @@ describe '2018_03_29_remove_code_tags_from_mail_templates#clean' do
let!(:dirty_without_continuation_mail) { create(:without_continuation_mail, body: "<h1>Salut</h1><br>Voici ton email avec une balise <code>--balise--</code>") } let!(:dirty_without_continuation_mail) { create(:without_continuation_mail, body: "<h1>Salut</h1><br>Voici ton email avec une balise <code>--balise--</code>") }
before do before do
TPS::Application.load_tasks
rake_task.invoke rake_task.invoke
dirty_closed_mail.reload dirty_closed_mail.reload
dirty_initiated_mail.reload dirty_initiated_mail.reload

View file

@ -24,8 +24,6 @@ describe '2018_05_14_add_annotation_privee_to_procedure' do
let!(:dossier) { Dossier.create(procedure: procedure, user: user, state: 'brouillon') } let!(:dossier) { Dossier.create(procedure: procedure, user: user, state: 'brouillon') }
let(:rake_task) { Rake::Task['2018_05_14_add_annotation_privee_to_procedure:add'] } let(:rake_task) { Rake::Task['2018_05_14_add_annotation_privee_to_procedure:add'] }
before(:all) { TPS::Application.load_tasks }
before do before do
ENV['PROCEDURE_ID'] = procedure.id.to_s ENV['PROCEDURE_ID'] = procedure.id.to_s
rake_task.invoke rake_task.invoke

View file

@ -69,6 +69,8 @@ end
DatabaseCleaner.strategy = :transaction DatabaseCleaner.strategy = :transaction
TPS::Application.load_tasks
SIADETOKEN = :valid_token if !defined? SIADETOKEN SIADETOKEN = :valid_token if !defined? SIADETOKEN
include Warden::Test::Helpers include Warden::Test::Helpers