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
Léo-Paul Géneau
gitlab-ce
Commits
9ed91479
Commit
9ed91479
authored
Nov 20, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the missing spec
parent
869fc05d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
app/models/system_note_metadata.rb
app/models/system_note_metadata.rb
+2
-2
spec/models/note_spec.rb
spec/models/note_spec.rb
+31
-0
No files found.
app/models/system_note_metadata.rb
View file @
9ed91479
...
...
@@ -5,8 +5,8 @@ class SystemNoteMetadata < ActiveRecord::Base
# Other notes can always be safely shown as all its references are
# in the same project (i.e. with the same permissions)
TYPES_WITH_CROSS_REFERENCES
=
%w[
cross_reference
mileston
e
c
ommit c
ross_reference
close duplicat
e
]
.
freeze
ICON_TYPES
=
%w[
...
...
spec/models/note_spec.rb
View file @
9ed91479
...
...
@@ -231,6 +231,37 @@ describe Note do
end
end
describe
'#cross_reference?'
do
it
'falsey for user-generated notes'
do
note
=
create
(
:note
,
system:
false
)
expect
(
note
.
cross_reference?
).
to
be_falsy
end
context
'when the note might contain cross references'
do
SystemNoteMetadata
::
TYPES_WITH_CROSS_REFERENCES
.
each
do
|
type
|
let
(
:note
)
{
create
(
:note
,
:system
)
}
let!
(
:metadata
)
{
create
(
:system_note_metadata
,
note:
note
,
action:
type
)
}
it
'delegates to the cross-reference regex'
do
expect
(
note
).
to
receive
(
:matches_cross_reference_regex?
).
and_return
(
false
)
note
.
cross_reference?
end
end
end
context
'when the note cannot contain cross references'
do
let
(
:commit_note
)
{
build
(
:note
,
note:
'mentioned in 1312312313 something else.'
,
system:
true
)
}
let
(
:label_note
)
{
build
(
:note
,
note:
'added ~2323232323'
,
system:
true
)
}
it
'scan for a `mentioned in` prefix'
do
expect
(
commit_note
.
cross_reference?
).
to
be_truthy
expect
(
label_note
.
cross_reference?
).
to
be_falsy
end
end
end
describe
'clear_blank_line_code!'
do
it
'clears a blank line code before validation'
do
note
=
build
(
:note
,
line_code:
' '
)
...
...
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