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
Jérome Perrin
gitlab-ce
Commits
0057ed1e
Commit
0057ed1e
authored
Dec 13, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BB importer: Fixed after code review[ci skip]
parent
a2be3954
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
lib/bitbucket/paginator.rb
lib/bitbucket/paginator.rb
+1
-1
spec/lib/bitbucket/collection_spec.rb
spec/lib/bitbucket/collection_spec.rb
+1
-0
spec/lib/bitbucket/connection_spec.rb
spec/lib/bitbucket/connection_spec.rb
+5
-0
No files found.
lib/bitbucket/paginator.rb
View file @
0057ed1e
...
@@ -29,7 +29,7 @@ module Bitbucket
...
@@ -29,7 +29,7 @@ module Bitbucket
end
end
def
fetch_next_page
def
fetch_next_page
parsed_response
=
connection
.
get
(
next_url
,
{
pagelen:
PAGE_LENGTH
,
sort: :created_on
}
)
parsed_response
=
connection
.
get
(
next_url
,
pagelen:
PAGE_LENGTH
,
sort: :created_on
)
Page
.
new
(
parsed_response
,
type
)
Page
.
new
(
parsed_response
,
type
)
end
end
end
end
...
...
spec/lib/bitbucket/collection_spec.rb
View file @
0057ed1e
...
@@ -18,6 +18,7 @@ end
...
@@ -18,6 +18,7 @@ end
describe
Bitbucket
::
Collection
do
describe
Bitbucket
::
Collection
do
it
"iterates paginator"
do
it
"iterates paginator"
do
collection
=
described_class
.
new
(
TestPaginator
.
new
)
collection
=
described_class
.
new
(
TestPaginator
.
new
)
expect
(
collection
.
to_a
).
to
match
([
"result_1_page_1"
,
"result_2_page_1"
,
"result_1_page_2"
,
"result_2_page_2"
])
expect
(
collection
.
to_a
).
to
match
([
"result_1_page_1"
,
"result_2_page_1"
,
"result_1_page_2"
,
"result_2_page_2"
])
end
end
end
end
spec/lib/bitbucket/connection_spec.rb
View file @
0057ed1e
...
@@ -4,7 +4,9 @@ describe Bitbucket::Connection do
...
@@ -4,7 +4,9 @@ describe Bitbucket::Connection do
describe
'#get'
do
describe
'#get'
do
it
'calls OAuth2::AccessToken::get'
do
it
'calls OAuth2::AccessToken::get'
do
expect_any_instance_of
(
OAuth2
::
AccessToken
).
to
receive
(
:get
).
and_return
(
double
(
parsed:
true
))
expect_any_instance_of
(
OAuth2
::
AccessToken
).
to
receive
(
:get
).
and_return
(
double
(
parsed:
true
))
connection
=
described_class
.
new
({})
connection
=
described_class
.
new
({})
connection
.
get
(
'/users'
)
connection
.
get
(
'/users'
)
end
end
end
end
...
@@ -12,6 +14,7 @@ describe Bitbucket::Connection do
...
@@ -12,6 +14,7 @@ describe Bitbucket::Connection do
describe
'#expired?'
do
describe
'#expired?'
do
it
'calls connection.expired?'
do
it
'calls connection.expired?'
do
expect_any_instance_of
(
OAuth2
::
AccessToken
).
to
receive
(
:expired?
).
and_return
(
true
)
expect_any_instance_of
(
OAuth2
::
AccessToken
).
to
receive
(
:expired?
).
and_return
(
true
)
expect
(
described_class
.
new
({}).
expired?
).
to
be_truthy
expect
(
described_class
.
new
({}).
expired?
).
to
be_truthy
end
end
end
end
...
@@ -19,7 +22,9 @@ describe Bitbucket::Connection do
...
@@ -19,7 +22,9 @@ describe Bitbucket::Connection do
describe
'#refresh!'
do
describe
'#refresh!'
do
it
'calls connection.refresh!'
do
it
'calls connection.refresh!'
do
response
=
double
(
token:
nil
,
expires_at:
nil
,
expires_in:
nil
,
refresh_token:
nil
)
response
=
double
(
token:
nil
,
expires_at:
nil
,
expires_in:
nil
,
refresh_token:
nil
)
expect_any_instance_of
(
OAuth2
::
AccessToken
).
to
receive
(
:refresh!
).
and_return
(
response
)
expect_any_instance_of
(
OAuth2
::
AccessToken
).
to
receive
(
:refresh!
).
and_return
(
response
)
described_class
.
new
({}).
refresh!
described_class
.
new
({}).
refresh!
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