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
4d8ed01b
Commit
4d8ed01b
authored
Sep 24, 2019
by
Eugenia Grieff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs to cover label and milestone notes
parent
8684d67a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
spec/models/note_spec.rb
spec/models/note_spec.rb
+57
-0
No files found.
spec/models/note_spec.rb
View file @
4d8ed01b
...
@@ -379,6 +379,63 @@ describe Note do
...
@@ -379,6 +379,63 @@ describe Note do
expect
(
label_note
.
cross_reference?
).
to
be_falsy
expect
(
label_note
.
cross_reference?
).
to
be_falsy
end
end
end
end
context
'when system note metadata is not present'
do
let
(
:note
)
{
build
(
:note
,
:system
)
}
before
do
allow
(
note
).
to
receive
(
:system_note_metadata
).
and_return
(
nil
)
end
it
'delegates to the system note service'
do
expect
(
SystemNotes
::
IssuablesService
).
to
receive
(
:cross_reference?
).
with
(
note
.
note
)
note
.
cross_reference?
end
end
context
'with a system note'
do
let
(
:issue
)
{
create
(
:issue
,
project:
create
(
:project
,
:repository
))
}
let
(
:note
)
{
create
(
:system_note
,
note:
"test"
,
noteable:
issue
,
project:
issue
.
project
)
}
shared_examples
'system_note_metadata includes note action'
do
it
'delegates to the cross-reference regex'
do
expect
(
note
).
to
receive
(
:matches_cross_reference_regex?
)
note
.
cross_reference?
end
end
context
'with :label action'
do
let!
(
:metadata
)
{
create
(
:system_note_metadata
,
note:
note
,
action: :label
)}
it_behaves_like
'system_note_metadata includes note action'
it
{
expect
(
note
.
cross_reference?
).
to
be_falsy
}
context
'with cross reference label note'
do
let
(
:label
)
{
create
(
:label
,
project:
issue
.
project
)}
let
(
:note
)
{
create
(
:system_note
,
note:
"added
#{
label
.
to_reference
}
label"
,
noteable:
issue
,
project:
issue
.
project
)
}
it
{
expect
(
note
.
cross_reference?
).
to
be_truthy
}
end
end
context
'with :milestone action'
do
let!
(
:metadata
)
{
create
(
:system_note_metadata
,
note:
note
,
action: :milestone
)}
it_behaves_like
'system_note_metadata includes note action'
it
{
expect
(
note
.
cross_reference?
).
to
be_falsy
}
context
'with cross reference milestone note'
do
let
(
:milestone
)
{
create
(
:milestone
,
project:
issue
.
project
)}
let
(
:note
)
{
create
(
:system_note
,
note:
"added
#{
milestone
.
to_reference
}
milestone"
,
noteable:
issue
,
project:
issue
.
project
)
}
it
{
expect
(
note
.
cross_reference?
).
to
be_truthy
}
end
end
end
end
end
describe
'clear_blank_line_code!'
do
describe
'clear_blank_line_code!'
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