From e677eb164cfb69c11692ca5cd2072c26ca1d9509 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 8 Jan 2024 10:26:30 -0500 Subject: [PATCH] Remove unused `Announcement#time_range?` (#28648) --- app/models/announcement.rb | 4 ---- spec/models/announcement_spec.rb | 26 -------------------------- 2 files changed, 30 deletions(-) diff --git a/app/models/announcement.rb b/app/models/announcement.rb index cbcaef3daa..86f7037a56 100644 --- a/app/models/announcement.rb +++ b/app/models/announcement.rb @@ -54,10 +54,6 @@ class Announcement < ApplicationRecord update!(published: false, scheduled_at: nil) end - def time_range? - starts_at? && ends_at? - end - def mentions @mentions ||= Account.from_text(text) end diff --git a/spec/models/announcement_spec.rb b/spec/models/announcement_spec.rb index c016a316cd..612ba8bb0d 100644 --- a/spec/models/announcement_spec.rb +++ b/spec/models/announcement_spec.rb @@ -113,32 +113,6 @@ describe Announcement do end end - describe '#time_range?' do - it 'returns false when starts_at and ends_at are missing' do - record = Fabricate.build(:announcement, starts_at: nil, ends_at: nil) - - expect(record.time_range?).to be(false) - end - - it 'returns false when starts_at is present and ends_at is missing' do - record = Fabricate.build(:announcement, starts_at: 5.days.from_now, ends_at: nil) - - expect(record.time_range?).to be(false) - end - - it 'returns false when starts_at is missing and ends_at is present' do - record = Fabricate.build(:announcement, starts_at: nil, ends_at: 5.days.from_now) - - expect(record.time_range?).to be(false) - end - - it 'returns true when starts_at and ends_at are present' do - record = Fabricate.build(:announcement, starts_at: 5.days.from_now, ends_at: 10.days.from_now) - - expect(record.time_range?).to be(true) - end - end - describe '#reactions' do context 'with announcement_reactions present' do let!(:account) { Fabricate(:account) }