diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-12-30 17:28:51 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-03 10:56:39 -0600 |
commit | 7ae2fe132c7cad345c09575493d094767cdc96ce (patch) | |
tree | 8db81ba9eee4da2ff9efefa9e74756a829ee2b39 | |
parent | 5f192c77e09a9af19268e5c5cf860ffd8c0c6216 (diff) | |
download | gitlab-ce-7ae2fe132c7cad345c09575493d094767cdc96ce.tar.gz |
fix dynamic u2f fixtures
-rw-r--r-- | spec/javascripts/fixtures/u2f.rb | 35 | ||||
-rw-r--r-- | spec/javascripts/fixtures/u2f/authenticate.html.haml | 1 | ||||
-rw-r--r-- | spec/javascripts/fixtures/u2f/register.html.haml | 2 | ||||
-rw-r--r-- | spec/javascripts/u2f/authenticate_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/u2f/register_spec.js | 2 |
5 files changed, 37 insertions, 5 deletions
diff --git a/spec/javascripts/fixtures/u2f.rb b/spec/javascripts/fixtures/u2f.rb new file mode 100644 index 00000000000..076c38ec4b1 --- /dev/null +++ b/spec/javascripts/fixtures/u2f.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe SessionsController, '(JavaScript fixtures)', type: :controller do + include JavaScriptFixturesHelpers + + before(:all) do + clean_frontend_fixtures('u2f/') + end + + it 'u2f/authenticate.html.raw' do |example| + fixture = render_template('u2f/_authenticate.html.haml', locals: { + new_user_session_path: "/users/sign_in", + params: {}, + resource_name: "user" + }) + store_frontend_fixture(fixture, example.description) + end + + it 'u2f/register.html.raw' do |example| + user = build(:user, :two_factor_via_otp) + + fixture = render_template('u2f/_register.html.haml', locals: { + create_u2f_profile_two_factor_auth_path: '/profile/two_factor_auth/create_u2f', + current_user: user + }) + store_frontend_fixture(fixture, example.description) + end + + private + + def render_template(template, **args) + controller = ApplicationController.new + controller.render_to_string(template: template, layout: false, **args) + end +end diff --git a/spec/javascripts/fixtures/u2f/authenticate.html.haml b/spec/javascripts/fixtures/u2f/authenticate.html.haml deleted file mode 100644 index 779d6429a5f..00000000000 --- a/spec/javascripts/fixtures/u2f/authenticate.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render partial: "u2f/authenticate", locals: { new_user_session_path: "/users/sign_in", params: {}, resource_name: "user" } diff --git a/spec/javascripts/fixtures/u2f/register.html.haml b/spec/javascripts/fixtures/u2f/register.html.haml deleted file mode 100644 index 5ed51be689c..00000000000 --- a/spec/javascripts/fixtures/u2f/register.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -- 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 } diff --git a/spec/javascripts/u2f/authenticate_spec.js b/spec/javascripts/u2f/authenticate_spec.js index b88b5b932a7..cd40a1e321f 100644 --- a/spec/javascripts/u2f/authenticate_spec.js +++ b/spec/javascripts/u2f/authenticate_spec.js @@ -10,7 +10,7 @@ (function() { describe('U2FAuthenticate', function() { - fixture.load('static/u2f/authenticate.html.raw'); + fixture.load('u2f/authenticate.html.raw'); beforeEach(function() { this.u2fDevice = new MockU2FDevice; this.container = $("#js-authenticate-u2f"); diff --git a/spec/javascripts/u2f/register_spec.js b/spec/javascripts/u2f/register_spec.js index 8a72c532941..9fb150a2c8f 100644 --- a/spec/javascripts/u2f/register_spec.js +++ b/spec/javascripts/u2f/register_spec.js @@ -10,7 +10,7 @@ (function() { describe('U2FRegister', function() { - fixture.load('static/u2f/register.html.raw'); + fixture.load('u2f/register.html.raw'); beforeEach(function() { this.u2fDevice = new MockU2FDevice; this.container = $("#js-register-u2f"); |