Skip to content

Commit

Permalink
Only render Weekend-specific chores on Weekends
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Nov 5, 2024
1 parent 8931bfb commit 1d1506f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/daily_packet/pdf_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def draw_chore_list_page

font_size(20) do
text "unload dishwasher"
text "collect laundry"
text "collect laundry" if daily_packet.built_on.saturday? || daily_packet.built_on.sunday?
text "defrost meat"
text "poop patrol"
text "mow front"
Expand Down
13 changes: 12 additions & 1 deletion spec/models/daily_packet/pdf_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
expect(page_three_strings).to eq([
"Chore List",
"unload dishwasher",
"collect laundry",
"defrost meat",
"poop patrol",
"mow front",
Expand All @@ -67,4 +66,16 @@
expect(page_three_strings).to include "put out garbage cans"
end
end

context "on a Saturday" do
let(:built_on) { Date.parse("2024-11-09") }

it "renders the Saturday-specific chore" do
inspector = PDF::Inspector::Page.analyze(daily_packet.pdf_data)

_, _, page_three_strings = inspector.pages.map { |page| page[:strings] }

expect(page_three_strings).to include "collect laundry"
end
end
end

0 comments on commit 1d1506f

Please sign in to comment.