From d20046a85a6daea7ac12aa346017fe9ebad173dd Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Fri, 28 Mar 2014 13:46:41 +0100 Subject: [PATCH 1/4] Fix layout --- features/wiki/wiki_add_edit.feature | 57 ++++++++++++++--------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/features/wiki/wiki_add_edit.feature b/features/wiki/wiki_add_edit.feature index ed2fef9d43..98a79ca8b2 100644 --- a/features/wiki/wiki_add_edit.feature +++ b/features/wiki/wiki_add_edit.feature @@ -28,35 +28,32 @@ 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 | - -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" \ No newline at end of file + @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" From bf40bd78a3bddaffc43e569628de007b73dce662 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 31 Mar 2014 08:01:48 +0200 Subject: [PATCH 2/4] Add wiki history cuke --- features/step_definitions/wiki_steps.rb | 19 +++++++++++++++++++ features/wiki/wiki_add_edit.feature | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/features/step_definitions/wiki_steps.rb b/features/step_definitions/wiki_steps.rb index 9f4dbaa763..f6a64e97a1 100644 --- a/features/step_definitions/wiki_steps.rb +++ b/features/step_definitions/wiki_steps.rb @@ -81,3 +81,22 @@ 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) + wc = wp.content || wp.create_content + + 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 diff --git a/features/wiki/wiki_add_edit.feature b/features/wiki/wiki_add_edit.feature index 98a79ca8b2..58ac603093 100644 --- a/features/wiki/wiki_add_edit.feature +++ b/features/wiki/wiki_add_edit.feature @@ -57,3 +57,17 @@ Feature: Adding and Editing Wiki Tabs 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" + + + @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" From e224d3b9d79727621bd015877d834de2ad9e093b Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 31 Mar 2014 12:39:54 +0200 Subject: [PATCH 3/4] Adds wiki child page creation cuke --- features/wiki/wiki_create_child.feature | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/features/wiki/wiki_create_child.feature b/features/wiki/wiki_create_child.feature index 1363d5a8dc..4513241339 100644 --- a/features/wiki/wiki_create_child.feature +++ b/features/wiki/wiki_create_child.feature @@ -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: From dec91fe89a3289cbffa7ad76992e63d7cdc097d5 Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 31 Mar 2014 14:37:23 +0200 Subject: [PATCH 4/4] Fix cuke for postgres --- features/step_definitions/wiki_steps.rb | 3 ++- features/wiki/wiki_add_edit.feature | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/wiki_steps.rb b/features/step_definitions/wiki_steps.rb index f6a64e97a1..b1242d4d3a 100644 --- a/features/step_definitions/wiki_steps.rb +++ b/features/step_definitions/wiki_steps.rb @@ -86,7 +86,8 @@ Given /^the wiki page "([^"]*)" of the project "([^"]*)" has (\d+) versions{0,1} project = Project.find_by_name project wiki = project.wiki wp = wiki.pages.find_or_create_by_title(page) - wc = wp.content || wp.create_content + wp.save! unless wp.persisted? + wc = wp.content || FactoryGirl.create(:wiki_content, page: wp) last_version = wc.journals.max(&:version).version diff --git a/features/wiki/wiki_add_edit.feature b/features/wiki/wiki_add_edit.feature index 58ac603093..96d6571a56 100644 --- a/features/wiki/wiki_add_edit.feature +++ b/features/wiki/wiki_add_edit.feature @@ -63,7 +63,7 @@ Feature: Adding and Editing Wiki Tabs @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 + 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"