summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-07-27 16:40:00 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2014-09-03 13:08:35 +0200
commit551145bc98e257280b615e305d531a44d7aa4131 (patch)
tree20a853ca41d610247f955a9c8824ba50b18d3220 /features
parent7a0e1c7238033b33b7296701bfded56d4ad7f250 (diff)
downloadgitlab-ce-551145bc98e257280b615e305d531a44d7aa4131.tar.gz
Validate branch-names and references in WebUI, API
Add specs for GitRefValidator
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/branches.feature18
-rw-r--r--features/steps/project/browse_branches.rb34
2 files changed, 49 insertions, 3 deletions
diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature
index d657bd4951f..6725a697c21 100644
--- a/features/project/commits/branches.feature
+++ b/features/project/commits/branches.feature
@@ -23,3 +23,21 @@ Feature: Project Browse branches
Given I visit project branches page
And I click branch 'improve/awesome' delete link
Then I should not see branch 'improve/awesome'
+
+ Scenario: I create a branch with invalid name
+ Given I visit project branches page
+ And I click new branch link
+ When I submit new branch form with invalid name
+ Then I should see new an error that branch is invalid
+
+ Scenario: I create a branch with invalid reference
+ Given I visit project branches page
+ And I click new branch link
+ When I submit new branch form with invalid reference
+ Then I should see new an error that ref is invalid
+
+ Scenario: I create a branch that already exists
+ Given I visit project branches page
+ And I click new branch link
+ When I submit new branch form with branch that already exists
+ Then I should see new an error that branch already exists
diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb
index c00a95a62fd..cfc88bdad22 100644
--- a/features/steps/project/browse_branches.rb
+++ b/features/steps/project/browse_branches.rb
@@ -38,10 +38,38 @@ class ProjectBrowseBranches < Spinach::FeatureSteps
click_button 'Create branch'
end
+ step 'I submit new branch form with invalid name' do
+ fill_in 'branch_name', with: '1.0 stable'
+ fill_in 'ref', with: 'master'
+ click_button 'Create branch'
+ end
+
+ step 'I submit new branch form with invalid reference' do
+ fill_in 'branch_name', with: 'foo'
+ fill_in 'ref', with: 'foo'
+ click_button 'Create branch'
+ end
+
+ step 'I submit new branch form with branch that already exists' do
+ fill_in 'branch_name', with: 'master'
+ fill_in 'ref', with: 'master'
+ click_button 'Create branch'
+ end
+
step 'I should see new branch created' do
- within '.tree-ref-holder' do
- page.should have_content 'deploy_keys'
- end
+ page.should have_content 'deploy_keys'
+ end
+
+ step 'I should see new an error that branch is invalid' do
+ page.should have_content 'Branch name invalid'
+ end
+
+ step 'I should see new an error that ref is invalid' do
+ page.should have_content 'Invalid reference name'
+ end
+
+ step 'I should see new an error that branch already exists' do
+ page.should have_content 'Branch already exists'
end
step "I click branch 'improve/awesome' delete link" do