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
iv
gitlab-ce
Commits
5f43cae6
Commit
5f43cae6
authored
May 09, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add :two_factor trait to User factory
parent
b050bb5b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
spec/factories.rb
spec/factories.rb
+7
-0
spec/features/login_spec.rb
spec/features/login_spec.rb
+4
-8
No files found.
spec/factories.rb
View file @
5f43cae6
...
...
@@ -28,6 +28,13 @@ FactoryGirl.define do
admin
true
end
trait
:two_factor
do
before
(
:create
)
do
|
user
|
user
.
otp_required_for_login
=
true
user
.
otp_secret
=
User
.
generate_otp_secret
end
end
factory
:omniauth_user
do
ignore
do
extern_uid
'123456'
...
...
spec/features/login_spec.rb
View file @
5f43cae6
require
'spec_helper'
feature
'Login'
do
let
(
:user
)
{
create
(
:user
)
}
context
'with two-factor authentication'
do
before
do
user
.
otp_required_for_login
=
true
user
.
otp_secret
=
User
.
generate_otp_secret
user
.
save!
end
context
'with valid username/password'
do
let
(
:user
)
{
create
(
:user
,
:two_factor
)
}
before
do
login_with
(
user
)
expect
(
page
).
to
have_content
(
'Two-factor Authentication'
)
...
...
@@ -80,6 +74,8 @@ feature 'Login' do
end
context
'without two-factor authentication'
do
let
(
:user
)
{
create
(
:user
)
}
it
'allows basic login'
do
login_with
(
user
)
expect
(
current_path
).
to
eq
root_path
...
...
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