Merge pull request #1063 from opf/feature/wiki_history_cuke

[Feature] Wiki history cuke
pull/1066/head
Alex Coles 11 years ago
commit b7bf7d2425
  1. 20
      features/step_definitions/wiki_steps.rb
  2. 67
      features/wiki/wiki_add_edit.feature
  3. 14
      features/wiki/wiki_create_child.feature

@ -81,3 +81,23 @@ Given /^the wiki page "([^"]*)" of the project "([^"]*)" has the following conte
wc = wp.content || wp.create_content
wc.update_attribute(:text, table.raw.first)
end
Given /^the wiki page "([^"]*)" of the project "([^"]*)" has (\d+) versions{0,1}$/ do |page, project, version_count|
project = Project.find_by_name project
wiki = project.wiki
wp = wiki.pages.find_or_create_by_title(page)
wp.save! unless wp.persisted?
wc = wp.content || FactoryGirl.create(:wiki_content, page: wp)
last_version = wc.journals.max(&:version).version
version_count.to_i.times.each do |v|
version = last_version + v + 1
data = FactoryGirl.build(:journal_wiki_content_journal,
text: "This is version #{version}")
FactoryGirl.create(:wiki_content_journal,
version: version,
data: data,
journable_id: wc.id)
end
end

@ -28,35 +28,46 @@
Feature: Adding and Editing Wiki Tabs
Background:
Background:
Given there is 1 project with the following:
| Name | Wookies |
And the project "Wookies" uses the following modules:
| wiki |
And the project "Wookies" has 1 wiki page with the following:
| Title | wookietest |
Given there is 1 project with the following:
@javascript
Scenario: Adding simple wiki tab as admin
Given I am admin
And I am working in project "Wookies"
And I go to the wiki index page of the project called "Wookies"
| Name | Wookies |
@javascript
Scenario: Editing of wiki pages as a member with proper rights
Given there is 1 user with the following:
| login | chewbacca|
And I am logged in as "chewbacca"
And there is a role "humanoid"
And the role "humanoid" may have the following rights:
| view_wiki_pages |
| edit_wiki_pages |
And the user "chewbacca" is a "humanoid" in the project "Wookies"
When I go to the wiki page "wookietest" for the project called "Wookies"
And I click "Edit"
And I fill in "content_text" with "testing wookie"
And I click "Save"
Then I should see "testing wookie" within "#content"
And I click "Edit"
And the project "Wookies" uses the following modules:
| wiki |
And the project "Wookies" has 1 wiki page with the following:
| Title | wookietest |
@javascript
Scenario: Adding simple wiki tab as admin
Given I am admin
And I am working in project "Wookies"
And I go to the wiki index page of the project called "Wookies"
@javascript
Scenario: Editing of wiki pages as a member with proper rights
Given there is 1 user with the following:
| login | chewbacca|
And I am logged in as "chewbacca"
And there is a role "humanoid"
And the role "humanoid" may have the following rights:
| view_wiki_pages |
| edit_wiki_pages |
And the user "chewbacca" is a "humanoid" in the project "Wookies"
When I go to the wiki page "wookietest" for the project called "Wookies"
And I click "Edit"
And I fill in "content_text" with "testing wookie"
And I click "Save"
Then I should see "testing wookie" within "#content"
@javascript
Scenario: Overview and see the history of a wiki page
Given I am already admin
Given the wiki page "Wookietest" of the project "Wookies" has 3 versions
And I go to the wiki page "wookietest" for the project called "Wookies"
And I follow "More functions" within "#content"
When I click "History"
Then I should see "History" within "#content"
When I press "View differences"
Then I should see "Version 1/4"
Then I should see "Version 2/4"

@ -39,9 +39,23 @@ Feature: Creating a wiki child page
And there is 1 project with the following:
| name | project1 |
| identifier | project1 |
| name | project1 |
And the user "bob" is a "member" in the project "project1"
And I am already logged in as "bob"
@javascript
Scenario: A user with proper rights can add a child wiki page
Given the project "project1" has 1 wiki page with the following:
| title | Wikiparentpage |
Given I go to the wiki index page of the project called "project1"
And I click "Wikiparentpage"
And I follow "More functions" within "#content"
And I click "Create new child page"
And I fill in "page_title" with "Todd's wiki"
And I press "Save"
When I go to the wiki index page of the project called "project1"
Then I should see "Todd's wiki" within "#content"
@javascript
Scenario: Creating a wiki child page the title of which contains special characters
Given the project "project1" has 1 wiki page with the following:

Loading…
Cancel
Save