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
ae7574f9
Commit
ae7574f9
authored
Jul 25, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for activity and comments
parent
bf2d029a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
spec/lib/bitbucket_server/representation/activity_spec.rb
spec/lib/bitbucket_server/representation/activity_spec.rb
+37
-0
spec/lib/bitbucket_server/representation/comment_spec.rb
spec/lib/bitbucket_server/representation/comment_spec.rb
+38
-0
No files found.
spec/lib/bitbucket_server/representation/activity_spec.rb
0 → 100644
View file @
ae7574f9
require
'spec_helper'
describe
BitbucketServer
::
Representation
::
Activity
do
let
(
:activities
)
{
JSON
.
parse
(
fixture_file
(
'importers/bitbucket_server/activities.json'
))[
'values'
]
}
let
(
:inline_comment
)
{
activities
.
first
}
let
(
:comment
)
{
activities
[
3
]
}
let
(
:merge_event
)
{
activities
[
4
]
}
describe
'regular comment'
do
subject
{
described_class
.
new
(
comment
)
}
it
{
expect
(
subject
.
comment?
).
to
be_truthy
}
it
{
expect
(
subject
.
inline_comment?
).
to
be_falsey
}
it
{
expect
(
subject
.
comment
).
to
be_a
(
BitbucketServer
::
Representation
::
Comment
)
}
it
{
expect
(
subject
.
created_at
).
to
be_a
(
Time
)
}
end
describe
'inline comment'
do
subject
{
described_class
.
new
(
inline_comment
)
}
it
{
expect
(
subject
.
comment?
).
to
be_truthy
}
it
{
expect
(
subject
.
inline_comment?
).
to
be_truthy
}
it
{
expect
(
subject
.
comment
).
to
be_a
(
BitbucketServer
::
Representation
::
PullRequestComment
)
}
it
{
expect
(
subject
.
created_at
).
to
be_a
(
Time
)
}
end
describe
'merge event'
do
subject
{
described_class
.
new
(
merge_event
)
}
it
{
expect
(
subject
.
comment?
).
to
be_falsey
}
it
{
expect
(
subject
.
inline_comment?
).
to
be_falsey
}
it
{
expect
(
subject
.
committer_user
).
to
eq
(
'root'
)
}
it
{
expect
(
subject
.
committer_email
).
to
eq
(
'test.user@example.com'
)
}
it
{
expect
(
subject
.
merge_timestamp
).
to
be_a
(
Time
)
}
it
{
expect
(
subject
.
created_at
).
to
be_a
(
Time
)
}
end
end
spec/lib/bitbucket_server/representation/comment_spec.rb
0 → 100644
View file @
ae7574f9
require
'spec_helper'
describe
BitbucketServer
::
Representation
::
Comment
do
let
(
:activities
)
{
JSON
.
parse
(
fixture_file
(
'importers/bitbucket_server/activities.json'
))[
'values'
]
}
let
(
:comment
)
{
activities
.
first
}
subject
{
described_class
.
new
(
comment
)
}
describe
'#id'
do
it
{
expect
(
subject
.
id
).
to
eq
(
9
)
}
end
describe
'#author_username'
do
it
{
expect
(
subject
.
author_username
).
to
eq
(
'root'
)
}
end
describe
'#author_email'
do
it
{
expect
(
subject
.
author_email
).
to
eq
(
'test.user@example.com'
)
}
end
describe
'#note'
do
it
{
expect
(
subject
.
note
).
to
eq
(
'is this a new line?'
)
}
end
describe
'#created_at'
do
it
{
expect
(
subject
.
created_at
).
to
be_a
(
Time
)
}
end
describe
'#updated_at'
do
it
{
expect
(
subject
.
created_at
).
to
be_a
(
Time
)
}
end
describe
'#comments'
do
it
{
expect
(
subject
.
comments
.
count
).
to
eq
(
4
)
}
it
{
expect
(
subject
.
comments
).
to
all
(
be_a
(
described_class
)
)
}
it
{
expect
(
subject
.
comments
.
map
(
&
:note
)).
to
match_array
([
"Hello world"
,
"Ok"
,
"hello"
,
"hi"
])
}
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