summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-10 13:29:30 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-10 13:29:30 +0200
commitbb294b91d7a74e00ea9e93011fdad47d88c7cfdf (patch)
tree0ef4cb0e44aa3b833f93c6dcc79a499628620750
parent7ec3c2dcee9da79dfa8d034377fe9462ff8e5b0b (diff)
downloadgitlab-ce-bb294b91d7a74e00ea9e93011fdad47d88c7cfdf.tar.gz
Add container registry repositories view specsfix/gb/improve-container-registry-clipboard-links
-rw-r--r--app/views/projects/registry/repositories/_image.html.haml2
-rw-r--r--app/views/projects/registry/repositories/_tag.html.haml2
-rw-r--r--spec/views/projects/registry/repositories/index.html.haml_spec.rb36
3 files changed, 38 insertions, 2 deletions
diff --git a/app/views/projects/registry/repositories/_image.html.haml b/app/views/projects/registry/repositories/_image.html.haml
index d183ce34a3a..8bc78f8d018 100644
--- a/app/views/projects/registry/repositories/_image.html.haml
+++ b/app/views/projects/registry/repositories/_image.html.haml
@@ -4,7 +4,7 @@
= icon('chevron-down', 'aria-hidden': 'true')
= escape_once(image.path)
- = clipboard_button(clipboard_text: "docker pull #{image.path}")
+ = clipboard_button(clipboard_text: "docker pull #{image.location}")
.controls.hidden-xs.pull-right
= link_to namespace_project_container_registry_path(@project.namespace, @project, image),
diff --git a/app/views/projects/registry/repositories/_tag.html.haml b/app/views/projects/registry/repositories/_tag.html.haml
index 854b7d0ebf7..378a23f07e6 100644
--- a/app/views/projects/registry/repositories/_tag.html.haml
+++ b/app/views/projects/registry/repositories/_tag.html.haml
@@ -1,7 +1,7 @@
%tr.tag
%td
= escape_once(tag.name)
- = clipboard_button(text: "docker pull #{tag.path}")
+ = clipboard_button(text: "docker pull #{tag.location}")
%td
- if tag.revision
%span.has-tooltip{ title: "#{tag.revision}" }
diff --git a/spec/views/projects/registry/repositories/index.html.haml_spec.rb b/spec/views/projects/registry/repositories/index.html.haml_spec.rb
new file mode 100644
index 00000000000..ceeace3dc8d
--- /dev/null
+++ b/spec/views/projects/registry/repositories/index.html.haml_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe 'projects/registry/repositories/index', :view do
+ let(:group) { create(:group, path: 'group') }
+ let(:project) { create(:empty_project, group: group, path: 'test') }
+
+ let(:repository) do
+ create(:container_repository, project: project, name: 'image')
+ end
+
+ before do
+ stub_container_registry_config(enabled: true,
+ host_port: 'registry.gitlab',
+ api_url: 'http://registry.gitlab')
+
+ stub_container_registry_tags(repository: :any, tags: [:latest])
+
+ assign(:project, project)
+ assign(:images, [repository])
+
+ allow(view).to receive(:can?).and_return(true)
+ end
+
+ it 'contains container repository path' do
+ render
+
+ expect(rendered).to have_content 'group/test/image'
+ end
+
+ it 'contains attribute for copying tag location into clipboard' do
+ render
+
+ expect(rendered).to have_css 'button[data-clipboard-text="docker pull ' \
+ 'registry.gitlab/group/test/image:latest"]'
+ end
+end