pull/4195/head
Oliver Günther 9 years ago
parent 3b30dec997
commit 3c89e99ed0
  1. 2
      app/views/wiki/index.html.erb
  2. 2
      features/step_definitions/web_steps.rb
  3. 5
      features/support/paths.rb
  4. 61
      features/wiki/breadcrumb.feature
  5. 8
      features/wiki/parent_page.feature
  6. 2
      features/wiki/wiki_add_edit.feature
  7. 2
      features/wiki/wiki_rename.feature
  8. 3
      spec/controllers/wiki_controller_spec.rb
  9. 30
      spec/lib/open_project/text_formatting_spec.rb
  10. 6
      spec_legacy/unit/project_spec.rb

@ -53,7 +53,7 @@ See doc/COPYRIGHT.rdoc for more details.
<%= f.link_to('HTML', url: {action: 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
<% end %>
<% else %>
<%= no_results_box(action_url: wiki_new_path(@project),
<%= no_results_box(action_url: new_project_wiki_path(@project),
display_action: authorize_for('wiki', 'new')) %>
<% end %>

@ -272,7 +272,7 @@ end
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
current_path.should == path_to(page_name)
CGI.unescape(current_path).should == CGI.unescape(path_to(page_name))
end
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|

@ -62,10 +62,13 @@ module NavigationHelpers
end
when /^the [wW]iki [pP]age "([^\"]+)" (?:for|of) the project called "([^\"]+)"$/
wiki_page = $1
project_identifier = $2.gsub("\"", '')
project = Project.find_by(name: project_identifier)
wiki_page.gsub!(' ', '%20')
project_identifier = project.identifier.gsub(' ', '%20')
"/projects/#{project_identifier}/wiki/#{$1}"
"/projects/#{project_identifier}/wiki/#{wiki_page}"
when /^the lost password page$/
'/account/lost_password'

@ -1,61 +0,0 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
Feature: Wiki menu items
Background:
Given there are no wiki menu items
And there is 1 project with the following:
| name | Awesome Project |
| identifier | awesome-project |
And there is a role "member"
And the role "member" may have the following rights:
| view_wiki_pages |
| edit_wiki_pages |
And there is 1 user with the following:
| login | bob |
And the user "bob" is a "member" in the project "Awesome Project"
And the project "Awesome Project" has 1 wiki page with the following:
| Title | Wiki |
And the project "Awesome Project" has 1 wiki page with the following:
| Title | Level1 |
And the project "Awesome Project" has a child wiki page of "Level1" with the following:
| Title | Level2 |
And the project "Awesome Project" has a child wiki page of "Level2" with the following:
| Title | Level3 |
And I am already logged in as "bob"
Scenario: Breadcrumb with wiki hierarchy and a different menu item name
Given the project "Awesome Project" has a wiki menu item with the following:
| title | Level3 |
| name | SomethingCompletelyDifferent |
When I go to the wiki page "Level3" for the project called "Awesome Project"
Then I should see "Level1" within ".breadcrumb"
And I should see "Level2" within ".breadcrumb"
And I should not see "Level3" within ".breadcrumb"
And I should see "SomethingCompletelyDifferent" within ".breadcrumb"

@ -32,9 +32,9 @@ Feature: Parent wiki page
Given there is 1 project with the following:
| Name | Test |
And the project "Test" has 1 wiki page with the following:
| Title | Test_page |
| Title | Test page |
Given the project "Test" has 1 wiki page with the following:
| Title | Parent_page |
| Title | Parent page |
And I am already admin
@javascript
@ -44,7 +44,7 @@ Feature: Parent wiki page
And I follow "Change parent page"
When I select "Parent page" from "Parent page"
And I press "Save"
Then I should be on the wiki page "Test_page" for the project called "Test"
Then I should be on the wiki page "Test page" for the project called "Test"
And the breadcrumbs should have the element "Parent page"
# no check removing the parent
When I go to the wiki page "Test page" for the project called "Test"
@ -52,5 +52,5 @@ Feature: Parent wiki page
And I follow "Change parent page"
And I select "" from "Parent page"
And I press "Save"
Then I should be on the wiki page "Test_page" for the project called "Test"
Then I should be on the wiki page "Test page" for the project called "Test"
And the breadcrumbs should not have the element "Parent page"

@ -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" within "#content"
When I click "History"

@ -51,5 +51,5 @@ Feature: Renaming a wiki page
And I click on "Rename"
And I fill in "New WikiPage" for "Title"
And I press "Rename"
Then I should be on the wiki page "New_WikiPage" of the project called "project1"
Then I should be on the wiki page "New WikiPage" of the project called "project1"
And I should see "Successful update." within ".notice"

@ -125,9 +125,8 @@ describe WikiController, type: :controller do
project_id: @project,
content: { text: 'h1. abc', page: { title: 'abc' } }
page = @project.wiki.pages.find_by title: 'Abc'
page = @project.wiki.pages.find_by title: 'abc'
expect(page).not_to be_nil
expect(page.title).to eq('Abc')
expect(page.content.text).to eq('h1. abc')
end
end

@ -307,7 +307,7 @@ describe OpenProject::TextFormatting do
let(:wiki_page_1_1) {
FactoryGirl.create :wiki_page_with_content,
wiki: wiki_1,
title: 'CookBook_documentation'
title: 'CookBook documentation'
}
let(:wiki_page_1_2) {
FactoryGirl.create :wiki_page_with_content,
@ -320,7 +320,7 @@ describe OpenProject::TextFormatting do
wiki_page_2_1 = FactoryGirl.create :wiki_page_with_content,
wiki: project_2.wiki,
title: 'Start_page'
title: 'Start Page'
project_2.wiki.pages << wiki_page_2_1
project_2.wiki.start_page = 'Start Page'
@ -335,37 +335,37 @@ describe OpenProject::TextFormatting do
context 'Plain wiki link' do
subject { format_text('[[CookBook documentation]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/CookBook_documentation\">CookBook documentation</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/CookBook%20documentation\">CookBook documentation</a></p>") }
end
context 'Plain wiki page link' do
subject { format_text('[[Another page|Page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another_page\">Page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another%20page\">Page</a></p>") }
end
context 'Wiki link with anchor' do
subject { format_text('[[CookBook documentation#One-section]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/CookBook_documentation#One-section\">CookBook documentation</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/CookBook%20documentation#One-section\">CookBook documentation</a></p>") }
end
context 'Wiki page link with anchor' do
subject { format_text('[[Another page#anchor|Page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another_page#anchor\">Page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another%20page#anchor\">Page</a></p>") }
end
context 'Wiki link to an unknown page' do
subject { format_text('[[Unknown page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/Unknown_page\">Unknown page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/Unknown%20page\">Unknown page</a></p>") }
end
context 'Wiki page link to an unknown page' do
subject { format_text('[[Unknown page|404]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/Unknown_page\">404</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/Unknown%20page\">404</a></p>") }
end
context "Link to another project's wiki" do
@ -383,31 +383,31 @@ describe OpenProject::TextFormatting do
context "Link to another project's wiki page" do
subject { format_text('[[onlinestore:Start page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/onlinestore/wiki/Start_page\">Start page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/onlinestore/wiki/Start%20page\">Start page</a></p>") }
end
context "Link to another project's wiki page with label" do
subject { format_text('[[onlinestore:Start page|Text]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/onlinestore/wiki/Start_page\">Text</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page\" href=\"/projects/onlinestore/wiki/Start%20page\">Text</a></p>") }
end
context 'Link to an unknown wiki page in another project' do
subject { format_text('[[onlinestore:Unknown page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/onlinestore/wiki/Unknown_page\">Unknown page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/onlinestore/wiki/Unknown%20page\">Unknown page</a></p>") }
end
context 'Struck through link to wiki page' do
subject { format_text('-[[Another page|Page]]-') }
it { is_expected.to be_html_eql("<p><del><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another_page\">Page</a></del></p>") }
it { is_expected.to be_html_eql("<p><del><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another%20page\">Page</a></del></p>") }
end
context 'Named struck through link to wiki page' do
subject { format_text('-[[Another page|Page]] link-') }
it { is_expected.to be_html_eql("<p><del><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another_page\">Page</a> link</del></p>") }
it { is_expected.to be_html_eql("<p><del><a class=\"wiki-page\" href=\"/projects/#{project.identifier}/wiki/Another%20page\">Page</a> link</del></p>") }
end
context 'Escaped link to wiki page' do
@ -491,7 +491,7 @@ describe OpenProject::TextFormatting do
let(:wiki_page) {
FactoryGirl.create :wiki_page_with_content,
wiki: wiki,
title: 'CookBook_documentation'
title: 'CookBook documentation'
}
let(:raw) {
<<-RAW
@ -509,7 +509,7 @@ RAW
let(:expected) {
<<-EXPECTED
<p><a class="wiki-page" href="/projects/#{project.identifier}/wiki/CookBook_documentation">CookBook documentation</a></p>
<p><a class="wiki-page" href="/projects/#{project.identifier}/wiki/CookBook%20documentation">CookBook documentation</a></p>
<p><a class="issue work_package status-3 priority-1 created-by-me" href="/work_packages/#{issue.id}" title="#{issue.subject} (#{issue.status})">##{issue.id}</a></p>
<pre>
[[CookBook documentation]]

@ -939,9 +939,9 @@ describe Project, type: :model do
assert !@source_project.wiki.pages.include?(wiki_page)
end
parent = @project.wiki.find_page('Parent_page')
child1 = @project.wiki.find_page('Child_page_1')
child2 = @project.wiki.find_page('Child_page_2')
parent = @project.wiki.find_page('Parent page')
child1 = @project.wiki.find_page('Child page 1')
child2 = @project.wiki.find_page('Child page 2')
assert_equal parent, child1.parent
assert_equal parent, child2.parent
end

Loading…
Cancel
Save