history_spec.rb 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. require 'rails_helper'
  2. RSpec.describe 'Ticket history', type: :system, authenticated_as: true, time_zone: 'Europe/London' do
  3. let(:group) { Group.find_by(name: 'Users') }
  4. let(:customer) { create(:customer) }
  5. let!(:session_user) { User.find_by(login: 'master@example.com') }
  6. before do
  7. freeze_time
  8. travel_to DateTime.parse('2021-01-22 13:40:00 UTC')
  9. current_time = Time.current
  10. customer.update! firstname: 'Customer'
  11. customer.update! email: 'test@example.com'
  12. customer.update! country: 'Germany'
  13. customer.update! out_of_office_start_at: current_time
  14. customer.update! last_login: current_time
  15. travel_to DateTime.parse('2021-04-06 23:30:00 UTC')
  16. current_time = Time.current
  17. customer.update! lastname: 'Example'
  18. customer.update! mobile: '5757473827'
  19. customer.update! out_of_office_end_at: current_time
  20. customer.update! last_login: current_time
  21. travel_back
  22. session_user.preferences[:locale] = 'de-de'
  23. session_user.save!
  24. refresh
  25. visit "#user/profile/#{customer.id}"
  26. find('#userAction').click
  27. click('[data-type="history"]')
  28. end
  29. it "translates timestamp when attribute's tag is datetime" do
  30. expect(page).to have_css('li', text: %r{'22.01.2021 00:00'})
  31. end
  32. it 'does not include time with UTC format' do
  33. expect(page).to have_no_text(%r{ UTC})
  34. end
  35. it 'translates out_of_office_start_at value to time stamp' do
  36. expect(page).to have_css('li', text: %r{Benutzer out_of_office_start_at '22.01.2021 00:00'})
  37. end
  38. it 'translates out_of_office_end_at value to time stamp' do
  39. expect(page).to have_css('li', text: %r{Benutzer out_of_office_end_at '06.04.2021 01:00'})
  40. end
  41. end