2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'import/gitlab_projects/new.html.haml' do
|
2020-01-01 13:55:28 +05:30
|
|
|
include Devise::Test::ControllerHelpers
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
let(:namespace) { build_stubbed(:namespace) }
|
|
|
|
let(:user) { build_stubbed(:user, namespace: namespace) }
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_user).and_return(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the user has no other namespaces' do
|
2020-04-08 14:13:33 +05:30
|
|
|
it 'adds a namespace_id hidden field tag with the namespace id as value' do
|
2020-01-01 13:55:28 +05:30
|
|
|
render
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
expect(rendered).to have_css("input[name='namespace_id'][value='#{namespace.id}']", count: 1, visible: false)
|
2020-01-01 13:55:28 +05:30
|
|
|
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
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
expect(rendered).to have_css('.js-vue-new-project-url-select', count: 1)
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|