2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
context 'U2F' do
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
let(:user) { create(:user, :two_factor_via_u2f) }
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('u2f/')
|
|
|
|
end
|
|
|
|
|
|
|
|
describe SessionsController, '(JavaScript fixtures)', type: :controller do
|
2017-09-10 17:25:29 +05:30
|
|
|
include DeviseHelpers
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
render_views
|
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
set_devise_mapping(context: @request)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'u2f/authenticate.html.raw' do |example|
|
|
|
|
allow(controller).to receive(:find_user).and_return(user)
|
|
|
|
|
2019-02-13 22:33:31 +05:30
|
|
|
post :create, params: { user: { login: user.username, password: user.password } }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, example.description)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe Profiles::TwoFactorAuthsController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
render_views
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'u2f/register.html.raw' do |example|
|
|
|
|
get :show
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, example.description)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|