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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ca786c4f
Commit
ca786c4f
authored
Nov 13, 2018
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs and system note service
parent
086b0ef1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
ee/app/services/ee/system_note_service.rb
ee/app/services/ee/system_note_service.rb
+5
-2
ee/app/services/epics/issue_promote_service.rb
ee/app/services/epics/issue_promote_service.rb
+2
-2
ee/spec/services/epics/issue_promote_service_spec.rb
ee/spec/services/epics/issue_promote_service_spec.rb
+3
-5
ee/spec/services/system_note_service_spec.rb
ee/spec/services/system_note_service_spec.rb
+2
-2
No files found.
ee/app/services/ee/system_note_service.rb
View file @
ca786c4f
...
...
@@ -69,8 +69,11 @@ module EE
create_note
(
NoteSummary
.
new
(
object_epic
,
nil
,
user
,
body
,
action:
action
))
end
def
issue_promoted
(
noteable
,
noteable_ref
,
author
)
direction
=
noteable
.
is_a?
(
Epic
)
?
:from
:
:to
def
issue_promoted
(
noteable
,
noteable_ref
,
author
,
direction
:)
unless
[
:to
,
:from
].
include?
(
direction
)
raise
ArgumentError
,
"Invalid direction `
#{
direction
}
`"
end
project
=
noteable
.
project
cross_reference
=
noteable_ref
.
to_reference
(
project
||
noteable
.
group
)
...
...
ee/app/services/epics/issue_promote_service.rb
View file @
ca786c4f
...
...
@@ -33,11 +33,11 @@ module Epics
end
def
add_note_from
SystemNoteService
.
issue_promoted
(
new_entity
,
original_entity
,
current_user
)
SystemNoteService
.
issue_promoted
(
new_entity
,
original_entity
,
current_user
,
direction: :from
)
end
def
add_note_to
SystemNoteService
.
issue_promoted
(
original_entity
,
new_entity
,
current_user
)
SystemNoteService
.
issue_promoted
(
original_entity
,
new_entity
,
current_user
,
direction: :to
)
end
end
end
ee/spec/services/epics/issue_promote_service_spec.rb
View file @
ca786c4f
...
...
@@ -16,9 +16,7 @@ describe Epics::IssuePromoteService do
subject
{
described_class
.
new
(
issue
.
project
,
user
)
}
def
epic
Epic
.
last
end
let
(
:epic
)
{
Epic
.
last
}
describe
'#execute'
do
context
'when epics are not enabled'
do
...
...
@@ -52,7 +50,7 @@ describe Epics::IssuePromoteService do
other_issue
=
create
(
:issue
,
project:
create
(
:project
))
expect
{
subject
.
execute
(
other_issue
)
}
.
to
raise_error
(
Epics
::
IssuePromoteService
::
PromoteError
,
/group/
)
.
to
raise_error
(
Epics
::
IssuePromoteService
::
PromoteError
,
/group/
)
end
end
...
...
@@ -70,7 +68,7 @@ describe Epics::IssuePromoteService do
end
it
'copies group labels assigned to the issue'
do
expect
(
Epic
.
last
.
labels
).
to
eq
([
label1
])
expect
(
epic
.
labels
).
to
eq
([
label1
])
end
it
'creates a system note on the issue'
do
...
...
ee/spec/services/system_note_service_spec.rb
View file @
ca786c4f
...
...
@@ -99,7 +99,7 @@ describe SystemNoteService do
context
'.issue_promoted'
do
context
'note on the epic'
do
subject
{
described_class
.
issue_promoted
(
epic
,
issue
,
author
)
}
subject
{
described_class
.
issue_promoted
(
epic
,
issue
,
author
,
direction: :from
)
}
it_behaves_like
'a system note'
do
let
(
:action
)
{
'moved'
}
...
...
@@ -112,7 +112,7 @@ describe SystemNoteService do
end
context
'note on the issue'
do
subject
{
described_class
.
issue_promoted
(
issue
,
epic
,
author
)
}
subject
{
described_class
.
issue_promoted
(
issue
,
epic
,
author
,
direction: :to
)
}
it_behaves_like
'a system note'
do
let
(
:action
)
{
'moved'
}
...
...
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