2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2017-08-17 22:00:37 +05:30
|
|
|
factory :container_repository do
|
2019-10-12 21:52:04 +05:30
|
|
|
sequence(:name) { |n| "test_image_#{n}" }
|
2017-08-17 22:00:37 +05:30
|
|
|
project
|
|
|
|
|
|
|
|
transient do
|
|
|
|
tags []
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :root do
|
|
|
|
name ''
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |repository, evaluator|
|
|
|
|
next if evaluator.tags.to_a.none?
|
|
|
|
|
|
|
|
allow(repository.client)
|
|
|
|
.to receive(:repository_tags)
|
|
|
|
.and_return({
|
|
|
|
'name' => repository.path,
|
|
|
|
'tags' => evaluator.tags
|
|
|
|
})
|
|
|
|
|
|
|
|
evaluator.tags.each do |tag|
|
|
|
|
allow(repository.client)
|
|
|
|
.to receive(:repository_tag_digest)
|
|
|
|
.with(repository.path, tag)
|
|
|
|
.and_return('sha256:4c8e63ca4cb663ce6c688cb06f1c3' \
|
|
|
|
'72b088dac5b6d7ad7d49cd620d85cf72a15')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|