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
1019dff2
Commit
1019dff2
authored
May 02, 2018
by
Chantal Rollison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of 1481-changing-weight-values-should-trigger-system-notes
parent
ff778061
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
32 deletions
+34
-32
app/controllers/concerns/issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+0
-1
app/models/system_note_metadata.rb
app/models/system_note_metadata.rb
+5
-1
spec/lib/gitlab/incoming_email_spec.rb
spec/lib/gitlab/incoming_email_spec.rb
+2
-2
spec/services/issuable/common_system_notes_service_spec.rb
spec/services/issuable/common_system_notes_service_spec.rb
+0
-28
spec/support/shared_examples/common_system_notes_examples.rb
spec/support/shared_examples/common_system_notes_examples.rb
+27
-0
No files found.
app/controllers/concerns/issuable_actions.rb
View file @
1019dff2
...
...
@@ -18,7 +18,6 @@ module IssuableActions
def
update
@issuable
=
update_service
.
execute
(
issuable
)
# rubocop:disable Gitlab/ModuleWithInstanceVariables
respond_to
do
|
format
|
format
.
html
do
recaptcha_check_if_spammable
{
render
:edit
}
...
...
app/models/system_note_metadata.rb
View file @
1019dff2
...
...
@@ -17,7 +17,11 @@ class SystemNoteMetadata < ActiveRecord::Base
]
.
freeze
validates
:note
,
presence:
true
validates
:action
,
inclusion:
ICON_TYPES
,
allow_nil:
true
validates
:action
,
inclusion:
{
in: :icon_types
}
,
allow_nil:
true
belongs_to
:note
def
icon_types
ICON_TYPES
end
end
spec/lib/gitlab/incoming_email_spec.rb
View file @
1019dff2
...
...
@@ -24,7 +24,7 @@ describe Gitlab::IncomingEmail do
end
describe
'self.supports_wildcard?'
do
context
'address contains the wildard placeholder'
do
context
'address contains the wild
c
ard placeholder'
do
before
do
stub_incoming_email_setting
(
address:
'replies+%{key}@example.com'
)
end
...
...
@@ -49,7 +49,7 @@ describe Gitlab::IncomingEmail do
stub_incoming_email_setting
(
address:
nil
)
end
it
'returns that wildard is not supported'
do
it
'returns that wild
c
ard is not supported'
do
expect
(
described_class
.
supports_wildcard?
).
to
be_falsey
end
end
...
...
spec/services/issuable/common_system_notes_service_spec.rb
View file @
1019dff2
...
...
@@ -5,34 +5,6 @@ describe Issuable::CommonSystemNotesService do
let
(
:project
)
{
create
(
:project
)
}
let
(
:issuable
)
{
create
(
:issue
)
}
shared_examples
'system note creation'
do
|
update_params
,
note_text
|
subject
{
described_class
.
new
(
project
,
user
).
execute
(
issuable
,
[])}
before
do
issuable
.
assign_attributes
(
update_params
)
issuable
.
save
end
it
'creates 1 system note with the correct content'
do
expect
{
subject
}.
to
change
{
Note
.
count
}.
from
(
0
).
to
(
1
)
note
=
Note
.
last
expect
(
note
.
note
).
to
match
(
note_text
)
expect
(
note
.
noteable_type
).
to
eq
(
issuable
.
class
.
name
)
end
end
shared_examples
'WIP notes creation'
do
|
wip_action
|
subject
{
described_class
.
new
(
project
,
user
).
execute
(
issuable
,
[])
}
it
'creates WIP toggle and title change notes'
do
expect
{
subject
}.
to
change
{
Note
.
count
}.
from
(
0
).
to
(
2
)
expect
(
Note
.
first
.
note
).
to
match
(
"
#{
wip_action
}
as a **Work In Progress**"
)
expect
(
Note
.
second
.
note
).
to
match
(
'changed title'
)
end
end
describe
'#execute'
do
it_behaves_like
'system note creation'
,
{
title:
'New title'
},
'changed title'
it_behaves_like
'system note creation'
,
{
description:
'New description'
},
'changed the description'
...
...
spec/support/shared_examples/common_system_notes_examples.rb
0 → 100644
View file @
1019dff2
shared_examples
'system note creation'
do
|
update_params
,
note_text
|
subject
{
described_class
.
new
(
project
,
user
).
execute
(
issuable
,
[])}
before
do
issuable
.
assign_attributes
(
update_params
)
issuable
.
save
end
it
'creates 1 system note with the correct content'
do
expect
{
subject
}.
to
change
{
Note
.
count
}.
from
(
0
).
to
(
1
)
note
=
Note
.
last
expect
(
note
.
note
).
to
match
(
note_text
)
expect
(
note
.
noteable_type
).
to
eq
(
issuable
.
class
.
name
)
end
end
shared_examples
'WIP notes creation'
do
|
wip_action
|
subject
{
described_class
.
new
(
project
,
user
).
execute
(
issuable
,
[])
}
it
'creates WIP toggle and title change notes'
do
expect
{
subject
}.
to
change
{
Note
.
count
}.
from
(
0
).
to
(
2
)
expect
(
Note
.
first
.
note
).
to
match
(
"
#{
wip_action
}
as a **Work In Progress**"
)
expect
(
Note
.
second
.
note
).
to
match
(
'changed title'
)
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