diff options
author | Jonas Kalderstam <jonas@kalderstam.se> | 2017-06-11 17:05:23 +0200 |
---|---|---|
committer | Jonas Kalderstam <jonas@kalderstam.se> | 2017-06-11 21:23:24 +0200 |
commit | ef77fcf9d56d6f34541521ffbe5c1ca143f853b8 (patch) | |
tree | def7d77ead2a2346b3406177295a2b10f3492605 /spec | |
parent | f22d7680270c60edb572cf73a4ec39d4fe70ceb1 (diff) | |
download | gitlab-ce-ef77fcf9d56d6f34541521ffbe5c1ca143f853b8.tar.gz |
Add test for u2f helper and changelog entry
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 |