From 6a4ffad42050949fcf08e78147575734ae99627e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 26 Nov 2019 12:06:18 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../import/gitlab_projects/new.html.haml_spec.rb | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 spec/views/import/gitlab_projects/new.html.haml_spec.rb (limited to 'spec/views') diff --git a/spec/views/import/gitlab_projects/new.html.haml_spec.rb b/spec/views/import/gitlab_projects/new.html.haml_spec.rb new file mode 100644 index 00000000000..953fcc6dc51 --- /dev/null +++ b/spec/views/import/gitlab_projects/new.html.haml_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'import/gitlab_projects/new.html.haml' do + include Devise::Test::ControllerHelpers + + let(:user) { build_stubbed(:user, namespace: build_stubbed(:namespace)) } + + before do + allow(view).to receive(:current_user).and_return(user) + end + + context 'when the user has no other namespaces' do + it 'shows a namespace_id hidden field tag' do + render + + expect(rendered).to have_css('input[name="namespace_id"]', count: 1, visible: false) + end + end + + context 'when the user can select other namespaces' do + it 'shows a namespace_id select' do + allow(user).to receive(:can_select_namespace?).and_return(true) + + render + + expect(rendered).to have_select('namespace_id', count: 1) + end + end +end -- cgit v1.2.1