Skip to content

Commit

Permalink
Added manual pages to last mod tracking (#4383)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
spencerldixon authored Nov 29, 2024
1 parent c7e6669 commit 2be7113
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/page_modification_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/page_modification_tracker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } })
Expand Down

0 comments on commit 2be7113

Please sign in to comment.