default_timezone_spec.rb 869 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Default Timezone', authenticated_as: :authenticate, type: :system do
  4. def authenticate
  5. Setting.set('timezone_default', initial_timezone)
  6. true
  7. end
  8. def current_value
  9. Setting
  10. .find_by(name: 'timezone_default')
  11. .reload
  12. .state_current[:value]
  13. end
  14. before do
  15. visit "#ticket/zoom/#{Ticket.first.id}"
  16. end
  17. context 'when timezone_default is not set' do
  18. let(:initial_timezone) { nil }
  19. it 'resets timezone' do
  20. wait(10).until { current_value.present? }
  21. end
  22. end
  23. context 'when timezone_default is set' do
  24. let(:initial_timezone) { 'Test' }
  25. it 'does not change timezone' do
  26. sleep 10 # timezone is set with 3500ms delay
  27. expect(current_value).to eq('Test')
  28. end
  29. end
  30. end