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
5b90f894
Commit
5b90f894
authored
Mar 10, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specs for RemoteNode
parent
c4bf8a88
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
spec/factories/doorkeeper.rb
spec/factories/doorkeeper.rb
+2
-2
spec/lib/gitlab/geo/remote_node_spec.rb
spec/lib/gitlab/geo/remote_node_spec.rb
+33
-0
No files found.
spec/factories/doorkeeper.rb
View file @
5b90f894
FactoryGirl
.
define
do
factory
:doorkeeper_access_grant
,
class:
Doorkeeper
::
AccessGrant
do
sequence
(
:resource_owner_id
)
{
|
n
|
n
}
application
a
ssociation
:application
,
factory: :doorkeeper_a
pplication
redirect_uri
'https://app.com/callback'
expires_in
100
scopes
'public write'
...
...
@@ -9,7 +9,7 @@ FactoryGirl.define do
factory
:doorkeeper_access_token
,
class:
Doorkeeper
::
AccessToken
do
sequence
(
:resource_owner_id
)
{
|
n
|
n
}
application
a
ssociation
:application
,
factory: :doorkeeper_a
pplication
expires_in
2
.
hours
factory
:clientless_access_token
do
...
...
spec/lib/gitlab/geo/remote_node_spec.rb
0 → 100644
View file @
5b90f894
require
'spec_helper'
describe
Gitlab
::
Geo
::
RemoteNode
do
subject
{
described_class
.
new
}
let
(
:access_token
)
{
FactoryGirl
.
create
(
:doorkeeper_access_token
).
token
}
let
(
:user
)
{
FactoryGirl
.
build
(
:user
)
}
before
(
:each
)
do
allow
(
subject
).
to
receive
(
:primary_node_url
)
{
'http://localhost:3001/'
}
allow
(
described_class
).
to
receive
(
:get
)
{
response
}
end
describe
'#authenticate'
do
let
(
:response
)
{
double
}
context
'on success'
do
it
'returns hashed user data'
do
allow
(
response
).
to
receive
(
:code
)
{
200
}
allow
(
response
).
to
receive
(
:parsed_response
)
{
user
.
to_json
}
subject
.
authenticate
(
access_token
)
end
end
context
'on invalid token'
do
it
'raises exception'
do
allow
(
response
).
to
receive
(
:code
)
{
401
}
expect
{
subject
.
authenticate
(
access_token
)
}.
to
raise_error
(
Gitlab
::
Geo
::
RemoteNode
::
InvalidCredentialsError
)
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