From 2be7113729cb234eb4b2199199c3cb3e5e7f8708 Mon Sep 17 00:00:00 2001 From: Spencer Dixon Date: Fri, 29 Nov 2024 11:26:12 +0000 Subject: [PATCH] Added manual pages to last mod tracking (#4383) * Added manual pages to last mod tracking * Move manual pages to their own method and stub this in the tests to be empty * Moved manual pages to a constant --- lib/page_modification_tracker.rb | 8 +++++++- spec/lib/page_modification_tracker_spec.rb | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/page_modification_tracker.rb b/lib/page_modification_tracker.rb index ee902f7d83..7ea3df8113 100644 --- a/lib/page_modification_tracker.rb +++ b/lib/page_modification_tracker.rb @@ -2,6 +2,12 @@ require "digest/sha1" class PageModificationTracker + MANUAL_PAGES = { + "/events/about-get-into-teaching-events" => {}, + "/events" => {}, + "/mailinglist/signup/name" => {}, + }.freeze + attr_reader :app, :headers def initialize(host: "localhost:3000", selector: "body") @@ -49,7 +55,7 @@ def published_pages ) content_pages = ::Pages::Frontmatter.list.reject { |_path, fm| fm[:draft] } event_pages = events.map { |e| Rails.application.routes.url_helpers.event_path(e.readable_id) }.index_with({}) - content_pages.merge(event_pages) + content_pages.merge(**event_pages, **MANUAL_PAGES) end def request_path(path, app, headers) diff --git a/spec/lib/page_modification_tracker_spec.rb b/spec/lib/page_modification_tracker_spec.rb index 9f0649ea49..5cb722c0b7 100644 --- a/spec/lib/page_modification_tracker_spec.rb +++ b/spec/lib/page_modification_tracker_spec.rb @@ -29,6 +29,8 @@ .to receive(:search_teaching_events) .and_return([]) + stub_const("PageModificationTracker::MANUAL_PAGES", {}) + allow(::Pages::Frontmatter) .to receive(:list) .and_return({ path => { draft: false } })