diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-04 15:52:42 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-04 15:52:42 +0300 |
commit | 9bb1d8fc8d2119ed46ac2e11ed9d295a61cf7a28 (patch) | |
tree | 51f60862e936de65c581f46bf4b641a2e7ad2cfa /features | |
parent | 640a3c5c89cc2d20382f4c1045e4b0b05964176a (diff) | |
parent | 392113919adc75ba1537d89a0de8d0641e24d5b8 (diff) | |
download | gitlab-ce-9bb1d8fc8d2119ed46ac2e11ed9d295a61cf7a28.tar.gz |
Merge pull request #7382 from Razer6/git_ref_validation
Validate branch/tag-names and references WebUI, API
Diffstat (limited to 'features')
-rw-r--r-- | features/project/commits/branches.feature | 20 | ||||
-rw-r--r-- | features/project/commits/tags.feature | 20 | ||||
-rw-r--r-- | features/steps/project/browse_branches.rb | 34 | ||||
-rw-r--r-- | features/steps/project/browse_tags.rb | 46 |
4 files changed, 115 insertions, 5 deletions
diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature index d657bd4951f..d124cb7eecd 100644 --- a/features/project/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -15,7 +15,7 @@ Feature: Project Browse branches Scenario: I create a branch Given I visit project branches page And I click new branch link - When I submit new branch form + And I submit new branch form Then I should see new branch created @javascript @@ -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 + And 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 + And 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 + And 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/project/commits/tags.feature b/features/project/commits/tags.feature index 1ac0f8bfa45..36c7a6492ff 100644 --- a/features/project/commits/tags.feature +++ b/features/project/commits/tags.feature @@ -7,5 +7,25 @@ Feature: Project Browse tags Scenario: I can see all git tags Then I should see "Shop" all tags list + Scenario: I create a tag + And I click new tag link + And I submit new tag form + Then I should see new tag created + + Scenario: I create a tag with invalid name + And I click new tag link + And I submit new tag form with invalid name + Then I should see new an error that tag is invalid + + Scenario: I create a tag with invalid reference + And I click new tag link + And I submit new tag form with invalid reference + Then I should see new an error that tag ref is invalid + + Scenario: I create a tag that already exists + And I click new tag link + And I submit new tag form with tag that already exists + Then I should see new an error that tag already exists + # @wip # Scenario: I can download project by tag 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 diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb index 7c679911e00..64c0c284f6c 100644 --- a/features/steps/project/browse_tags.rb +++ b/features/steps/project/browse_tags.rb @@ -3,8 +3,52 @@ class ProjectBrowseTags < Spinach::FeatureSteps include SharedProject include SharedPaths - Then 'I should see "Shop" all tags list' do + step 'I should see "Shop" all tags list' do page.should have_content "Tags" page.should have_content "v1.0.0" end + + step 'I click new tag link' do + click_link 'New tag' + end + + step 'I submit new tag form' do + fill_in 'tag_name', with: 'v7.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I submit new tag form with invalid name' do + fill_in 'tag_name', with: 'v 1.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I submit new tag form with invalid reference' do + fill_in 'tag_name', with: 'foo' + fill_in 'ref', with: 'foo' + click_button 'Create tag' + end + + step 'I submit new tag form with tag that already exists' do + fill_in 'tag_name', with: 'v1.0.0' + fill_in 'ref', with: 'master' + click_button 'Create tag' + end + + step 'I should see new tag created' do + page.should have_content 'v7.0' + end + + step 'I should see new an error that tag is invalid' do + page.should have_content 'Tag name invalid' + end + + step 'I should see new an error that tag ref is invalid' do + page.should have_content 'Invalid reference name' + end + + step 'I should see new an error that tag already exists' do + page.should have_content 'Tag already exists' + end end |