summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-28 13:35:26 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-29 10:47:03 +0200
commit0e3381470870732dff69c9298131062f786d55e7 (patch)
tree02a4a5e588c73c066fa80222b03065d3b8295e24 /app/models/ci
parent30c78e70cba395c1336611c58891a75473f8a037 (diff)
downloadgitlab-ce-0e3381470870732dff69c9298131062f786d55e7.tar.gz
Fix tests
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/ci/commit.rb27
2 files changed, 18 insertions, 11 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 9ac47ccfe4a..cda4fdd4982 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -186,7 +186,7 @@ module Ci
end
def project_id
- commit.gl_project.gitlab_id
+ commit.project.id
end
def project_name
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 9a719787649..a6556690b9a 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -37,8 +37,15 @@ module Ci
end
def project
- @project ||= gl_project.gitlab_ci_project
- @project ||= gl_project.create_gitlab_ci_project
+ unless @project
+ gl_project.ensure_ci_project
+ @project = gl_project.gitlab_ci_project
+ end
+ @project
+ end
+
+ def project_id
+ project.id
end
def last_build
@@ -116,14 +123,14 @@ module Ci
builds_attrs = config_processor.builds_for_stage_and_ref(stage, ref, tag)
builds_attrs.map do |build_attrs|
builds.create!({
- name: build_attrs[:name],
- commands: build_attrs[:script],
- tag_list: build_attrs[:tags],
- options: build_attrs[:options],
- allow_failure: build_attrs[:allow_failure],
- stage: build_attrs[:stage],
- trigger_request: trigger_request,
- })
+ name: build_attrs[:name],
+ commands: build_attrs[:script],
+ tag_list: build_attrs[:tags],
+ options: build_attrs[:options],
+ allow_failure: build_attrs[:allow_failure],
+ stage: build_attrs[:stage],
+ trigger_request: trigger_request,
+ })
end
end