diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 13 | ||||
-rw-r--r-- | spec/features/projects/files/creating_a_file_spec.rb | 5 | ||||
-rw-r--r-- | spec/lib/gitlab/regex_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/repository_spec.rb | 11 |
4 files changed, 24 insertions, 11 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 2d6565e6d3b..59a50ff9264 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -16,6 +16,19 @@ feature 'Admin updates settings', feature: true do expect(page).to have_content "Application settings saved successfully" end + scenario 'Uncheck all restricted visibility levels' do + find('#application_setting_visibility_level_0').set(false) + find('#application_setting_visibility_level_10').set(false) + find('#application_setting_visibility_level_20').set(false) + + click_button 'Save' + + expect(page).to have_content "Application settings saved successfully" + expect(find('#application_setting_visibility_level_0')).not_to be_checked + expect(find('#application_setting_visibility_level_10')).not_to be_checked + expect(find('#application_setting_visibility_level_20')).not_to be_checked + end + scenario 'Change application settings' do uncheck 'Gravatar enabled' fill_in 'Home page URL', with: 'https://about.gitlab.com/' diff --git a/spec/features/projects/files/creating_a_file_spec.rb b/spec/features/projects/files/creating_a_file_spec.rb index c31056c3ff7..1196994ac3a 100644 --- a/spec/features/projects/files/creating_a_file_spec.rb +++ b/spec/features/projects/files/creating_a_file_spec.rb @@ -30,11 +30,6 @@ feature 'User wants to create a file', feature: true do expect(page).to have_content 'The file has been successfully created' end - scenario 'file name contains invalid characters' do - submit_new_file(file_name: '\\') - expect(page).to have_content 'Path can contain only' - end - scenario 'file name contains directory traversal' do submit_new_file(file_name: '../README.md') expect(page).to have_content 'Path cannot include directory traversal' diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index 979f4fefcb6..51e2c3c38c6 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -14,12 +14,6 @@ describe Gitlab::Regex, lib: true do it { is_expected.not_to match('?gitlab') } end - describe '.file_name_regex' do - subject { described_class.file_name_regex } - - it { is_expected.to match('foo@bar') } - end - describe '.environment_slug_regex' do subject { described_class.environment_name_regex } diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index c69f0a495db..af305e9b234 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -347,6 +347,17 @@ describe Repository, models: true do expect(blob.data).to eq('Changelog!') end + it 'creates new file and dir when file_path has a forward slash' do + expect do + repository.create_file(user, 'new_dir/new_file.txt', 'File!', + message: 'Create new_file with new_dir', + branch_name: 'master') + end.to change { repository.commits('master').count }.by(1) + + expect(repository.tree('master', 'new_dir').path).to eq('new_dir') + expect(repository.blob_at('master', 'new_dir/new_file.txt').data).to eq('File!') + end + it 'respects the autocrlf setting' do repository.create_file(user, 'hello.txt', "Hello,\r\nWorld", message: 'Add hello world', |