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
62120acf
Commit
62120acf
authored
Sep 25, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a spec for Github::Client and revert an `if !` to `unless`
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
e484a064
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
lib/github/import.rb
lib/github/import.rb
+1
-1
spec/lib/github/client_spec.rb
spec/lib/github/client_spec.rb
+34
-0
No files found.
lib/github/import.rb
View file @
62120acf
...
...
@@ -236,7 +236,7 @@ module Github
# for both features, like manipulating assignees, labels
# and milestones, are provided within the Issues API.
if
representation
.
pull_request?
return
if
!
representation
.
has_labels?
&&
!
representation
.
has_comments?
return
unless
representation
.
has_labels?
||
representation
.
has_comments?
merge_request
=
MergeRequest
.
find_by!
(
target_project_id:
project
.
id
,
iid:
representation
.
iid
)
...
...
spec/lib/github/client_spec.rb
0 → 100644
View file @
62120acf
require
'spec_helper'
describe
Github
::
Client
do
let
(
:connection
)
{
spy
}
let
(
:rate_limit
)
{
double
(
get:
[
false
,
1
])
}
let
(
:client
)
{
described_class
.
new
({})
}
let
(
:results
)
{
double
}
let
(
:response
)
{
double
}
before
do
allow
(
Faraday
).
to
receive
(
:new
).
and_return
(
connection
)
allow
(
Github
::
RateLimit
).
to
receive
(
:new
).
with
(
connection
).
and_return
(
rate_limit
)
end
describe
'#get'
do
before
do
allow
(
Github
::
Response
).
to
receive
(
:new
).
with
(
results
).
and_return
(
response
)
end
it
'uses a default per_page param'
do
expect
(
connection
).
to
receive
(
:get
).
with
(
'/foo'
,
per_page:
100
).
and_return
(
results
)
expect
(
client
.
get
(
'/foo'
)).
to
eq
(
response
)
end
context
'with per_page given'
do
it
'overwrites the default per_page'
do
expect
(
connection
).
to
receive
(
:get
).
with
(
'/foo'
,
per_page:
30
).
and_return
(
results
)
expect
(
client
.
get
(
'/foo'
,
per_page:
30
)).
to
eq
(
response
)
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