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
b1ccf99e
Commit
b1ccf99e
authored
Dec 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix previously reverted spec failures
parent
e6842ff5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
47 deletions
+47
-47
spec/models/project_services/chat_message/build_message_spec.rb
...odels/project_services/chat_message/build_message_spec.rb
+4
-4
spec/models/project_services/chat_message/issue_message_spec.rb
...odels/project_services/chat_message/issue_message_spec.rb
+5
-5
spec/models/project_services/chat_message/merge_message_spec.rb
...odels/project_services/chat_message/merge_message_spec.rb
+6
-6
spec/models/project_services/chat_message/note_message_spec.rb
...models/project_services/chat_message/note_message_spec.rb
+11
-11
spec/models/project_services/chat_message/pipeline_message_spec.rb
...ls/project_services/chat_message/pipeline_message_spec.rb
+4
-4
spec/models/project_services/chat_message/push_message_spec.rb
...models/project_services/chat_message/push_message_spec.rb
+13
-13
spec/models/project_services/chat_message/wiki_page_message_spec.rb
...s/project_services/chat_message/wiki_page_message_spec.rb
+4
-4
No files found.
spec/models/project_services/chat_message/build_message_spec.rb
View file @
b1ccf99e
...
@@ -10,7 +10,7 @@ describe ChatMessage::BuildMessage do
...
@@ -10,7 +10,7 @@ describe ChatMessage::BuildMessage do
tag:
false
,
tag:
false
,
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'example.gitlab.com'
,
project_url:
'
http://
example.gitlab.com'
,
commit:
{
commit:
{
status:
status
,
status:
status
,
...
@@ -48,10 +48,10 @@ describe ChatMessage::BuildMessage do
...
@@ -48,10 +48,10 @@ describe ChatMessage::BuildMessage do
end
end
def
build_message
(
status_text
=
status
)
def
build_message
(
status_text
=
status
)
"<example.gitlab.com|project_name>:"
\
"<
http://
example.gitlab.com|project_name>:"
\
" Commit <example.gitlab.com/commit/"
\
" Commit <
http://
example.gitlab.com/commit/"
\
"97de212e80737a608d939f648d959671fb0a0142/builds|97de212e>"
\
"97de212e80737a608d939f648d959671fb0a0142/builds|97de212e>"
\
" of <example.gitlab.com/commits/develop|develop> branch"
\
" of <
http://
example.gitlab.com/commits/develop|develop> branch"
\
" by hacker
#{
status_text
}
in
#{
duration
}
#{
'second'
.
pluralize
(
duration
)
}
"
" by hacker
#{
status_text
}
in
#{
duration
}
#{
'second'
.
pluralize
(
duration
)
}
"
end
end
end
end
spec/models/project_services/chat_message/issue_message_spec.rb
View file @
b1ccf99e
...
@@ -10,14 +10,14 @@ describe ChatMessage::IssueMessage, models: true do
...
@@ -10,14 +10,14 @@ describe ChatMessage::IssueMessage, models: true do
username:
'test.user'
username:
'test.user'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'
http://
somewhere.com'
,
object_attributes:
{
object_attributes:
{
title:
'Issue title'
,
title:
'Issue title'
,
id:
10
,
id:
10
,
iid:
100
,
iid:
100
,
assignee_id:
1
,
assignee_id:
1
,
url:
'
url
'
,
url:
'
http://url.com
'
,
action:
'open'
,
action:
'open'
,
state:
'opened'
,
state:
'opened'
,
description:
'issue description'
description:
'issue description'
...
@@ -40,11 +40,11 @@ describe ChatMessage::IssueMessage, models: true do
...
@@ -40,11 +40,11 @@ describe ChatMessage::IssueMessage, models: true do
context
'open'
do
context
'open'
do
it
'returns a message regarding opening of issues'
do
it
'returns a message regarding opening of issues'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
<somewhere.com|[
project_name>] Issue opened by test.user'
)
'
[<http://somewhere.com|
project_name>] Issue opened by test.user'
)
expect
(
subject
.
attachments
).
to
eq
([
expect
(
subject
.
attachments
).
to
eq
([
{
{
title:
"#100 Issue title"
,
title:
"#100 Issue title"
,
title_link:
"
url
"
,
title_link:
"
http://url.com
"
,
text:
"issue description"
,
text:
"issue description"
,
color:
color
,
color:
color
,
}
}
...
@@ -60,7 +60,7 @@ describe ChatMessage::IssueMessage, models: true do
...
@@ -60,7 +60,7 @@ describe ChatMessage::IssueMessage, models: true do
it
'returns a message regarding closing of issues'
do
it
'returns a message regarding closing of issues'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'
<somewhere.com|[project_name>] Issue <url
|#100 Issue title> closed by test.user'
)
'
[<http://somewhere.com|project_name>] Issue <http://url.com
|#100 Issue title> closed by test.user'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
end
end
...
...
spec/models/project_services/chat_message/merge_message_spec.rb
View file @
b1ccf99e
...
@@ -10,14 +10,14 @@ describe ChatMessage::MergeMessage, models: true do
...
@@ -10,14 +10,14 @@ describe ChatMessage::MergeMessage, models: true do
username:
'test.user'
username:
'test.user'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'
http://
somewhere.com'
,
object_attributes:
{
object_attributes:
{
title:
"Issue title
\n
Second line"
,
title:
"Issue title
\n
Second line"
,
id:
10
,
id:
10
,
iid:
100
,
iid:
100
,
assignee_id:
1
,
assignee_id:
1
,
url:
'
url
'
,
url:
'
http://url.com
'
,
state:
'opened'
,
state:
'opened'
,
description:
'issue description'
,
description:
'issue description'
,
source_branch:
'source_branch'
,
source_branch:
'source_branch'
,
...
@@ -31,8 +31,8 @@ describe ChatMessage::MergeMessage, models: true do
...
@@ -31,8 +31,8 @@ describe ChatMessage::MergeMessage, models: true do
context
'open'
do
context
'open'
do
it
'returns a message regarding opening of merge requests'
do
it
'returns a message regarding opening of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user opened <somewhere.com/merge_requests/100|merge request !100> '
\
'test.user opened <
http://
somewhere.com/merge_requests/100|merge request !100> '
\
'in <somewhere.com|project_name>: *Issue title*'
)
'in <
http://
somewhere.com|project_name>: *Issue title*'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
end
end
...
@@ -43,8 +43,8 @@ describe ChatMessage::MergeMessage, models: true do
...
@@ -43,8 +43,8 @@ describe ChatMessage::MergeMessage, models: true do
end
end
it
'returns a message regarding closing of merge requests'
do
it
'returns a message regarding closing of merge requests'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user closed <somewhere.com/merge_requests/100|merge request !100> '
\
'test.user closed <
http://
somewhere.com/merge_requests/100|merge request !100> '
\
'in <somewhere.com|project_name>: *Issue title*'
)
'in <
http://
somewhere.com|project_name>: *Issue title*'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
end
end
...
...
spec/models/project_services/chat_message/note_message_spec.rb
View file @
b1ccf99e
...
@@ -11,15 +11,15 @@ describe ChatMessage::NoteMessage, models: true do
...
@@ -11,15 +11,15 @@ describe ChatMessage::NoteMessage, models: true do
avatar_url:
'http://fakeavatar'
avatar_url:
'http://fakeavatar'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'
http://
somewhere.com'
,
repository:
{
repository:
{
name:
'project_name'
,
name:
'project_name'
,
url:
'somewhere.com'
,
url:
'
http://
somewhere.com'
,
},
},
object_attributes:
{
object_attributes:
{
id:
10
,
id:
10
,
note:
'comment on a commit'
,
note:
'comment on a commit'
,
url:
'
url
'
,
url:
'
http://url.com
'
,
noteable_type:
'Commit'
noteable_type:
'Commit'
}
}
}
}
...
@@ -37,8 +37,8 @@ describe ChatMessage::NoteMessage, models: true do
...
@@ -37,8 +37,8 @@ describe ChatMessage::NoteMessage, models: true do
it
'returns a message regarding notes on commits'
do
it
'returns a message regarding notes on commits'
do
message
=
described_class
.
new
(
@args
)
message
=
described_class
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
"test.user <
url
|commented on "
\
expect
(
message
.
pretext
).
to
eq
(
"test.user <
http://url.com
|commented on "
\
"commit 5f163b2b> in <somewhere.com|project_name>: "
\
"commit 5f163b2b> in <
http://
somewhere.com|project_name>: "
\
"*Added a commit message*"
)
"*Added a commit message*"
)
expected_attachments
=
[
expected_attachments
=
[
{
{
...
@@ -63,8 +63,8 @@ describe ChatMessage::NoteMessage, models: true do
...
@@ -63,8 +63,8 @@ describe ChatMessage::NoteMessage, models: true do
it
'returns a message regarding notes on a merge request'
do
it
'returns a message regarding notes on a merge request'
do
message
=
described_class
.
new
(
@args
)
message
=
described_class
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
"test.user <
url
|commented on "
\
expect
(
message
.
pretext
).
to
eq
(
"test.user <
http://url.com
|commented on "
\
"merge request !30> in <somewhere.com|project_name>: "
\
"merge request !30> in <
http://
somewhere.com|project_name>: "
\
"*merge request title*"
)
"*merge request title*"
)
expected_attachments
=
[
expected_attachments
=
[
{
{
...
@@ -90,8 +90,8 @@ describe ChatMessage::NoteMessage, models: true do
...
@@ -90,8 +90,8 @@ describe ChatMessage::NoteMessage, models: true do
it
'returns a message regarding notes on an issue'
do
it
'returns a message regarding notes on an issue'
do
message
=
described_class
.
new
(
@args
)
message
=
described_class
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
expect
(
message
.
pretext
).
to
eq
(
"test.user <
url
|commented on "
\
"test.user <
http://url.com
|commented on "
\
"issue #20> in <somewhere.com|project_name>: "
\
"issue #20> in <
http://
somewhere.com|project_name>: "
\
"*issue title*"
)
"*issue title*"
)
expected_attachments
=
[
expected_attachments
=
[
{
{
...
@@ -115,8 +115,8 @@ describe ChatMessage::NoteMessage, models: true do
...
@@ -115,8 +115,8 @@ describe ChatMessage::NoteMessage, models: true do
it
'returns a message regarding notes on a project snippet'
do
it
'returns a message regarding notes on a project snippet'
do
message
=
described_class
.
new
(
@args
)
message
=
described_class
.
new
(
@args
)
expect
(
message
.
pretext
).
to
eq
(
"test.user <
url
|commented on "
\
expect
(
message
.
pretext
).
to
eq
(
"test.user <
http://url.com
|commented on "
\
"snippet #5> in <somewhere.com|project_name>: "
\
"snippet #5> in <
http://
somewhere.com|project_name>: "
\
"*snippet title*"
)
"*snippet title*"
)
expected_attachments
=
[
expected_attachments
=
[
{
{
...
...
spec/models/project_services/chat_message/pipeline_message_spec.rb
View file @
b1ccf99e
...
@@ -15,7 +15,7 @@ describe ChatMessage::PipelineMessage do
...
@@ -15,7 +15,7 @@ describe ChatMessage::PipelineMessage do
duration:
duration
duration:
duration
},
},
project:
{
path_with_namespace:
'project_name'
,
project:
{
path_with_namespace:
'project_name'
,
web_url:
'example.gitlab.com'
},
web_url:
'
http://
example.gitlab.com'
},
user:
user
user:
user
}
}
end
end
...
@@ -59,9 +59,9 @@ describe ChatMessage::PipelineMessage do
...
@@ -59,9 +59,9 @@ describe ChatMessage::PipelineMessage do
end
end
def
build_message
(
status_text
=
status
,
name
=
user
[
:name
])
def
build_message
(
status_text
=
status
,
name
=
user
[
:name
])
"<example.gitlab.com|project_name>:"
\
"<
http://
example.gitlab.com|project_name>:"
\
" Pipeline <example.gitlab.com/pipelines/123|#123>"
\
" Pipeline <
http://
example.gitlab.com/pipelines/123|#123>"
\
" of <example.gitlab.com/commits/develop|develop> branch"
\
" of <
http://
example.gitlab.com/commits/develop|develop> branch"
\
" by
#{
name
}
#{
status_text
}
in
#{
duration
}
#{
'second'
.
pluralize
(
duration
)
}
"
" by
#{
name
}
#{
status_text
}
in
#{
duration
}
#{
'second'
.
pluralize
(
duration
)
}
"
end
end
end
end
spec/models/project_services/chat_message/push_message_spec.rb
View file @
b1ccf99e
...
@@ -10,7 +10,7 @@ describe ChatMessage::PushMessage, models: true do
...
@@ -10,7 +10,7 @@ describe ChatMessage::PushMessage, models: true do
project_name:
'project_name'
,
project_name:
'project_name'
,
ref:
'refs/heads/master'
,
ref:
'refs/heads/master'
,
user_name:
'test.user'
,
user_name:
'test.user'
,
project_url:
'
url
'
project_url:
'
http://url.com
'
}
}
end
end
...
@@ -19,20 +19,20 @@ describe ChatMessage::PushMessage, models: true do
...
@@ -19,20 +19,20 @@ describe ChatMessage::PushMessage, models: true do
context
'push'
do
context
'push'
do
before
do
before
do
args
[
:commits
]
=
[
args
[
:commits
]
=
[
{
message:
'message1'
,
url:
'
url1
'
,
id:
'abcdefghijkl'
,
author:
{
name:
'author1'
}
},
{
message:
'message1'
,
url:
'
http://url1.com
'
,
id:
'abcdefghijkl'
,
author:
{
name:
'author1'
}
},
{
message:
'message2'
,
url:
'
url2
'
,
id:
'123456789012'
,
author:
{
name:
'author2'
}
},
{
message:
'message2'
,
url:
'
http://url2.com
'
,
id:
'123456789012'
,
author:
{
name:
'author2'
}
},
]
]
end
end
it
'returns a message regarding pushes'
do
it
'returns a message regarding pushes'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user pushed to branch <
url
/commits/master|master> of '
\
'test.user pushed to branch <
http://url.com
/commits/master|master> of '
\
'<
url|project_name> (<url
/compare/before...after|Compare changes>)'
'<
http://url.com|project_name> (<http://url.com
/compare/before...after|Compare changes>)'
)
)
expect
(
subject
.
attachments
).
to
eq
([
expect
(
subject
.
attachments
).
to
eq
([
{
{
text:
"<
url1
|abcdefgh>: message1 - author1
\n
"
\
text:
"<
http://url1.com
|abcdefgh>: message1 - author1
\n
"
\
"<
url2
|12345678>: message2 - author2"
,
"<
http://url2.com
|12345678>: message2 - author2"
,
color:
color
,
color:
color
,
}
}
])
])
...
@@ -47,14 +47,14 @@ describe ChatMessage::PushMessage, models: true do
...
@@ -47,14 +47,14 @@ describe ChatMessage::PushMessage, models: true do
project_name:
'project_name'
,
project_name:
'project_name'
,
ref:
'refs/tags/new_tag'
,
ref:
'refs/tags/new_tag'
,
user_name:
'test.user'
,
user_name:
'test.user'
,
project_url:
'
url
'
project_url:
'
http://url.com
'
}
}
end
end
it
'returns a message regarding pushes'
do
it
'returns a message regarding pushes'
do
expect
(
subject
.
pretext
).
to
eq
(
'test.user pushed new tag '
\
expect
(
subject
.
pretext
).
to
eq
(
'test.user pushed new tag '
\
'<url
/commits/new_tag|new_tag> to '
\
'<http://url.com
/commits/new_tag|new_tag> to '
\
'<url
|project_name>'
)
'<http://url.com
|project_name>'
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
end
end
...
@@ -66,8 +66,8 @@ describe ChatMessage::PushMessage, models: true do
...
@@ -66,8 +66,8 @@ describe ChatMessage::PushMessage, models: true do
it
'returns a message regarding a new branch'
do
it
'returns a message regarding a new branch'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user pushed new branch <
url
/commits/master|master> to '
\
'test.user pushed new branch <
http://url.com
/commits/master|master> to '
\
'<
url
|project_name>'
'<
http://url.com
|project_name>'
)
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
...
@@ -80,7 +80,7 @@ describe ChatMessage::PushMessage, models: true do
...
@@ -80,7 +80,7 @@ describe ChatMessage::PushMessage, models: true do
it
'returns a message regarding a removed branch'
do
it
'returns a message regarding a removed branch'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user removed branch master from <
url
|project_name>'
'test.user removed branch master from <
http://url.com
|project_name>'
)
)
expect
(
subject
.
attachments
).
to
be_empty
expect
(
subject
.
attachments
).
to
be_empty
end
end
...
...
spec/models/project_services/chat_message/wiki_page_message_spec.rb
View file @
b1ccf99e
...
@@ -10,10 +10,10 @@ describe ChatMessage::WikiPageMessage, models: true do
...
@@ -10,10 +10,10 @@ describe ChatMessage::WikiPageMessage, models: true do
username:
'test.user'
username:
'test.user'
},
},
project_name:
'project_name'
,
project_name:
'project_name'
,
project_url:
'somewhere.com'
,
project_url:
'
http://
somewhere.com'
,
object_attributes:
{
object_attributes:
{
title:
'Wiki page title'
,
title:
'Wiki page title'
,
url:
'
url
'
,
url:
'
http://url.com
'
,
content:
'Wiki page description'
content:
'Wiki page description'
}
}
}
}
...
@@ -25,7 +25,7 @@ describe ChatMessage::WikiPageMessage, models: true do
...
@@ -25,7 +25,7 @@ describe ChatMessage::WikiPageMessage, models: true do
it
'returns a message that a new wiki page was created'
do
it
'returns a message that a new wiki page was created'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user created <
url|wiki page> in <
somewhere.com|project_name>: '
\
'test.user created <
http://url.com|wiki page> in <http://
somewhere.com|project_name>: '
\
'*Wiki page title*'
)
'*Wiki page title*'
)
end
end
end
end
...
@@ -35,7 +35,7 @@ describe ChatMessage::WikiPageMessage, models: true do
...
@@ -35,7 +35,7 @@ describe ChatMessage::WikiPageMessage, models: true do
it
'returns a message that a wiki page was updated'
do
it
'returns a message that a wiki page was updated'
do
expect
(
subject
.
pretext
).
to
eq
(
expect
(
subject
.
pretext
).
to
eq
(
'test.user edited <
url|wiki page> in <
somewhere.com|project_name>: '
\
'test.user edited <
http://url.com|wiki page> in <http://
somewhere.com|project_name>: '
\
'*Wiki page title*'
)
'*Wiki page title*'
)
end
end
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