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
222b0f08
Commit
222b0f08
authored
Nov 02, 2018
by
George Tsiolis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update event helper spec to check for target prefix
parent
51eab413
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
16 deletions
+32
-16
changelogs/unreleased/gt-use-merge-request-prefix-in-event-feed-title.yml
...eased/gt-use-merge-request-prefix-in-event-feed-title.yml
+1
-1
spec/helpers/events_helper_spec.rb
spec/helpers/events_helper_spec.rb
+31
-15
No files found.
changelogs/unreleased/gt-use-merge-request-prefix-in-event-feed-title.yml
View file @
222b0f08
---
---
title
:
Use merge request prefix symbol in event fetitle
title
:
Use merge request prefix symbol in event fe
ed
title
merge_request
:
22449
merge_request
:
22449
author
:
George Tsiolis
author
:
George Tsiolis
type
:
changed
type
:
changed
spec/helpers/events_helper_spec.rb
View file @
222b0f08
...
@@ -2,18 +2,18 @@ require 'spec_helper'
...
@@ -2,18 +2,18 @@ require 'spec_helper'
describe
EventsHelper
do
describe
EventsHelper
do
describe
'#event_commit_title'
do
describe
'#event_commit_title'
do
let
(
:message
)
{
"foo & bar "
+
"A"
*
70
+
"
\n
"
+
"B"
*
80
}
let
(
:message
)
{
'foo & bar '
+
'A'
*
70
+
'\n'
+
'B'
*
80
}
subject
{
helper
.
event_commit_title
(
message
)
}
subject
{
helper
.
event_commit_title
(
message
)
}
it
"returns the first line, truncated to 70 chars"
do
it
'returns the first line, truncated to 70 chars'
do
is_expected
.
to
eq
(
message
[
0
..
66
]
+
"..."
)
is_expected
.
to
eq
(
message
[
0
..
66
]
+
"..."
)
end
end
it
"is not html-safe"
do
it
'is not html-safe'
do
is_expected
.
not_to
be_a
(
ActiveSupport
::
SafeBuffer
)
is_expected
.
not_to
be_a
(
ActiveSupport
::
SafeBuffer
)
end
end
it
"handles empty strings"
do
it
'handles empty strings'
do
expect
(
helper
.
event_commit_title
(
""
)).
to
eq
(
""
)
expect
(
helper
.
event_commit_title
(
""
)).
to
eq
(
""
)
end
end
...
@@ -22,7 +22,7 @@ describe EventsHelper do
...
@@ -22,7 +22,7 @@ describe EventsHelper do
end
end
it
'does not escape HTML entities'
do
it
'does not escape HTML entities'
do
expect
(
helper
.
event_commit_title
(
"foo & bar"
)).
to
eq
(
"foo & bar"
)
expect
(
helper
.
event_commit_title
(
'foo & bar'
)).
to
eq
(
'foo & bar'
)
end
end
end
end
...
@@ -30,38 +30,54 @@ describe EventsHelper do
...
@@ -30,38 +30,54 @@ describe EventsHelper do
let
(
:event
)
{
create
(
:event
)
}
let
(
:event
)
{
create
(
:event
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
it
"returns project issue url"
do
context
'issue'
do
event
.
target
=
create
(
:issue
)
before
do
event
.
target
=
create
(
:issue
)
end
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_issue_url
(
event
.
project
,
event
.
issue
))
it
'returns the project issue url'
do
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_issue_url
(
event
.
project
,
event
.
target
))
end
it
'contains the project issue IID link'
do
expect
(
helper
.
event_feed_title
(
event
)).
to
include
(
"#
#{
event
.
target
.
iid
}
"
)
end
end
end
it
"returns project merge_request url"
do
context
'merge request'
do
event
.
target
=
create
(
:merge_request
)
before
do
event
.
target
=
create
(
:merge_request
)
end
it
'returns the project merge request url'
do
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_merge_request_url
(
event
.
project
,
event
.
target
))
end
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_merge_request_url
(
event
.
project
,
event
.
merge_request
))
it
'contains the project merge request IID link'
do
expect
(
helper
.
event_feed_title
(
event
)).
to
include
(
"!
#{
event
.
target
.
iid
}
"
)
end
end
end
it
"returns project commit url"
do
it
'returns project commit url'
do
event
.
target
=
create
(
:note_on_commit
,
project:
project
)
event
.
target
=
create
(
:note_on_commit
,
project:
project
)
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_commit_url
(
event
.
project
,
event
.
note_target
))
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_commit_url
(
event
.
project
,
event
.
note_target
))
end
end
it
"returns event note target url"
do
it
'returns event note target url'
do
event
.
target
=
create
(
:note
)
event
.
target
=
create
(
:note
)
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
event_note_target_url
(
event
))
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
event_note_target_url
(
event
))
end
end
it
"returns project url"
do
it
'returns project url'
do
event
.
project
=
project
event
.
project
=
project
event
.
action
=
1
event
.
action
=
1
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_url
(
event
.
project
))
expect
(
helper
.
event_feed_url
(
event
)).
to
eq
(
project_url
(
event
.
project
))
end
end
it
"returns push event feed url"
do
it
'returns push event feed url'
do
event
=
create
(
:push_event
)
event
=
create
(
:push_event
)
create
(
:push_event_payload
,
event:
event
,
action: :pushed
)
create
(
:push_event_payload
,
event:
event
,
action: :pushed
)
...
...
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