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
d6eaf38b
Commit
d6eaf38b
authored
Jul 21, 2018
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit notes now support quick actions
parent
f89a91d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
42 deletions
+4
-42
spec/services/notes/quick_actions_service_spec.rb
spec/services/notes/quick_actions_service_spec.rb
+4
-42
No files found.
spec/services/notes/quick_actions_service_spec.rb
View file @
d6eaf38b
...
...
@@ -11,40 +11,6 @@ describe Notes::QuickActionsService do
end
end
shared_examples
'note on noteable that does not support quick actions'
do
include_context
'note on noteable'
before
do
note
.
note
=
note_text
end
describe
'note with only command'
do
describe
'/close, /label, /assign & /milestone'
do
let
(
:note_text
)
{
%(/close\n/assign @#{assignee.username}")
}
it
'saves the note and does not alter the note text'
do
content
,
command_params
=
service
.
extract_commands
(
note
)
expect
(
content
).
to
eq
note_text
expect
(
command_params
).
to
be_empty
end
end
end
describe
'note with command & text'
do
describe
'/close, /label, /assign & /milestone'
do
let
(
:note_text
)
{
%(HELLO\n/close\n/assign @#{assignee.username}\nWORLD)
}
it
'saves the note and does not alter the note text'
do
content
,
command_params
=
service
.
extract_commands
(
note
)
expect
(
content
).
to
eq
note_text
expect
(
command_params
).
to
be_empty
end
end
end
end
shared_examples
'note on noteable that supports quick actions'
do
include_context
'note on noteable'
...
...
@@ -147,16 +113,16 @@ describe Notes::QuickActionsService do
expect
(
described_class
.
noteable_update_service
(
note
)).
to
eq
(
Issues
::
UpdateService
)
end
it
'returns
Issue
s::UpdateService for a note on a merge request'
do
it
'returns
MergeRequest
s::UpdateService for a note on a merge request'
do
note
=
create
(
:note_on_merge_request
,
project:
project
)
expect
(
described_class
.
noteable_update_service
(
note
)).
to
eq
(
MergeRequests
::
UpdateService
)
end
it
'returns
nil
for a note on a commit'
do
it
'returns
Commits::UpdateService
for a note on a commit'
do
note
=
create
(
:note_on_commit
,
project:
project
)
expect
(
described_class
.
noteable_update_service
(
note
)).
to
be_nil
expect
(
described_class
.
noteable_update_service
(
note
)).
to
eq
(
Commits
::
UpdateService
)
end
end
...
...
@@ -175,7 +141,7 @@ describe Notes::QuickActionsService do
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
it
'returns false'
do
expect
(
described_class
.
supported?
(
note
)).
to
be_
fals
y
expect
(
described_class
.
supported?
(
note
)).
to
be_
truth
y
end
end
end
...
...
@@ -203,10 +169,6 @@ describe Notes::QuickActionsService do
it_behaves_like
'note on noteable that supports quick actions'
do
let
(
:note
)
{
build
(
:note_on_merge_request
,
project:
project
)
}
end
it_behaves_like
'note on noteable that does not support quick actions'
do
let
(
:note
)
{
build
(
:note_on_commit
,
project:
project
)
}
end
end
context
'CE restriction for issue assignees'
do
...
...
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