2016-11-03 13:47:15 +00:00
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
feature "New project", feature: true do
|
2017-01-30 17:43:13 +00:00
|
|
|
let(:user) { create(:admin) }
|
2016-11-03 13:47:15 +00:00
|
|
|
|
2017-01-30 17:43:13 +00:00
|
|
|
before do
|
|
|
|
login_as(user)
|
|
|
|
end
|
2016-11-03 13:47:15 +00:00
|
|
|
|
2017-01-30 17:43:13 +00:00
|
|
|
context "Visibility level selector" do
|
2016-11-03 13:47:15 +00:00
|
|
|
Gitlab::VisibilityLevel.options.each do |key, level|
|
|
|
|
it "sets selector to #{key}" do
|
|
|
|
stub_application_setting(default_project_visibility: level)
|
|
|
|
|
|
|
|
visit new_project_path
|
|
|
|
|
|
|
|
expect(find_field("project_visibility_level_#{level}")).to be_checked
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-01-30 17:43:13 +00:00
|
|
|
|
2017-02-20 17:01:37 +00:00
|
|
|
context "Namespace selector" do
|
|
|
|
context "with user namespace" do
|
|
|
|
before do
|
|
|
|
visit new_project_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it "selects the user namespace" do
|
|
|
|
namespace = find("#project_namespace_id")
|
|
|
|
|
|
|
|
expect(namespace.text).to eq user.username
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with group namespace" do
|
|
|
|
let(:group) { create(:group, :private, owner: user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
group.add_owner(user)
|
|
|
|
visit new_project_path(namespace_id: group.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "selects the group namespace" do
|
|
|
|
namespace = find("#project_namespace_id option[selected]")
|
|
|
|
|
|
|
|
expect(namespace.text).to eq group.name
|
|
|
|
end
|
|
|
|
|
|
|
|
context "on validation error" do
|
|
|
|
before do
|
|
|
|
fill_in('project_path', with: 'private-group-project')
|
|
|
|
choose('Internal')
|
|
|
|
click_button('Create project')
|
|
|
|
|
|
|
|
expect(page).to have_css '.project-edit-errors .alert.alert-danger'
|
|
|
|
end
|
|
|
|
|
|
|
|
it "selects the group namespace" do
|
|
|
|
namespace = find("#project_namespace_id option[selected]")
|
|
|
|
|
|
|
|
expect(namespace.text).to eq group.name
|
|
|
|
end
|
2017-03-11 10:47:48 +00:00
|
|
|
|
|
|
|
it 'selects the visibility level' do
|
|
|
|
level = Gitlab::VisibilityLevel.options['Internal']
|
|
|
|
|
|
|
|
expect(find_field("project_visibility_level_#{level}")).to be_checked
|
|
|
|
end
|
2017-02-20 17:01:37 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-01-30 17:43:13 +00:00
|
|
|
context 'Import project options' do
|
|
|
|
before do
|
|
|
|
visit new_project_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not autocomplete sensitive git repo URL' do
|
|
|
|
autocomplete = find('#project_import_url')['autocomplete']
|
|
|
|
|
|
|
|
expect(autocomplete).to eq('off')
|
|
|
|
end
|
|
|
|
end
|
2016-11-03 13:47:15 +00:00
|
|
|
end
|