diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-12 16:12:12 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-12 16:12:12 +0300 |
commit | a87d619a1cbcf8ff41d1c4b5f48c25d59ddc895c (patch) | |
tree | 0dead1784ec0c04c55f7c01bc988578f4185bee2 /spec | |
parent | 9cb3510aed0a758045d26fac3c3610a1496eb5a2 (diff) | |
parent | ef77fcf9d56d6f34541521ffbe5c1ca143f853b8 (diff) |
Merge branch 'operau2f' into 'master'
Fix FIDO U2F for Opera browser (based on !10118)
See merge request !12082
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/u2f_helper_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/helpers/u2f_helper_spec.rb b/spec/helpers/u2f_helper_spec.rb new file mode 100644 index 00000000000..0d65b4fe0b8 --- /dev/null +++ b/spec/helpers/u2f_helper_spec.rb @@ -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 |