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
Boxiang Sun
gitlab-ce
Commits
ba8a1ec9
Commit
ba8a1ec9
authored
Dec 20, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some specs for trigger presenter
parent
69486116
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
spec/presenters/ci/trigger_presenter_spec.rb
spec/presenters/ci/trigger_presenter_spec.rb
+51
-0
No files found.
spec/presenters/ci/trigger_presenter_spec.rb
0 → 100644
View file @
ba8a1ec9
require
'spec_helper'
describe
Ci
::
TriggerPresenter
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
set
(
:trigger
)
do
create
(
:ci_trigger
,
token:
'123456789abcd'
,
project:
project
)
end
let
(
:subject
)
do
described_class
.
new
(
trigger
,
current_user:
user
)
end
before
do
project
.
add_maintainer
(
user
)
end
context
'when user is not a trigger owner'
do
describe
'#token'
do
it
'exposes only short token'
do
expect
(
subject
.
token
).
not_to
eq
trigger
.
token
expect
(
subject
.
token
).
to
eq
'1234'
end
end
describe
'#has_token_exposed?'
do
it
'does not have token exposed'
do
expect
(
subject
).
not_to
have_token_exposed
end
end
end
context
'when user is a trigger owner and builds admin'
do
before
do
trigger
.
update
(
owner:
user
)
end
describe
'#token'
do
it
'exposes full token'
do
expect
(
subject
.
token
).
to
eq
trigger
.
token
end
end
describe
'#has_token_exposed?'
do
it
'has token exposed'
do
expect
(
subject
).
to
have_token_exposed
end
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