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
Tatuya Kamada
gitlab-ce
Commits
3a0fecb4
Commit
3a0fecb4
authored
Dec 12, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Spec for bitbucket page
parent
314c4746
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
lib/bitbucket/page.rb
lib/bitbucket/page.rb
+1
-0
spec/lib/bitbucket/page_spec.rb
spec/lib/bitbucket/page_spec.rb
+50
-0
No files found.
lib/bitbucket/page.rb
View file @
3a0fecb4
...
...
@@ -23,6 +23,7 @@ module Bitbucket
def
parse_values
(
raw
,
bitbucket_rep_class
)
return
[]
unless
raw
[
'values'
]
&&
raw
[
'values'
].
is_a?
(
Array
)
bitbucket_rep_class
.
decorate
(
raw
[
'values'
])
end
...
...
spec/lib/bitbucket/page_spec.rb
0 → 100644
View file @
3a0fecb4
require
'spec_helper'
describe
Bitbucket
::
Page
do
let
(
:response
)
{
{
'values'
=>
[{
'username'
=>
'Ben'
}],
'pagelen'
=>
2
,
'next'
=>
''
}
}
before
do
# Autoloading hack
Bitbucket
::
Representation
::
User
.
new
({})
end
describe
'#items'
do
it
'returns collection of needed objects'
do
page
=
described_class
.
new
(
response
,
:user
)
expect
(
page
.
items
.
first
).
to
be_a
(
Bitbucket
::
Representation
::
User
)
expect
(
page
.
items
.
count
).
to
eq
(
1
)
end
end
describe
'#attrs'
do
it
'returns attributes'
do
page
=
described_class
.
new
(
response
,
:user
)
expect
(
page
.
attrs
.
keys
).
to
include
(
:pagelen
,
:next
)
end
end
describe
'#next?'
do
it
'returns true'
do
page
=
described_class
.
new
(
response
,
:user
)
expect
(
page
.
next?
).
to
be_truthy
end
it
'returns false'
do
response
[
'next'
]
=
nil
page
=
described_class
.
new
(
response
,
:user
)
expect
(
page
.
next?
).
to
be_falsey
end
end
describe
'#next'
do
it
'returns next attribute'
do
page
=
described_class
.
new
(
response
,
:user
)
expect
(
page
.
next
).
to
eq
(
''
)
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