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
c73db33f
Commit
c73db33f
authored
Jul 19, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for pages
parent
af948677
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
spec/lib/bitbucket_server/page_spec.rb
spec/lib/bitbucket_server/page_spec.rb
+51
-0
No files found.
spec/lib/bitbucket_server/page_spec.rb
0 → 100644
View file @
c73db33f
require
'spec_helper'
describe
BitbucketServer
::
Page
do
let
(
:response
)
{
{
'values'
=>
[{
'description'
=>
'Test'
}],
'isLastPage'
=>
false
,
'nextPageStart'
=>
2
}
}
before
do
# Autoloading hack
BitbucketServer
::
Representation
::
PullRequest
.
new
({})
end
describe
'#items'
do
it
'returns collection of needed objects'
do
page
=
described_class
.
new
(
response
,
:pull_request
)
expect
(
page
.
items
.
first
).
to
be_a
(
BitbucketServer
::
Representation
::
PullRequest
)
expect
(
page
.
items
.
count
).
to
eq
(
1
)
end
end
describe
'#attrs'
do
it
'returns attributes'
do
page
=
described_class
.
new
(
response
,
:pull_request
)
expect
(
page
.
attrs
.
keys
).
to
include
(
:isLastPage
,
:nextPageStart
)
end
end
describe
'#next?'
do
it
'returns true'
do
page
=
described_class
.
new
(
response
,
:pull_request
)
expect
(
page
.
next?
).
to
be_truthy
end
it
'returns false'
do
response
[
'isLastPage'
]
=
true
response
.
delete
(
'nextPageStart'
)
page
=
described_class
.
new
(
response
,
:pull_request
)
expect
(
page
.
next?
).
to
be_falsey
end
end
describe
'#next'
do
it
'returns next attribute'
do
page
=
described_class
.
new
(
response
,
:pull_request
)
expect
(
page
.
next
).
to
eq
(
2
)
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