Commit b9ca10b8 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix rubocop offense in pipeline build seed class

parent e262a281
......@@ -5,9 +5,7 @@ module Gitlab
class Build < Seed::Base
include Gitlab::Utils::StrongMemoize
attr_reader :pipeline, :attributes
delegate :dig, to: :attributes
delegate :dig, to: :@attributes
def initialize(pipeline, attributes)
@pipeline = pipeline
......@@ -23,6 +21,16 @@ module Gitlab
@attributes.merge!(user: current_user)
end
def included?
strong_memoize(:inclusion) do
only_specs = Gitlab::Ci::Build::Policy.fabricate(@only)
except_specs = Gitlab::Ci::Build::Policy.fabricate(@except)
only_specs.all? { |spec| spec.satisfied_by?(@pipeline) } &&
except_specs.none? { |spec| spec.satisfied_by?(@pipeline) }
end
end
def attributes
@attributes.merge(
pipeline: @pipeline,
......@@ -34,16 +42,6 @@ module Gitlab
)
end
def included?
strong_memoize(:inclusion) do
only_specs = Gitlab::Ci::Build::Policy.fabricate(@only)
except_specs = Gitlab::Ci::Build::Policy.fabricate(@except)
only_specs.all? { |spec| spec.satisfied_by?(pipeline) } &&
except_specs.none? { |spec| spec.satisfied_by?(pipeline) }
end
end
def to_resource
::Ci::Build.new(attributes)
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