gitlab-org--gitlab-foss/spec/factories/deployments.rb
Alessio Caiazza 4a9efc606f Move ci_environments_status to a model
GET :namespace/merge_requests/:id/ci_environments_status complexity
already reached a limit for a direct serialization from an hash
computed at within the controller function.

Here we introduce a virtual model EnvironmentStatus and its serializer.
2018-10-18 16:12:16 +02:00

25 lines
665 B
Ruby

FactoryBot.define do
factory :deployment, class: Deployment do
sha '97de212e80737a608d939f648d959671fb0a0142'
ref 'master'
tag false
user nil
project nil
deployable factory: :ci_build
environment factory: :environment
after(:build) do |deployment, evaluator|
deployment.project ||= deployment.environment.project
deployment.user ||= deployment.project.creator
unless deployment.project.repository_exists?
allow(deployment.project.repository).to receive(:create_ref)
end
end
trait :review_app do
sha { TestEnv::BRANCH_SHA['pages-deploy'] }
ref 'pages-deploy'
end
end
end