Commit df5223de authored by Mike Greiling's avatar Mike Greiling

generate u2f frontend fixtures dynamically

parent 8cee3b1d
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
render_views
before do
@request.env['devise.mapping'] = Devise.mappings[:user]
end
it 'u2f/authenticate.html.raw' do |example|
allow(controller).to receive(:find_user).and_return(user)
post :create, user: { login: user.username, password: user.password }
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
= render partial: "u2f/authenticate", locals: { new_user_session_path: "/users/sign_in", params: {}, resource_name: "user" }
- user = FactoryGirl.build(:user, :two_factor_via_otp)
= render partial: "u2f/register", locals: { create_u2f_profile_two_factor_auth_path: '/profile/two_factor_auth/create_u2f', current_user: user }
......@@ -10,8 +10,10 @@
(function() {
describe('U2FAuthenticate', function() {
fixture.load('u2f/authenticate');
fixture.preload('u2f/authenticate.html.raw');
beforeEach(function() {
fixture.load('u2f/authenticate.html.raw');
this.u2fDevice = new MockU2FDevice;
this.container = $("#js-authenticate-u2f");
this.component = new window.gl.U2FAuthenticate(
......
......@@ -10,8 +10,10 @@
(function() {
describe('U2FRegister', function() {
fixture.load('u2f/register');
fixture.preload('u2f/register.html.raw');
beforeEach(function() {
fixture.load('u2f/register.html.raw');
this.u2fDevice = new MockU2FDevice;
this.container = $("#js-register-u2f");
this.component = new U2FRegister(this.container, $("#js-register-u2f-templates"), {}, "token");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment