summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2015-05-21 11:38:13 +0200
committerJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2015-05-26 19:01:11 +0200
commitb16aad9dd1de60585f8265eff11cdea19982740d (patch)
tree93cc54a6fdbfebeca4354c94e1ed03a73365f1e5 /features
parentb6117074ccb018a679d72f3faf4302ddb076a3ac (diff)
downloadgitlab-ce-b16aad9dd1de60585f8265eff11cdea19982740d.tar.gz
Validate wiki page creation
**What does this do?** It adds validation to the creation of a wiki page, that way the user gets real feedback instead of just a 404 page if the name of the wiki page was invalid **Why is this needed?** There are a lot of characters that are not allowed in the creation of a wiki page, there is even a small text that is saying: Please don't use spaces. Although we have that text there, we don't actually validate on this. This commit adds validation on the title and gives the user actual feedback. **What issues does this fix?** Fixes http://github.com/gitlabhq/gitlabhq/issues/5357 Fixes https://github.com/gitlabhq/gitlabhq/issues/8565 Fixes https://github.com/gitlabhq/gitlabhq/issues/3913 Fixes https://github.com/gitlabhq/gitlabhq/issues/8166 Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
Diffstat (limited to 'features')
-rw-r--r--features/project/wiki.feature5
-rw-r--r--features/steps/project/wiki.rb10
2 files changed, 15 insertions, 0 deletions
diff --git a/features/project/wiki.feature b/features/project/wiki.feature
index 977cd609a11..7a70f348754 100644
--- a/features/project/wiki.feature
+++ b/features/project/wiki.feature
@@ -69,6 +69,11 @@ Feature: Project Wiki
And I click on the "Pages" button
Then I should see non-escaped link in the pages list
+ @javascript @focus
+ Scenario: Creating an invalid new page
+ Given I create a New page with an invalid name
+ Then I should see an error message
+
@javascript
Scenario: Edit Wiki page that has a path
Given I create a New page with paths
diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb
index 717132da45d..58cb0ceb3f1 100644
--- a/features/steps/project/wiki.rb
+++ b/features/steps/project/wiki.rb
@@ -133,6 +133,16 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
current_path.should include 'one/two/three'
end
+ step 'I create a New page with an invalid name' do
+ click_on 'New Page'
+ fill_in 'Page slug', with: 'invalid name'
+ click_on 'Build'
+ end
+
+ step 'I should see an error message' do
+ expect(page).to have_content "The page slug is invalid"
+ end
+
step 'I should see non-escaped link in the pages list' do
page.should have_xpath("//a[@href='/#{project.path_with_namespace}/wikis/one/two/three']")
end