summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-09-04 11:35:20 +0200
committerKamil Trzciński <ayufan@ayufan.eu>2018-09-04 16:12:50 +0200
commita86dc660f5fd9ea15db963ed1e8c6188f663784a (patch)
tree9f6212b6359de33380f131f48085908580494ecc
parentd6c3446df5d238480d479861f2f3985f8e593306 (diff)
downloadgitlab-ce-a86dc660f5fd9ea15db963ed1e8c6188f663784a.tar.gz
Fix specs
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/models/ci/build_metadata.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index a56cde7fbb4..162b426a485 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -207,7 +207,7 @@ module Ci
end
def ensure_metadata
- metadata || build_metadata
+ metadata || build_metadata(project: project)
end
def archived?
@@ -560,7 +560,7 @@ module Ci
end
def yaml_variables=(value)
- if Feature.enabled?(:ci_use_build_metadata_for_config) && false
+ if Feature.enabled?(:ci_use_build_metadata_for_config)
# save and remove from this model
ensure_metadata.yaml_variables = value
write_attribute(:yaml_variables, nil)
diff --git a/app/models/ci/build_metadata.rb b/app/models/ci/build_metadata.rb
index b0ccf11cade..ee15f0856cd 100644
--- a/app/models/ci/build_metadata.rb
+++ b/app/models/ci/build_metadata.rb
@@ -13,7 +13,7 @@ module Ci
belongs_to :build, class_name: 'Ci::Build'
belongs_to :project
- before_validation :set_build_project
+ before_create :set_build_project
validates :build, presence: true
validates :project, presence: true
@@ -42,7 +42,7 @@ module Ci
private
def set_build_project
- self.project_id ||= self.build&.project_id
+ self.project_id ||= self.build.project_id
end
end
end