settings_helper_spec.rb 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe SettingsHelper do
  4. describe 'session_device_icon' do
  5. context 'with a mobile device' do
  6. let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (iPhone)') }
  7. it 'detects the device and returns a descriptive string' do
  8. result = helper.session_device_icon(session)
  9. expect(result).to eq('mobile')
  10. end
  11. end
  12. context 'with a tablet device' do
  13. let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (iPad)') }
  14. it 'detects the device and returns a descriptive string' do
  15. result = helper.session_device_icon(session)
  16. expect(result).to eq('tablet')
  17. end
  18. end
  19. context 'with a desktop device' do
  20. let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (Macintosh)') }
  21. it 'detects the device and returns a descriptive string' do
  22. result = helper.session_device_icon(session)
  23. expect(result).to eq('desktop')
  24. end
  25. end
  26. end
  27. end