Add test for u2f helper and changelog entry
This commit is contained in:
parent
f22d768027
commit
ef77fcf9d5
2 changed files with 53 additions and 0 deletions
4
changelogs/unreleased/fix-u2f-for-opera.yml
Normal file
4
changelogs/unreleased/fix-u2f-for-opera.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Fix FIDO U2F for Opera browser
|
||||||
|
merge_request: 12082
|
||||||
|
author: Jakub Kramarz and Jonas Kalderstam
|
49
spec/helpers/u2f_helper_spec.rb
Normal file
49
spec/helpers/u2f_helper_spec.rb
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe U2fHelper do
|
||||||
|
describe 'when not on mobile' do
|
||||||
|
it 'does not inject u2f on chrome 40' do
|
||||||
|
device = double(mobile?: false)
|
||||||
|
browser = double(chrome?: true, opera?: false, version: 40, device: device)
|
||||||
|
allow(helper).to receive(:browser).and_return(browser)
|
||||||
|
expect(helper.inject_u2f_api?).to eq false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'injects u2f on chrome 41' do
|
||||||
|
device = double(mobile?: false)
|
||||||
|
browser = double(chrome?: true, opera?: false, version: 41, device: device)
|
||||||
|
allow(helper).to receive(:browser).and_return(browser)
|
||||||
|
expect(helper.inject_u2f_api?).to eq true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not inject u2f on opera 39' do
|
||||||
|
device = double(mobile?: false)
|
||||||
|
browser = double(chrome?: false, opera?: true, version: 39, device: device)
|
||||||
|
allow(helper).to receive(:browser).and_return(browser)
|
||||||
|
expect(helper.inject_u2f_api?).to eq false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'injects u2f on opera 40' do
|
||||||
|
device = double(mobile?: false)
|
||||||
|
browser = double(chrome?: false, opera?: true, version: 40, device: device)
|
||||||
|
allow(helper).to receive(:browser).and_return(browser)
|
||||||
|
expect(helper.inject_u2f_api?).to eq true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when on mobile' do
|
||||||
|
it 'does not inject u2f on chrome 41' do
|
||||||
|
device = double(mobile?: true)
|
||||||
|
browser = double(chrome?: true, opera?: false, version: 41, device: device)
|
||||||
|
allow(helper).to receive(:browser).and_return(browser)
|
||||||
|
expect(helper.inject_u2f_api?).to eq false
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not inject u2f on opera 40' do
|
||||||
|
device = double(mobile?: true)
|
||||||
|
browser = double(chrome?: false, opera?: true, version: 40, device: device)
|
||||||
|
allow(helper).to receive(:browser).and_return(browser)
|
||||||
|
expect(helper.inject_u2f_api?).to eq false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue