calendar_subscriptions_spec.rb 912 B

123456789101112131415161718192021222324252627282930313233343536
  1. require 'rails_helper'
  2. RSpec.describe 'iCal endpoints', type: :request do
  3. context 'with no existing session' do
  4. it 'gives HTTP Basic auth prompt (#3064)' do
  5. get '/ical/tickets'
  6. expect(response.body).to eq("HTTP Basic: Access denied.\n")
  7. end
  8. end
  9. describe 'time zone', authenticated_as: :user do
  10. let(:group) { create(:group) }
  11. let(:user) { create(:agent) }
  12. before do
  13. user.groups << group
  14. create(:ticket, group: group, owner: user, state_name: 'open', pending_time: 1.day.ago)
  15. end
  16. it 'returns zero offset time if no time zone set' do
  17. get '/ical/tickets'
  18. expect(response.body).to match %r{DTSTART:\d{8}T0{6}Z}
  19. end
  20. it 'returns selected time zone' do
  21. Setting.set 'timezone_default', 'Europe/Vilnius'
  22. get '/ical/tickets'
  23. expect(response.body).to match %r{DTSTART;TZID=Europe/Vilnius:\d{8}T0{6}}
  24. end
  25. end
  26. end