Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
81dfb1aa
Commit
81dfb1aa
authored
Jan 05, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-u2f-fixtures' into 'master'
Replace static JavaScript fixtures for u2f See merge request !8426
parents
76bb8ed4
df5223de
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
6 deletions
+51
-6
spec/javascripts/fixtures/u2f.rb
spec/javascripts/fixtures/u2f.rb
+43
-0
spec/javascripts/fixtures/u2f/authenticate.html.haml
spec/javascripts/fixtures/u2f/authenticate.html.haml
+0
-1
spec/javascripts/fixtures/u2f/register.html.haml
spec/javascripts/fixtures/u2f/register.html.haml
+0
-2
spec/javascripts/u2f/authenticate_spec.js
spec/javascripts/u2f/authenticate_spec.js
+3
-1
spec/javascripts/u2f/register_spec.js
spec/javascripts/u2f/register_spec.js
+3
-1
spec/support/javascript_fixtures_helpers.rb
spec/support/javascript_fixtures_helpers.rb
+2
-1
No files found.
spec/javascripts/fixtures/u2f.rb
0 → 100644
View file @
81dfb1aa
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
spec/javascripts/fixtures/u2f/authenticate.html.haml
deleted
100644 → 0
View file @
76bb8ed4
=
render
partial:
"u2f/authenticate"
,
locals:
{
new_user_session_path:
"/users/sign_in"
,
params:
{},
resource_name:
"user"
}
spec/javascripts/fixtures/u2f/register.html.haml
deleted
100644 → 0
View file @
76bb8ed4
-
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
}
spec/javascripts/u2f/authenticate_spec.js
View file @
81dfb1aa
...
@@ -10,8 +10,10 @@
...
@@ -10,8 +10,10 @@
(
function
()
{
(
function
()
{
describe
(
'
U2FAuthenticate
'
,
function
()
{
describe
(
'
U2FAuthenticate
'
,
function
()
{
fixture
.
load
(
'
u2f/authenticate
'
);
fixture
.
preload
(
'
u2f/authenticate.html.raw
'
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
fixture
.
load
(
'
u2f/authenticate.html.raw
'
);
this
.
u2fDevice
=
new
MockU2FDevice
;
this
.
u2fDevice
=
new
MockU2FDevice
;
this
.
container
=
$
(
"
#js-authenticate-u2f
"
);
this
.
container
=
$
(
"
#js-authenticate-u2f
"
);
this
.
component
=
new
window
.
gl
.
U2FAuthenticate
(
this
.
component
=
new
window
.
gl
.
U2FAuthenticate
(
...
...
spec/javascripts/u2f/register_spec.js
View file @
81dfb1aa
...
@@ -10,8 +10,10 @@
...
@@ -10,8 +10,10 @@
(
function
()
{
(
function
()
{
describe
(
'
U2FRegister
'
,
function
()
{
describe
(
'
U2FRegister
'
,
function
()
{
fixture
.
load
(
'
u2f/register
'
);
fixture
.
preload
(
'
u2f/register.html.raw
'
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
fixture
.
load
(
'
u2f/register.html.raw
'
);
this
.
u2fDevice
=
new
MockU2FDevice
;
this
.
u2fDevice
=
new
MockU2FDevice
;
this
.
container
=
$
(
"
#js-register-u2f
"
);
this
.
container
=
$
(
"
#js-register-u2f
"
);
this
.
component
=
new
U2FRegister
(
this
.
container
,
$
(
"
#js-register-u2f-templates
"
),
{},
"
token
"
);
this
.
component
=
new
U2FRegister
(
this
.
container
,
$
(
"
#js-register-u2f-templates
"
),
{},
"
token
"
);
...
...
spec/support/javascript_fixtures_helpers.rb
View file @
81dfb1aa
...
@@ -26,6 +26,7 @@ module JavaScriptFixturesHelpers
...
@@ -26,6 +26,7 @@ module JavaScriptFixturesHelpers
def
store_frontend_fixture
(
response
,
fixture_file_name
)
def
store_frontend_fixture
(
response
,
fixture_file_name
)
fixture_file_name
=
File
.
expand_path
(
fixture_file_name
,
FIXTURE_PATH
)
fixture_file_name
=
File
.
expand_path
(
fixture_file_name
,
FIXTURE_PATH
)
fixture
=
response
.
body
fixture
=
response
.
body
fixture
.
force_encoding
(
"utf-8"
)
response_mime_type
=
Mime
::
Type
.
lookup
(
response
.
content_type
)
response_mime_type
=
Mime
::
Type
.
lookup
(
response
.
content_type
)
if
response_mime_type
.
html?
if
response_mime_type
.
html?
...
@@ -34,7 +35,7 @@ module JavaScriptFixturesHelpers
...
@@ -34,7 +35,7 @@ module JavaScriptFixturesHelpers
link_tags
=
doc
.
css
(
'link'
)
link_tags
=
doc
.
css
(
'link'
)
link_tags
.
remove
link_tags
.
remove
scripts
=
doc
.
css
(
'script'
)
scripts
=
doc
.
css
(
"script:not([type='text/template'])"
)
scripts
.
remove
scripts
.
remove
fixture
=
doc
.
to_html
fixture
=
doc
.
to_html
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment