From ca1d9c11c323369a2e050efc4e0fe541fdb41c6d Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Tue, 26 Dec 2023 11:10:49 +0100
Subject: [PATCH] Fix tests

---
 app/models/concerns/with_publication.rb       | 4 ++--
 test/fixtures/communication/website/pages.yml | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/models/concerns/with_publication.rb b/app/models/concerns/with_publication.rb
index 1d14fa8e3..ae94dce5f 100644
--- a/app/models/concerns/with_publication.rb
+++ b/app/models/concerns/with_publication.rb
@@ -17,11 +17,11 @@ module WithPublication
   end
 
   def published_in_the_future?
-    published && published_at > Time.now
+    published && published_at.present? && published_at > Time.now
   end
 
   def published_now?
-    published && published_at <= Time.now
+    published && published_at.present? && published_at <= Time.now
   end
 
   protected
diff --git a/test/fixtures/communication/website/pages.yml b/test/fixtures/communication/website/pages.yml
index 716aca79a..ee7005f6f 100644
--- a/test/fixtures/communication/website/pages.yml
+++ b/test/fixtures/communication/website/pages.yml
@@ -53,6 +53,7 @@ page_root:
   language: fr
   position: 1
   published: true
+  published_at: 2010-11-28 00:00:00
   
 page_test:
   university: default_university
@@ -62,6 +63,7 @@ page_test:
   language: fr
   position: 1
   published: true
+  published_at: 2010-11-28 00:00:00
   parent: page_root
 
 page_with_no_dependency:
@@ -72,4 +74,5 @@ page_with_no_dependency:
   language: fr
   position: 2
   published: true
+  published_at: 2010-11-28 00:00:00
   parent: page_root
-- 
GitLab