summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-20 00:29:05 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-20 00:29:05 -0700
commit67bda08cbe807c4a789e5e35c8cd0b795fa6b787 (patch)
tree3d0f9baf6428f2326406ef3af45730c554408c13
parent6880ace1feff9fdd390099026882fe4af3e4b742 (diff)
parent8300ae366cc2a2e342002a96e735445e8bf15f14 (diff)
downloadgitlab-ce-67bda08cbe807c4a789e5e35c8cd0b795fa6b787.tar.gz
Merge pull request #3266 from DanKnox/fix_wiki_cancel_edit_button
Fix the Cancel button on the Edit Wiki page.
-rw-r--r--app/views/wikis/_form.html.haml5
-rw-r--r--features/project/wiki.feature11
-rw-r--r--features/steps/project/project_wiki.rb16
3 files changed, 31 insertions, 1 deletions
diff --git a/app/views/wikis/_form.html.haml b/app/views/wikis/_form.html.haml
index 6fa41db4f7a..7cf08815f78 100644
--- a/app/views/wikis/_form.html.haml
+++ b/app/views/wikis/_form.html.haml
@@ -30,4 +30,7 @@
.input= f.text_field :message, class: 'span8'
.actions
= f.submit 'Save', class: "btn-save btn"
- = link_to "Cancel", project_wiki_path(@project, :index), class: "btn btn-cancel"
+ - if @wiki && @wiki.persisted?
+ = link_to "Cancel", project_wiki_path(@project, @wiki), class: "btn btn-cancel"
+ - else
+ = link_to "Cancel", project_wiki_path(@project, :home), class: "btn btn-cancel"
diff --git a/features/project/wiki.feature b/features/project/wiki.feature
index 45761f09f51..90eb2b79c66 100644
--- a/features/project/wiki.feature
+++ b/features/project/wiki.feature
@@ -8,6 +8,10 @@ Feature: Project Wiki
Given I create the Wiki Home page
Then I should see the newly created wiki page
+ Scenario: Pressing Cancel while editing a brand new Wiki
+ Given I click on the Cancel button
+ Then I should be redirected back to the Edit Home Wiki page
+
Scenario: Edit existing page
Given I have an existing Wiki page
And I browse to that Wiki page
@@ -15,6 +19,13 @@ Feature: Project Wiki
And I change the content
Then I should see the updated content
+ Scenario: Pressing Cancel while editing an existing Wiki page
+ Given I have an existing Wiki page
+ And I browse to that Wiki page
+ And I click on the Edit button
+ And I click on the Cancel button
+ Then I should be redirected back to that Wiki page
+
Scenario: View page history
Given I have an existing wiki page
And That page has two revisions
diff --git a/features/steps/project/project_wiki.rb b/features/steps/project/project_wiki.rb
index 1a811bad798..745e9ede249 100644
--- a/features/steps/project/project_wiki.rb
+++ b/features/steps/project/project_wiki.rb
@@ -4,6 +4,17 @@ class ProjectWiki < Spinach::FeatureSteps
include SharedNote
include SharedPaths
+ Given 'I click on the Cancel button' do
+ within(:css, ".actions") do
+ click_on "Cancel"
+ end
+ end
+
+ Then 'I should be redirected back to the Edit Home Wiki page' do
+ url = URI.parse(current_url)
+ url.path.should == project_wiki_path(project, :home)
+ end
+
Given 'I create the Wiki Home page' do
fill_in "Content", :with => '[link test](test)'
click_on "Save"
@@ -39,6 +50,11 @@ class ProjectWiki < Spinach::FeatureSteps
page.should have_content "Updated Wiki Content"
end
+ Then 'I should be redirected back to that Wiki page' do
+ url = URI.parse(current_url)
+ url.path.should == project_wiki_path(project, @page)
+ end
+
And 'That page has two revisions' do
@page.update("new content", :markdown, "second commit")
end