2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2017-03-23 09:37:17 -04:00
|
|
|
factory :container_repository do
|
2017-03-24 07:31:34 -04:00
|
|
|
name 'test_container_image'
|
2017-03-23 09:37:17 -04:00
|
|
|
project
|
|
|
|
|
|
|
|
transient do
|
2017-03-24 07:31:34 -04:00
|
|
|
tags []
|
2017-03-23 09:37:17 -04:00
|
|
|
end
|
|
|
|
|
2017-04-03 06:49:54 -04:00
|
|
|
trait :root do
|
|
|
|
name ''
|
|
|
|
end
|
|
|
|
|
2017-03-24 07:31:34 -04:00
|
|
|
after(:build) do |repository, evaluator|
|
2017-03-31 05:54:09 -04:00
|
|
|
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|
|
2017-03-24 07:31:34 -04:00
|
|
|
allow(repository.client)
|
2017-03-31 05:54:09 -04:00
|
|
|
.to receive(:repository_tag_digest)
|
|
|
|
.with(repository.path, tag)
|
|
|
|
.and_return('sha256:4c8e63ca4cb663ce6c688cb06f1c3' \
|
|
|
|
'72b088dac5b6d7ad7d49cd620d85cf72a15')
|
2017-03-24 07:31:34 -04:00
|
|
|
end
|
2017-03-23 09:37:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|