Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Feature: Wiki Documents
In order to manage wiki content
As a user
I want see, create and edit wiki documents
#
Scenario: View document page
Given there is a document titled "TestDocument"
When I visit the "TestDocument" document page
Then I should see "TestDocument"
#
Scenario: Create a document without correct information
Given I am on the new document page
When I press "Add Page"
Then I should see "Title can't be blank"
And I should see "Document body can't be blank"
#
Scenario: Create a document
Given I am on the new document page
When I fill in the following:
| 'Title' | 'MyDocument' |
| 'Body' | 'Here is some content.' |
When I press "Add Page"
Then I should be on /documents/MyDocument
And I should see "MyDocument"
And I should see "Document successfully added"
Given /^there is a document titled "([^\"]*)"$/ do |title|
Document.create!(:title => title, :body => 'Some content.')
end
When /^I visit the "([^\"]*)" document page$/ do |title|
visit "/documents/#{title}"
end
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in webrat_steps.rb
#
def path_to(page_name)
case page_name
when /the homepage/
'/'
# Add more mappings here.
# Here is a more fancy example:
#
# when /^(.*)'s profile page$/i
# user_profile_path(User.find_by_login($1))
### ADD THIS FOR CleRBwiki!
when /the new document page/
'/documents/new'
### END ADD THIS
else
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
end
end
end
World(NavigationHelpers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment