Commit 7152a5ee authored by Kamil Trzciński's avatar Kamil Trzciński

Fix some specs failures

parent c9b0594e
...@@ -48,6 +48,10 @@ class CommitStatus < ApplicationRecord ...@@ -48,6 +48,10 @@ class CommitStatus < ApplicationRecord
scope :processables, -> { where(type: %w[Ci::Build Ci::Bridge]) } scope :processables, -> { where(type: %w[Ci::Build Ci::Bridge]) }
scope :for_ids, -> (ids) { where(id: ids) } scope :for_ids, -> (ids) { where(id: ids) }
scope :with_preloads, -> do
preload(:project, :taggings, :deployment, :user)
end
scope :with_needs, -> (names = nil) do scope :with_needs, -> (names = nil) do
needs = Ci::BuildNeed.scoped_build.select(1) needs = Ci::BuildNeed.scoped_build.select(1)
needs = needs.where(name: names) if names needs = needs.where(name: names) if names
......
...@@ -94,10 +94,7 @@ module Ci ...@@ -94,10 +94,7 @@ module Ci
def created_processables_in_stage_without_needs(index) def created_processables_in_stage_without_needs(index)
created_processables_without_needs created_processables_without_needs
.preload(:project) .with_preloads
.preload(:taggings)
.preload(:deployment)
.preload(:user)
.for_stage(index) .for_stage(index)
end end
......
...@@ -47,7 +47,7 @@ module Gitlab ...@@ -47,7 +47,7 @@ module Gitlab
columns << :allow_failure if !subject.respond_to?(:column_names) || subject.column_names.include?('allow_failure') columns << :allow_failure if !subject.respond_to?(:column_names) || subject.column_names.include?('allow_failure')
subject subject
.pluck(*columns) .pluck(*columns) # rubocop: disable CodeReuse/ActiveRecord
.map { |attrs| columns.zip(attrs).to_h } .map { |attrs| columns.zip(attrs).to_h }
end end
......
...@@ -50,6 +50,5 @@ describe Gitlab::Ci::Status::CompositeStatus do ...@@ -50,6 +50,5 @@ describe Gitlab::Ci::Status::CompositeStatus do
it_behaves_like 'validate all combinations', 0 it_behaves_like 'validate all combinations', 0
it_behaves_like 'validate all combinations', 1 it_behaves_like 'validate all combinations', 1
it_behaves_like 'validate all combinations', 2 it_behaves_like 'validate all combinations', 2
#it_behaves_like 'validate all combinations', 3
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment