BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
system_note_metadata.rb
app/models/system_note_metadata.rb
+2
-2
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
...
@@ -5,8 +5,8 @@ class SystemNoteMetadata < ActiveRecord::Base
# Other notes can always be safely shown as all its references are
# Other notes can always be safely shown as all its references are
# in the same project (i.e. with the same permissions)
# in the same project (i.e. with the same permissions)
TYPES_WITH_CROSS_REFERENCES
=
%w[
TYPES_WITH_CROSS_REFERENCES
=
%w[
cross_reference
c
ommit c
ross_reference
mileston
e
close duplicat
e
]
.
freeze
]
.
freeze
ICON_TYPES
=
%w[
ICON_TYPES
=
%w[
...
...
spec/models/note_spec.rb
View file @
9ed91479
...
@@ -231,6 +231,37 @@ describe Note do
...
@@ -231,6 +231,37 @@ describe Note do
end
end
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
describe
'clear_blank_line_code!'
do
it
'clears a blank line code before validation'
do
it
'clears a blank line code before validation'
do
note
=
build
(
:note
,
line_code:
' '
)
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