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
Tatuya Kamada
gitlab-ce
Commits
25aefde6
Commit
25aefde6
authored
Apr 20, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature specs for personal access token management.
parent
17f2fc10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
app/views/profiles/personal_access_tokens/index.html.haml
app/views/profiles/personal_access_tokens/index.html.haml
+2
-2
spec/features/profiles/personal_access_tokens_spec.rb
spec/features/profiles/personal_access_tokens_spec.rb
+52
-0
No files found.
app/views/profiles/personal_access_tokens/index.html.haml
View file @
25aefde6
...
...
@@ -32,7 +32,7 @@
-
if
@active_personal_access_tokens
.
exists?
.table-responsive
%table
.table.table-striped.table-hover
%table
.table.table-striped.table-hover
.active-personal-access-tokens
%thead
%tr
%th
Name
...
...
@@ -66,7 +66,7 @@
-
if
@inactive_personal_access_tokens
.
exists?
.table-responsive
%table
.table.table-striped.table-hover
%table
.table.table-striped.table-hover
.inactive-personal-access-tokens
%thead
%tr
%th
Name
...
...
spec/features/profiles/personal_access_tokens_spec.rb
0 → 100644
View file @
25aefde6
require
'spec_helper'
describe
'Profile > Personal Access Tokens'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
before
do
login_as
(
user
)
end
describe
"token creation"
do
it
"allows creation of a token with an optional expiry date"
do
visit
profile_personal_access_tokens_path
fill_in
"Name"
,
with:
FFaker
::
Product
.
brand
expect
{
click_on
"Add Personal Access Token"
}.
to
change
{
PersonalAccessToken
.
count
}.
by
(
1
)
active_personal_access_tokens
=
find
(
".table.active-personal-access-tokens"
).
native
.
inner_html
expect
(
active_personal_access_tokens
).
to
match
(
PersonalAccessToken
.
last
.
name
)
expect
(
active_personal_access_tokens
).
to
match
(
"Never"
)
expect
(
active_personal_access_tokens
).
to
match
(
PersonalAccessToken
.
last
.
token
)
fill_in
"Name"
,
with:
FFaker
::
Product
.
brand
fill_in
"Expires at"
,
with:
5
.
days
.
from_now
expect
{
click_on
"Add Personal Access Token"
}.
to
change
{
PersonalAccessToken
.
count
}.
by
(
1
)
active_personal_access_tokens
=
find
(
".table.active-personal-access-tokens"
).
native
.
inner_html
expect
(
active_personal_access_tokens
).
to
match
(
PersonalAccessToken
.
last
.
name
)
expect
(
active_personal_access_tokens
).
to
match
(
5
.
days
.
from_now
.
to_date
.
to_s
)
expect
(
active_personal_access_tokens
).
to
match
(
PersonalAccessToken
.
last
.
token
)
end
end
describe
"inactive tokens"
do
it
"allows revocation of an active token"
do
personal_access_token
=
create
(
:personal_access_token
,
user:
user
)
visit
profile_personal_access_tokens_path
click_on
"Revoke"
inactive_personal_access_tokens
=
find
(
".table.inactive-personal-access-tokens"
).
native
.
inner_html
expect
(
inactive_personal_access_tokens
).
to
match
(
personal_access_token
.
name
)
expect
(
inactive_personal_access_tokens
).
to
match
(
personal_access_token
.
token
)
end
it
"moves expired tokens to the 'inactive' section"
do
personal_access_token
=
create
(
:personal_access_token
,
expires_at:
5
.
days
.
ago
,
user:
user
)
visit
profile_personal_access_tokens_path
inactive_personal_access_tokens
=
find
(
".table.inactive-personal-access-tokens"
).
native
.
inner_html
expect
(
inactive_personal_access_tokens
).
to
match
(
personal_access_token
.
name
)
expect
(
inactive_personal_access_tokens
).
to
match
(
personal_access_token
.
token
)
end
end
end
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