2016-07-25 23:28:08 -04:00
require 'spec_helper'
describe 'Edit Project Settings' , feature : true do
let ( :user ) { create ( :user ) }
let ( :project ) { create ( :empty_project , path : 'gitlab' , name : 'sample' ) }
before do
login_as ( user )
project . team << [ user , :master ]
end
describe 'Project settings' , js : true do
it 'shows errors for invalid project name' do
visit edit_namespace_project_path ( project . namespace , project )
fill_in 'project_name_edit' , with : 'foo&bar'
click_button 'Save changes'
expect ( page ) . to have_field 'project_name_edit' , with : 'foo&bar'
2016-11-11 06:27:23 -05:00
expect ( page ) . to have_content " Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'. "
2016-07-25 23:28:08 -04:00
expect ( page ) . to have_button 'Save changes'
end
2017-01-15 01:58:05 -05:00
scenario 'shows a successful notice when the project is updated' do
visit edit_namespace_project_path ( project . namespace , project )
fill_in 'project_name_edit' , with : 'hello world'
click_button 'Save changes'
expect ( page ) . to have_content " Project 'hello world' was successfully updated. "
end
2016-07-25 23:28:08 -04:00
end
describe 'Rename repository' do
it 'shows errors for invalid project path/name' do
visit edit_namespace_project_path ( project . namespace , project )
2017-01-25 17:04:02 -05:00
fill_in 'project_name' , with : 'foo&bar'
2016-07-25 23:28:08 -04:00
fill_in 'Path' , with : 'foo&bar'
click_button 'Rename project'
2016-07-26 14:27:42 -04:00
expect ( page ) . to have_field 'Project name' , with : 'foo&bar'
expect ( page ) . to have_field 'Path' , with : 'foo&bar'
2016-11-11 06:27:23 -05:00
expect ( page ) . to have_content " Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'. "
2016-07-25 23:28:08 -04:00
expect ( page ) . to have_content " Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom' "
end
end
2016-11-11 06:27:23 -05:00
describe 'Rename repository name with emojis' do
it 'shows error for invalid project name' do
visit edit_namespace_project_path ( project . namespace , project )
2017-01-25 17:04:02 -05:00
fill_in 'project_name' , with : '🚀 foo bar ☁️'
2016-11-11 06:27:23 -05:00
click_button 'Rename project'
expect ( page ) . to have_field 'Project name' , with : '🚀 foo bar ☁️'
expect ( page ) . not_to have_content " Name can contain only letters, digits, emojis '_', '.', dash and space. It must start with letter, digit, emoji or '_'. "
end
end
2016-07-25 23:28:08 -04:00
end