0
0
Fork 0

Helpers specs coverage improvement (#23937)

This commit is contained in:
Matt Jankowski 2023-03-04 10:58:11 -05:00 committed by GitHub
parent 00eb2269b6
commit 2f606ba122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 216 additions and 10 deletions

View file

@ -0,0 +1,37 @@
# frozen_string_literal: true
require 'rails_helper'
describe SettingsHelper do
describe 'session_device_icon' do
context 'with a mobile device' do
let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (iPhone)') }
it 'detects the device and returns a descriptive string' do
result = helper.session_device_icon(session)
expect(result).to eq('mobile')
end
end
context 'with a tablet device' do
let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (iPad)') }
it 'detects the device and returns a descriptive string' do
result = helper.session_device_icon(session)
expect(result).to eq('tablet')
end
end
context 'with a desktop device' do
let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (Macintosh)') }
it 'detects the device and returns a descriptive string' do
result = helper.session_device_icon(session)
expect(result).to eq('desktop')
end
end
end
end