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
c45484ba
Commit
c45484ba
authored
Dec 12, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Spec for Bitbucket::Paginator
parent
3a0fecb4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
spec/lib/bitbucket/paginator_spec.rb
spec/lib/bitbucket/paginator_spec.rb
+21
-0
No files found.
spec/lib/bitbucket/paginator_spec.rb
0 → 100644
View file @
c45484ba
require
'spec_helper'
describe
Bitbucket
::
Paginator
do
let
(
:last_page
)
{
double
(
:page
,
next?:
false
,
items:
[
'item_2'
])
}
let
(
:first_page
)
{
double
(
:page
,
next?:
true
,
next:
last_page
,
items:
[
'item_1'
])
}
describe
'items'
do
it
'return items and raises StopIteration in the end'
do
paginator
=
described_class
.
new
(
nil
,
nil
,
nil
)
allow
(
paginator
).
to
receive
(
:fetch_next_page
).
and_return
(
first_page
)
expect
(
paginator
.
items
).
to
match
([
'item_1'
])
allow
(
paginator
).
to
receive
(
:fetch_next_page
).
and_return
(
last_page
)
expect
(
paginator
.
items
).
to
match
([
'item_2'
])
allow
(
paginator
).
to
receive
(
:fetch_next_page
).
and_return
(
nil
)
expect
{
paginator
.
items
}.
to
raise_error
(
StopIteration
)
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