Fix Commentaire factory so that the default case creates a valid object

This commit is contained in:
Nicolas Bouilleaud 2019-07-02 15:21:49 +02:00 committed by Pierre de La Morinerie
parent 930fd345de
commit fac20ed190
3 changed files with 3 additions and 3 deletions

View file

@ -4,7 +4,7 @@ FactoryBot.define do
before(:create) do |commentaire, _evaluator|
if !commentaire.dossier
commentaire.dossier = create :dossier
commentaire.dossier = create :dossier, :en_construction
end
end
end

View file

@ -32,7 +32,7 @@ RSpec.describe CommentaireHelper, type: :helper do
end
describe '.commentaire_is_from_guest' do
let(:dossier) { create(:dossier) }
let(:dossier) { create(:dossier, :en_instruction) }
let!(:guest) { create(:invite, dossier: dossier) }
subject { commentaire_is_from_guest(commentaire) }

View file

@ -3,7 +3,7 @@ describe 'shared/dossiers/messages/message.html.haml', type: :view do
subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, connected_user: dossier.user }
let(:dossier) { create(:dossier) }
let(:dossier) { create(:dossier, :en_construction) }
let(:commentaire) { create(:commentaire, dossier: dossier) }
let(:seen_at) { commentaire.created_at + 1.hour }