2016-05-09 16:32:18 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Container Registry" do
|
|
|
|
let(:project) { create(:empty_project) }
|
|
|
|
let(:repository) { project.container_registry_repository }
|
|
|
|
let(:tag_name) { 'latest' }
|
|
|
|
let(:tags) { [tag_name] }
|
|
|
|
|
|
|
|
before do
|
|
|
|
login_as(:user)
|
|
|
|
project.team << [@user, :developer]
|
2016-05-16 19:03:55 -04:00
|
|
|
stub_container_registry_tags(*tags)
|
2016-05-16 19:07:49 -04:00
|
|
|
stub_container_registry_config(enabled: true)
|
2016-05-14 12:15:19 -04:00
|
|
|
allow(Auth::ContainerRegistryAuthenticationService).to receive(:full_access_token).and_return('token')
|
2016-05-09 16:32:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:project/container_registry' do
|
|
|
|
before do
|
|
|
|
visit namespace_project_container_registry_index_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when no tags' do
|
|
|
|
let(:tags) { [] }
|
2016-05-12 14:03:04 -04:00
|
|
|
|
2016-05-09 16:32:18 -04:00
|
|
|
it { expect(page).to have_content('No images in Container Registry for this project') }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there are tags' do
|
2016-06-21 07:08:10 -04:00
|
|
|
it { expect(page).to have_content(tag_name) }
|
|
|
|
it { expect(page).to have_content('d7a513a66') }
|
2016-05-09 16:32:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'DELETE /:project/container_registry/tag' do
|
|
|
|
before do
|
|
|
|
visit namespace_project_container_registry_index_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it do
|
|
|
|
expect_any_instance_of(::ContainerRegistry::Tag).to receive(:delete).and_return(true)
|
2016-05-12 14:03:04 -04:00
|
|
|
|
2016-05-09 16:32:18 -04:00
|
|
|
click_on 'Remove'
|
|
|
|
end
|
|
|
|
end
|
2016-05-12 14:03:04 -04:00
|
|
|
end
|