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
9a80b5fc
Commit
9a80b5fc
authored
May 05, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ee into ce-upstream
parents
ca9b7ab3
ad0f8f12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
app/models/project.rb
app/models/project.rb
+3
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+24
-0
No files found.
app/models/project.rb
View file @
9a80b5fc
...
...
@@ -269,7 +269,7 @@ class Project < ActiveRecord::Base
state
:failed
after_transition
any
=>
:started
,
do: :schedule_add_import_job
after_transition
any
=>
:finished
,
do: :
clear_import_data
after_transition
any
=>
:finished
,
do: :
reset_cache_and_import_attrs
after_transition
started: :finished
do
|
project
,
transaction
|
if
project
.
mirror?
...
...
@@ -453,12 +453,12 @@ class Project < ActiveRecord::Base
end
end
def
clear_import_data
def
reset_cache_and_import_attrs
update
(
import_error:
nil
)
ProjectCacheWorker
.
perform_async
(
self
.
id
)
self
.
import_data
.
destroy
if
self
.
import_data
self
.
import_data
.
destroy
if
!
mirror?
&&
import_data
end
def
import_url
=
(
value
)
...
...
spec/models/project_spec.rb
View file @
9a80b5fc
...
...
@@ -895,6 +895,29 @@ describe Project, models: true do
end
end
describe
'handling import URL'
do
context
'when project is a mirror'
do
it
'returns the full URL'
do
project
=
create
(
:project
,
:mirror
,
import_url:
'http://user:pass@test.com'
)
project
.
import_finish
expect
(
project
.
reload
.
import_url
).
to
eq
(
'http://user:pass@test.com'
)
end
end
context
'when project is not a mirror'
do
it
'returns the sanitized URL'
do
project
=
create
(
:project
,
import_status:
'started'
,
import_url:
'http://user:pass@test.com'
)
project
.
import_finish
expect
(
project
.
reload
.
import_url
).
to
eq
(
'http://test.com'
)
end
end
end
describe
'#protected_branch?'
do
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
@@ -908,4 +931,5 @@ describe Project, models: true do
expect
(
project
.
protected_branch?
(
'foo'
)).
to
eq
(
false
)
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