Fix the Cancel button on the Edit Wiki page.

The Cancel button on the Edit Wiki page was still redirecting back
to the "Index" page which is no longer the default Wiki page.

This commit changes the Cancel button in the following ways:

  * Pressing Cancel while editing an existing Wiki page will now
    redirect you back to the latest version of that page.
  * Pressing Cancel while editing a brand new Wiki home page that
    does not yet exist will redirect you to back to the same Edit
    Wiki Home page.
This commit is contained in:
Dan Knox 2013-03-19 21:28:10 -07:00
parent 6880ace1fe
commit 8300ae366c
3 changed files with 31 additions and 1 deletions

View file

@ -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