summaryrefslogtreecommitdiff
path: root/spec/features/groups_spec.rb
diff options
context:
space:
mode:
authorWill Starms <vilhelmen@gmail.com>2016-08-25 11:48:08 -0500
committerWill Starms <vilhelmen@gmail.com>2016-10-07 13:46:59 -0500
commit4f1de5faacb6824bad2624b75537e9f4ddbb1207 (patch)
treeb60a2b249f3039dc37854725a0c96a2ecbe0f8ab /spec/features/groups_spec.rb
parentc901936a829885263a602431e5762b0352073a2a (diff)
downloadgitlab-ce-4f1de5faacb6824bad2624b75537e9f4ddbb1207.tar.gz
Correct namespace validation to forbid bad names #21077
Adds .git and .atom to the master namespace regex Updates existing group tests and adds two new ones Updates path cleaning to also forbid .atom
Diffstat (limited to 'spec/features/groups_spec.rb')
-rw-r--r--spec/features/groups_spec.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb
index 2d8b59472e8..c54ec2563ad 100644
--- a/spec/features/groups_spec.rb
+++ b/spec/features/groups_spec.rb
@@ -5,6 +5,12 @@ feature 'Group', feature: true do
login_as(:admin)
end
+ matcher :have_namespace_error_message do
+ match do |page|
+ page.has_content?("Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-' or end in '.', '.git' or '.atom'.")
+ end
+ end
+
describe 'creating a group with space in group path' do
it 'renders new group form with validation errors' do
visit new_group_path
@@ -13,7 +19,31 @@ feature 'Group', feature: true do
click_button 'Create group'
expect(current_path).to eq(groups_path)
- expect(page).to have_content("Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-' or end in '.'.")
+ expect(page).to have_namespace_error_message
+ end
+ end
+
+ describe 'creating a group with .atom at end of group path' do
+ it 'renders new group form with validation errors' do
+ visit new_group_path
+ fill_in 'Group path', with: 'atom_group.atom'
+
+ click_button 'Create group'
+
+ expect(current_path).to eq(groups_path)
+ expect(page).to have_namespace_error_message
+ end
+ end
+
+ describe 'creating a group with .git at end of group path' do
+ it 'renders new group form with validation errors' do
+ visit new_group_path
+ fill_in 'Group path', with: 'git_group.git'
+
+ click_button 'Create group'
+
+ expect(current_path).to eq(groups_path)
+ expect(page).to have_namespace_error_message
end
end