diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-12-31 02:28:51 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-03 19:56:39 +0300 |
commit | 7ae2fe132c7cad345c09575493d094767cdc96ce (patch) | |
tree | 8db81ba9eee4da2ff9efefa9e74756a829ee2b39 /spec/javascripts/fixtures | |
parent | 5f192c77e09a9af19268e5c5cf860ffd8c0c6216 (diff) |
fix dynamic u2f fixtures
Diffstat (limited to 'spec/javascripts/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 |
3 files changed, 35 insertions, 3 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 } |