summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-26 12:06:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-26 12:06:18 +0000
commit6a4ffad42050949fcf08e78147575734ae99627e (patch)
tree723bb2480948ba4ec29ca9ac10f8728dc2a831b6 /spec/views
parent23d237110e6a646dec08e1f5b4696d2d9c51cfef (diff)
downloadgitlab-ce-6a4ffad42050949fcf08e78147575734ae99627e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/import/gitlab_projects/new.html.haml_spec.rb31
1 files changed, 31 insertions, 0 deletions
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