d4bde8621c
for f in $(find spec/javascripts/fixtures/ -name '*.rb') do sed 's/do |example|/do/' < $f > $f.tmp; mv $f.tmp $f done
44 lines
1 KiB
Ruby
44 lines
1 KiB
Ruby
require 'spec_helper'
|
|
|
|
context 'U2F' do
|
|
include JavaScriptFixturesHelpers
|
|
|
|
let(:user) { create(:user, :two_factor_via_u2f, otp_secret: 'otpsecret:coolkids') }
|
|
|
|
before(:all) do
|
|
clean_frontend_fixtures('u2f/')
|
|
end
|
|
|
|
describe SessionsController, '(JavaScript fixtures)', type: :controller do
|
|
include DeviseHelpers
|
|
|
|
render_views
|
|
|
|
before do
|
|
set_devise_mapping(context: @request)
|
|
end
|
|
|
|
it 'u2f/authenticate.html' do
|
|
allow(controller).to receive(:find_user).and_return(user)
|
|
|
|
post :create, params: { user: { login: user.username, password: user.password } }
|
|
|
|
expect(response).to be_success
|
|
end
|
|
end
|
|
|
|
describe Profiles::TwoFactorAuthsController, '(JavaScript fixtures)', type: :controller do
|
|
render_views
|
|
|
|
before do
|
|
sign_in(user)
|
|
allow_any_instance_of(Profiles::TwoFactorAuthsController).to receive(:build_qr_code).and_return('qrcode:blackandwhitesquares')
|
|
end
|
|
|
|
it 'u2f/register.html' do
|
|
get :show
|
|
|
|
expect(response).to be_success
|
|
end
|
|
end
|
|
end
|