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
1607581e
Commit
1607581e
authored
Mar 11, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only create an OAuth Application for secondary nodes
parent
1c62f762
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
app/models/geo_node.rb
app/models/geo_node.rb
+7
-2
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+10
-3
No files found.
app/models/geo_node.rb
View file @
1607581e
...
...
@@ -73,8 +73,13 @@ class GeoNode < ActiveRecord::Base
def
update_dependents_attributes
self
.
geo_node_key
.
title
=
"Geo node:
#{
self
.
url
}
"
if
self
.
geo_node_key
self
.
oauth_application
.
name
=
"Geo node:
#{
self
.
url
}
"
if
self
.
geo_node_key
self
.
oauth_application
.
redirect_uri
=
oauth_callback_url
if
self
.
primary?
self
.
oauth_application
=
nil
else
self
.
oauth_application
.
name
=
"Geo node:
#{
self
.
url
}
"
if
self
.
geo_node_key
self
.
oauth_application
.
redirect_uri
=
oauth_callback_url
end
end
def
validate
(
record
)
...
...
spec/models/geo_node_spec.rb
View file @
1607581e
...
...
@@ -68,19 +68,26 @@ describe GeoNode, type: :model do
end
context
'on create'
do
before
(
:each
)
do
subject
.
geo_node_key_attributes
=
geo_node_key_attributes
subject
.
save!
end
it
'saves a corresponding key'
do
subject
.
save!
expect
(
subject
.
geo_node_key
).
to
be_persisted
end
it
'saves a corresponding oauth application'
do
it
'saves a corresponding oauth application if it is a secondary node'
do
subject
.
save!
expect
(
subject
.
oauth_application
).
to
be_persisted
end
it
'has no oauth_application if it is a primary node'
do
subject
.
primary
=
true
subject
.
save!
expect
(
subject
.
oauth_application
).
not_to
be_present
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