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
Kazuhiko Shiozaki
gitlab-ce
Commits
7ddba92a
Commit
7ddba92a
authored
9 years ago
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gitlab integration: added tests
parent
5194214e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
lib/gitlab/gitlab_import/project_creator.rb
lib/gitlab/gitlab_import/project_creator.rb
+1
-1
spec/lib/gitlab/gitlab_import/project_creator.rb
spec/lib/gitlab/gitlab_import/project_creator.rb
+25
-0
No files found.
lib/gitlab/gitlab_import/project_creator.rb
View file @
7ddba92a
...
@@ -19,7 +19,7 @@ module Gitlab
...
@@ -19,7 +19,7 @@ module Gitlab
visibility_level:
repo
[
"visibility_level"
],
visibility_level:
repo
[
"visibility_level"
],
import_type:
"gitlab"
,
import_type:
"gitlab"
,
import_source:
repo
[
"path_with_namespace"
],
import_source:
repo
[
"path_with_namespace"
],
import_url:
repo
[
"http_url_to_repo"
]
#.sub("://", "://oauth2@#{current_user.gitlab_access_token}
")
import_url:
repo
[
"http_url_to_repo"
]
.
sub
(
"://"
,
"://oauth2:
#{
current_user
.
gitlab_access_token
}
@
"
)
)
)
if
@project
.
save!
if
@project
.
save!
...
...
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/gitlab_import/project_creator.rb
0 → 100644
View file @
7ddba92a
require
'spec_helper'
describe
Gitlab
::
GitlabImport
::
ProjectCreator
do
let
(
:user
)
{
create
(
:user
,
gitlab_access_token:
"asdffg"
)
}
let
(
:repo
)
{{
name:
'vim'
,
path:
'vim'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
,
path_with_namespace:
'asd/vim'
,
http_url_to_repo:
"https://gitlab.com/asd/vim.git"
,
owner:
{
name:
"john"
}}.
with_indifferent_access
}
let
(
:namespace
){
create
(
:namespace
)
}
it
'creates project'
do
Project
.
any_instance
.
stub
(
:add_import_job
)
project_creator
=
Gitlab
::
GitlabImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
user
)
project_creator
.
execute
project
=
Project
.
last
project
.
import_url
.
should
==
"https://oauth2:asdffg@gitlab.com/asd/vim.git"
project
.
visibility_level
.
should
==
Gitlab
::
VisibilityLevel
::
PRIVATE
end
end
This diff is collapsed.
Click to expand it.
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