demarches-normaliennes/spec/components/previews/dossiers/message_component_preview.rb

31 lines
948 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class Dossiers::MessageComponentPreview < ViewComponent::Preview
def with_default_commentaire
render Dossiers::MessageComponent.new(commentaire: commentaire, connected_user: user)
end
def with_discarded_commentaire
render Dossiers::MessageComponent.new(commentaire: discarded_commentaire, connected_user: user)
end
private
def user
User.new email: "usager@example.com", locale: I18n.locale
end
def commentaire
Commentaire.new body: 'Hello world!', email: user.email, dossier: dossier, created_at: 2.days.ago
end
def discarded_commentaire
Commentaire.new body: 'Hello world!', email: user.email, dossier: dossier, created_at: 2.days.ago, discarded_at: 1.day.ago
end
def dossier
Dossier.new(id: 47882, state: :en_instruction, procedure: procedure, user: user)
end
def procedure
Procedure.new id: 1234, libelle: 'Dotation dÉquipement des Territoires Ruraux - Exercice 2019'
end
end