mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-25 12:34:58 +01:00
Remove unused Announcement#time_range?
(#28648)
This commit is contained in:
parent
3e43cd095c
commit
e677eb164c
@ -54,10 +54,6 @@ class Announcement < ApplicationRecord
|
|||||||
update!(published: false, scheduled_at: nil)
|
update!(published: false, scheduled_at: nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def time_range?
|
|
||||||
starts_at? && ends_at?
|
|
||||||
end
|
|
||||||
|
|
||||||
def mentions
|
def mentions
|
||||||
@mentions ||= Account.from_text(text)
|
@mentions ||= Account.from_text(text)
|
||||||
end
|
end
|
||||||
|
@ -113,32 +113,6 @@ describe Announcement do
|
|||||||
end
|
end
|
||||||
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
|
describe '#reactions' do
|
||||||
context 'with announcement_reactions present' do
|
context 'with announcement_reactions present' do
|
||||||
let!(:account) { Fabricate(:account) }
|
let!(:account) { Fabricate(:account) }
|
||||||
|
Loading…
Reference in New Issue
Block a user