has_timeplan_examples.rb 621 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. RSpec.shared_examples 'HasTimeplan' do
  3. subject { create(described_class.name.underscore) }
  4. describe '#in_timeplan?' do
  5. before do
  6. subject.timeplan = { days: { Mon: true }, hours: { 0 => true }, minutes: { 0 => true } }
  7. end
  8. it 'checks in selected time zone' do
  9. Setting.set 'timezone_default', 'Europe/Vilnius'
  10. expect(subject).to be_in_timeplan Time.zone.parse('2020-12-27 22:00')
  11. end
  12. it 'checks in UTC' do
  13. expect(subject).to be_in_timeplan Time.zone.parse('2020-12-28 00:00')
  14. end
  15. end
  16. end