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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
0d877d91
Commit
0d877d91
authored
Sep 29, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ensure_gitlab_ci_project return ci_project or create a new one
parent
9498a400
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
16 deletions
+9
-16
app/models/ci/commit.rb
app/models/ci/commit.rb
+1
-5
app/models/project.rb
app/models/project.rb
+2
-4
spec/models/ci/project_spec.rb
spec/models/ci/project_spec.rb
+4
-4
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/services/ci/register_build_service_spec.rb
spec/services/ci/register_build_service_spec.rb
+1
-2
No files found.
app/models/ci/commit.rb
View file @
0d877d91
...
...
@@ -37,11 +37,7 @@ module Ci
end
def
project
unless
@project
gl_project
.
ensure_ci_project
@project
=
gl_project
.
gitlab_ci_project
end
@project
@project
||=
gl_project
.
ensure_gitlab_ci_project
end
def
project_id
...
...
app/models/project.rb
View file @
0d877d91
...
...
@@ -747,10 +747,8 @@ class Project < ActiveRecord::Base
gitlab_ci_project
.
commits
.
find_by
(
sha:
sha
)
if
gitlab_ci?
end
def
ensure_ci_project
unless
gitlab_ci_project
create_gitlab_ci_project
end
def
ensure_gitlab_ci_project
gitlab_ci_project
||
create_gitlab_ci_project
end
def
enable_ci
(
user
)
...
...
spec/models/ci/project_spec.rb
View file @
0d877d91
...
...
@@ -56,16 +56,16 @@ describe Ci::Project do
describe
"ordered_by_last_commit_date"
do
it
"returns ordered projects"
do
newest_project
=
FactoryGirl
.
create
:empty_project
newest_
project
.
ensure
_ci_project
newest_
ci_project
=
newest_project
.
ensure_gitlab
_ci_project
oldest_project
=
FactoryGirl
.
create
:empty_project
oldest_
project
.
ensure
_ci_project
oldest_
ci_project
=
oldest_project
.
ensure_gitlab
_ci_project
project_without_commits
=
FactoryGirl
.
create
:empty_project
project_without_commits
.
ensure
_ci_project
ci_project_without_commits
=
project_without_commits
.
ensure_gitlab
_ci_project
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
gl_project:
newest_project
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
.
ago
,
gl_project:
oldest_project
expect
(
Ci
::
Project
.
ordered_by_last_commit_date
).
to
eq
([
newest_
project
.
gitlab_ci_project
,
oldest_project
.
gitlab_ci_project
,
project_without_commits
.
gitlab_ci_project
])
expect
(
Ci
::
Project
.
ordered_by_last_commit_date
).
to
eq
([
newest_
ci_project
,
oldest_ci_project
,
ci_project_without_commits
])
end
end
...
...
spec/models/project_spec.rb
View file @
0d877d91
...
...
@@ -407,7 +407,7 @@ describe Project do
let
(
:commit
)
{
create
:ci_commit
,
gl_project:
project
}
before
do
project
.
ensure_ci_project
project
.
ensure_
gitlab_
ci_project
project
.
create_gitlab_ci_service
(
active:
true
)
end
...
...
spec/services/ci/register_build_service_spec.rb
View file @
0d877d91
...
...
@@ -10,8 +10,7 @@ module Ci
let!
(
:specific_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
false
)
}
before
do
gl_project
.
ensure_ci_project
specific_runner
.
assign_to
(
gl_project
.
gitlab_ci_project
)
specific_runner
.
assign_to
(
gl_project
.
ensure_gitlab_ci_project
)
end
describe
:execute
do
...
...
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