2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
feature 'Visibility settings', js: true do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, namespace: user.namespace, visibility_level: 20) }
|
|
|
|
|
|
|
|
context 'as owner' do
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit edit_project_path(project)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'project visibility select is available' do
|
|
|
|
visibility_select_container = find('.js-visibility-select')
|
|
|
|
|
|
|
|
expect(visibility_select_container.find('.visibility-select').value).to eq project.visibility_level.to_s
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(visibility_select_container).to have_content 'The project can be accessed without any authentication.'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'project visibility description updates on change' do
|
|
|
|
visibility_select_container = find('.js-visibility-select')
|
|
|
|
visibility_select = visibility_select_container.find('.visibility-select')
|
|
|
|
visibility_select.select('Private')
|
|
|
|
|
|
|
|
expect(visibility_select.value).to eq '0'
|
|
|
|
expect(visibility_select_container).to have_content 'Project access must be granted explicitly to each user.'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'as master' do
|
|
|
|
let(:master_user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [master_user, :master]
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(master_user)
|
|
|
|
visit edit_project_path(project)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'project visibility is locked' do
|
|
|
|
visibility_select_container = find('.js-visibility-select')
|
|
|
|
|
|
|
|
expect(visibility_select_container).not_to have_select '.visibility-select'
|
|
|
|
expect(visibility_select_container).to have_content 'Public'
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(visibility_select_container).to have_content 'The project can be accessed without any authentication.'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|