@@ -1,69 +1,69 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <% if @editable %> |
|
2 | <% if @editable %> | |
3 | <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %> |
|
3 | <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :id => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %> | |
4 | <%= watcher_tag(@page, User.current) %> |
|
4 | <%= watcher_tag(@page, User.current) %> | |
5 | <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> |
|
5 | <%= link_to_if_authorized(l(:button_lock), {:action => 'protect', :id => @page.title, :protected => 1}, :method => :post, :class => 'icon icon-lock') if !@page.protected? %> | |
6 | <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> |
|
6 | <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> | |
7 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> |
|
7 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> | |
8 | <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> |
|
8 | <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> | |
9 | <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> |
|
9 | <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :id => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> | |
10 | <% end %> |
|
10 | <% end %> | |
11 | <%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %> |
|
11 | <%= link_to_if_authorized(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %> | |
12 | </div> |
|
12 | </div> | |
13 |
|
13 | |||
14 | <%= wiki_page_breadcrumb(@page) %> |
|
14 | <%= wiki_page_breadcrumb(@page) %> | |
15 |
|
15 | |||
16 | <% if @content.version != @page.content.version %> |
|
16 | <% if @content.version != @page.content.version %> | |
17 | <p> |
|
17 | <p> | |
18 | <%= link_to(("\xc2\xab " + l(:label_previous)), |
|
18 | <%= link_to(("\xc2\xab " + l(:label_previous)), | |
19 | :action => 'show', :id => @page.title, :project_id => @page.project, |
|
19 | :action => 'show', :id => @page.title, :project_id => @page.project, | |
20 | :version => (@content.version - 1)) + " - " if @content.version > 1 %> |
|
20 | :version => (@content.version - 1)) + " - " if @content.version > 1 %> | |
21 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> |
|
21 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> | |
22 | <%= '(' + link_to(l(:label_diff), :controller => 'wiki', :action => 'diff', |
|
22 | <%= '(' + link_to(l(:label_diff), :controller => 'wiki', :action => 'diff', | |
23 | :id => @page.title, :project_id => @page.project, |
|
23 | :id => @page.title, :project_id => @page.project, | |
24 | :version => @content.version) + ')' if @content.version > 1 %> - |
|
24 | :version => @content.version) + ')' if @content.version > 1 %> - | |
25 | <%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show', |
|
25 | <%= link_to((l(:label_next) + " \xc2\xbb"), :action => 'show', | |
26 | :id => @page.title, :project_id => @page.project, |
|
26 | :id => @page.title, :project_id => @page.project, | |
27 | :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> |
|
27 | :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> | |
28 | <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %> |
|
28 | <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %> | |
29 | <br /> |
|
29 | <br /> | |
30 | <em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous) |
|
30 | <em><%= @content.author ? link_to_user(@content.author) : l(:label_user_anonymous) | |
31 | %>, <%= format_time(@content.updated_on) %> </em><br /> |
|
31 | %>, <%= format_time(@content.updated_on) %> </em><br /> | |
32 | <%=h @content.comments %> |
|
32 | <%=h @content.comments %> | |
33 | </p> |
|
33 | </p> | |
34 | <hr /> |
|
34 | <hr /> | |
35 | <% end %> |
|
35 | <% end %> | |
36 |
|
36 | |||
37 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> |
|
37 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> | |
38 |
|
38 | |||
39 | <%= link_to_attachments @page %> |
|
39 | <%= link_to_attachments @page %> | |
40 |
|
40 | |||
41 | <% if @editable && authorize_for('wiki', 'add_attachment') %> |
|
41 | <% if @editable && authorize_for('wiki', 'add_attachment') %> | |
42 | <div id="wiki_add_attachment"> |
|
42 | <div id="wiki_add_attachment"> | |
43 | <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", |
|
43 | <p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", | |
44 | :id => 'attach_files_link' %></p> |
|
44 | :id => 'attach_files_link' %></p> | |
45 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> |
|
45 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :id => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> | |
46 | <div class="box"> |
|
46 | <div class="box"> | |
47 | <p><%= render :partial => 'attachments/form' %></p> |
|
47 | <p><%= render :partial => 'attachments/form' %></p> | |
48 | </div> |
|
48 | </div> | |
49 | <%= submit_tag l(:button_add) %> |
|
49 | <%= submit_tag l(:button_add) %> | |
50 | <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %> |
|
50 | <%= link_to l(:button_cancel), {}, :onclick => "Element.hide('add_attachment_form'); Element.show('attach_files_link'); return false;" %> | |
51 | <% end %> |
|
51 | <% end %> | |
52 | </div> |
|
52 | </div> | |
53 | <% end %> |
|
53 | <% end %> | |
54 |
|
54 | |||
55 | <% other_formats_links do |f| %> |
|
55 | <% other_formats_links do |f| %> | |
56 |
<%= f.link_to 'PDF', :url => {:id => @page.title, :version => |
|
56 | <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> | |
57 |
<%= f.link_to 'HTML', :url => {:id => @page.title, :version => |
|
57 | <%= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %> | |
58 |
<%= f.link_to 'TXT', :url => {:id => @page.title, :version => |
|
58 | <%= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %> | |
59 | <% end if User.current.allowed_to?(:export_wiki_pages, @project) %> |
|
59 | <% end if User.current.allowed_to?(:export_wiki_pages, @project) %> | |
60 |
|
60 | |||
61 | <% content_for :header_tags do %> |
|
61 | <% content_for :header_tags do %> | |
62 | <%= stylesheet_link_tag 'scm' %> |
|
62 | <%= stylesheet_link_tag 'scm' %> | |
63 | <% end %> |
|
63 | <% end %> | |
64 |
|
64 | |||
65 | <% content_for :sidebar do %> |
|
65 | <% content_for :sidebar do %> | |
66 | <%= render :partial => 'sidebar' %> |
|
66 | <%= render :partial => 'sidebar' %> | |
67 | <% end %> |
|
67 | <% end %> | |
68 |
|
68 | |||
69 | <% html_title @page.pretty_title %> |
|
69 | <% html_title @page.pretty_title %> |
@@ -1,700 +1,707 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../test_helper', __FILE__) | |
19 | require 'wiki_controller' |
|
19 | require 'wiki_controller' | |
20 |
|
20 | |||
21 | # Re-raise errors caught by the controller. |
|
21 | # Re-raise errors caught by the controller. | |
22 | class WikiController; def rescue_action(e) raise e end; end |
|
22 | class WikiController; def rescue_action(e) raise e end; end | |
23 |
|
23 | |||
24 | class WikiControllerTest < ActionController::TestCase |
|
24 | class WikiControllerTest < ActionController::TestCase | |
25 | fixtures :projects, :users, :roles, :members, :member_roles, |
|
25 | fixtures :projects, :users, :roles, :members, :member_roles, | |
26 | :enabled_modules, :wikis, :wiki_pages, :wiki_contents, |
|
26 | :enabled_modules, :wikis, :wiki_pages, :wiki_contents, | |
27 | :wiki_content_versions, :attachments |
|
27 | :wiki_content_versions, :attachments | |
28 |
|
28 | |||
29 | def setup |
|
29 | def setup | |
30 | @controller = WikiController.new |
|
30 | @controller = WikiController.new | |
31 | @request = ActionController::TestRequest.new |
|
31 | @request = ActionController::TestRequest.new | |
32 | @response = ActionController::TestResponse.new |
|
32 | @response = ActionController::TestResponse.new | |
33 | User.current = nil |
|
33 | User.current = nil | |
34 | end |
|
34 | end | |
35 |
|
35 | |||
36 | def test_show_start_page |
|
36 | def test_show_start_page | |
37 | get :show, :project_id => 'ecookbook' |
|
37 | get :show, :project_id => 'ecookbook' | |
38 | assert_response :success |
|
38 | assert_response :success | |
39 | assert_template 'show' |
|
39 | assert_template 'show' | |
40 | assert_tag :tag => 'h1', :content => /CookBook documentation/ |
|
40 | assert_tag :tag => 'h1', :content => /CookBook documentation/ | |
41 |
|
41 | |||
42 | # child_pages macro |
|
42 | # child_pages macro | |
43 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, |
|
43 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, | |
44 | :child => { :tag => 'li', |
|
44 | :child => { :tag => 'li', | |
45 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, |
|
45 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, | |
46 | :content => 'Page with an inline image' } } |
|
46 | :content => 'Page with an inline image' } } | |
47 | end |
|
47 | end | |
|
48 | ||||
|
49 | def test_export_link | |||
|
50 | Role.anonymous.add_permission! :export_wiki_pages | |||
|
51 | get :show, :project_id => 'ecookbook' | |||
|
52 | assert_response :success | |||
|
53 | assert_tag 'a', :attributes => {:href => '/projects/ecookbook/wiki/CookBook_documentation.txt'} | |||
|
54 | end | |||
48 |
|
55 | |||
49 | def test_show_page_with_name |
|
56 | def test_show_page_with_name | |
50 | get :show, :project_id => 1, :id => 'Another_page' |
|
57 | get :show, :project_id => 1, :id => 'Another_page' | |
51 | assert_response :success |
|
58 | assert_response :success | |
52 | assert_template 'show' |
|
59 | assert_template 'show' | |
53 | assert_tag :tag => 'h1', :content => /Another page/ |
|
60 | assert_tag :tag => 'h1', :content => /Another page/ | |
54 | # Included page with an inline image |
|
61 | # Included page with an inline image | |
55 | assert_tag :tag => 'p', :content => /This is an inline image/ |
|
62 | assert_tag :tag => 'p', :content => /This is an inline image/ | |
56 | assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', |
|
63 | assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', | |
57 | :alt => 'This is a logo' } |
|
64 | :alt => 'This is a logo' } | |
58 | end |
|
65 | end | |
59 |
|
66 | |||
60 | def test_show_redirected_page |
|
67 | def test_show_redirected_page | |
61 | WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page') |
|
68 | WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page') | |
62 |
|
69 | |||
63 | get :show, :project_id => 'ecookbook', :id => 'Old_title' |
|
70 | get :show, :project_id => 'ecookbook', :id => 'Old_title' | |
64 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' |
|
71 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' | |
65 | end |
|
72 | end | |
66 |
|
73 | |||
67 | def test_show_with_sidebar |
|
74 | def test_show_with_sidebar | |
68 | page = Project.find(1).wiki.pages.new(:title => 'Sidebar') |
|
75 | page = Project.find(1).wiki.pages.new(:title => 'Sidebar') | |
69 | page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') |
|
76 | page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') | |
70 | page.save! |
|
77 | page.save! | |
71 |
|
78 | |||
72 | get :show, :project_id => 1, :id => 'Another_page' |
|
79 | get :show, :project_id => 1, :id => 'Another_page' | |
73 | assert_response :success |
|
80 | assert_response :success | |
74 | assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, |
|
81 | assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, | |
75 | :content => /Side bar content for test_show_with_sidebar/ |
|
82 | :content => /Side bar content for test_show_with_sidebar/ | |
76 | end |
|
83 | end | |
77 |
|
84 | |||
78 | def test_show_unexistent_page_without_edit_right |
|
85 | def test_show_unexistent_page_without_edit_right | |
79 | get :show, :project_id => 1, :id => 'Unexistent page' |
|
86 | get :show, :project_id => 1, :id => 'Unexistent page' | |
80 | assert_response 404 |
|
87 | assert_response 404 | |
81 | end |
|
88 | end | |
82 |
|
89 | |||
83 | def test_show_should_display_section_edit_links |
|
90 | def test_show_should_display_section_edit_links | |
84 | @request.session[:user_id] = 2 |
|
91 | @request.session[:user_id] = 2 | |
85 | get :show, :project_id => 1, :id => 'Page with sections' |
|
92 | get :show, :project_id => 1, :id => 'Page with sections' | |
86 | assert_no_tag 'a', :attributes => { |
|
93 | assert_no_tag 'a', :attributes => { | |
87 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=1' |
|
94 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=1' | |
88 | } |
|
95 | } | |
89 | assert_tag 'a', :attributes => { |
|
96 | assert_tag 'a', :attributes => { | |
90 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' |
|
97 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' | |
91 | } |
|
98 | } | |
92 | assert_tag 'a', :attributes => { |
|
99 | assert_tag 'a', :attributes => { | |
93 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=3' |
|
100 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=3' | |
94 | } |
|
101 | } | |
95 | end |
|
102 | end | |
96 |
|
103 | |||
97 | def test_show_current_version_should_display_section_edit_links |
|
104 | def test_show_current_version_should_display_section_edit_links | |
98 | @request.session[:user_id] = 2 |
|
105 | @request.session[:user_id] = 2 | |
99 | get :show, :project_id => 1, :id => 'Page with sections', :version => 3 |
|
106 | get :show, :project_id => 1, :id => 'Page with sections', :version => 3 | |
100 |
|
107 | |||
101 | assert_tag 'a', :attributes => { |
|
108 | assert_tag 'a', :attributes => { | |
102 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' |
|
109 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' | |
103 | } |
|
110 | } | |
104 | end |
|
111 | end | |
105 |
|
112 | |||
106 | def test_show_old_version_should_not_display_section_edit_links |
|
113 | def test_show_old_version_should_not_display_section_edit_links | |
107 | @request.session[:user_id] = 2 |
|
114 | @request.session[:user_id] = 2 | |
108 | get :show, :project_id => 1, :id => 'Page with sections', :version => 2 |
|
115 | get :show, :project_id => 1, :id => 'Page with sections', :version => 2 | |
109 |
|
116 | |||
110 | assert_no_tag 'a', :attributes => { |
|
117 | assert_no_tag 'a', :attributes => { | |
111 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' |
|
118 | :href => '/projects/ecookbook/wiki/Page_with_sections/edit?section=2' | |
112 | } |
|
119 | } | |
113 | end |
|
120 | end | |
114 |
|
121 | |||
115 | def test_show_unexistent_page_with_edit_right |
|
122 | def test_show_unexistent_page_with_edit_right | |
116 | @request.session[:user_id] = 2 |
|
123 | @request.session[:user_id] = 2 | |
117 | get :show, :project_id => 1, :id => 'Unexistent page' |
|
124 | get :show, :project_id => 1, :id => 'Unexistent page' | |
118 | assert_response :success |
|
125 | assert_response :success | |
119 | assert_template 'edit' |
|
126 | assert_template 'edit' | |
120 | end |
|
127 | end | |
121 |
|
128 | |||
122 | def test_create_page |
|
129 | def test_create_page | |
123 | @request.session[:user_id] = 2 |
|
130 | @request.session[:user_id] = 2 | |
124 | put :update, :project_id => 1, |
|
131 | put :update, :project_id => 1, | |
125 | :id => 'New page', |
|
132 | :id => 'New page', | |
126 | :content => {:comments => 'Created the page', |
|
133 | :content => {:comments => 'Created the page', | |
127 | :text => "h1. New page\n\nThis is a new page", |
|
134 | :text => "h1. New page\n\nThis is a new page", | |
128 | :version => 0} |
|
135 | :version => 0} | |
129 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page' |
|
136 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page' | |
130 | page = Project.find(1).wiki.find_page('New page') |
|
137 | page = Project.find(1).wiki.find_page('New page') | |
131 | assert !page.new_record? |
|
138 | assert !page.new_record? | |
132 | assert_not_nil page.content |
|
139 | assert_not_nil page.content | |
133 | assert_equal 'Created the page', page.content.comments |
|
140 | assert_equal 'Created the page', page.content.comments | |
134 | end |
|
141 | end | |
135 |
|
142 | |||
136 | def test_create_page_with_attachments |
|
143 | def test_create_page_with_attachments | |
137 | @request.session[:user_id] = 2 |
|
144 | @request.session[:user_id] = 2 | |
138 | assert_difference 'WikiPage.count' do |
|
145 | assert_difference 'WikiPage.count' do | |
139 | assert_difference 'Attachment.count' do |
|
146 | assert_difference 'Attachment.count' do | |
140 | put :update, :project_id => 1, |
|
147 | put :update, :project_id => 1, | |
141 | :id => 'New page', |
|
148 | :id => 'New page', | |
142 | :content => {:comments => 'Created the page', |
|
149 | :content => {:comments => 'Created the page', | |
143 | :text => "h1. New page\n\nThis is a new page", |
|
150 | :text => "h1. New page\n\nThis is a new page", | |
144 | :version => 0}, |
|
151 | :version => 0}, | |
145 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} |
|
152 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} | |
146 | end |
|
153 | end | |
147 | end |
|
154 | end | |
148 | page = Project.find(1).wiki.find_page('New page') |
|
155 | page = Project.find(1).wiki.find_page('New page') | |
149 | assert_equal 1, page.attachments.count |
|
156 | assert_equal 1, page.attachments.count | |
150 | assert_equal 'testfile.txt', page.attachments.first.filename |
|
157 | assert_equal 'testfile.txt', page.attachments.first.filename | |
151 | end |
|
158 | end | |
152 |
|
159 | |||
153 | def test_edit_page |
|
160 | def test_edit_page | |
154 | @request.session[:user_id] = 2 |
|
161 | @request.session[:user_id] = 2 | |
155 | get :edit, :project_id => 'ecookbook', :id => 'Another_page' |
|
162 | get :edit, :project_id => 'ecookbook', :id => 'Another_page' | |
156 |
|
163 | |||
157 | assert_response :success |
|
164 | assert_response :success | |
158 | assert_template 'edit' |
|
165 | assert_template 'edit' | |
159 |
|
166 | |||
160 | assert_tag 'textarea', |
|
167 | assert_tag 'textarea', | |
161 | :attributes => { :name => 'content[text]' }, |
|
168 | :attributes => { :name => 'content[text]' }, | |
162 | :content => WikiPage.find_by_title('Another_page').content.text |
|
169 | :content => WikiPage.find_by_title('Another_page').content.text | |
163 | end |
|
170 | end | |
164 |
|
171 | |||
165 | def test_edit_section |
|
172 | def test_edit_section | |
166 | @request.session[:user_id] = 2 |
|
173 | @request.session[:user_id] = 2 | |
167 | get :edit, :project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2 |
|
174 | get :edit, :project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2 | |
168 |
|
175 | |||
169 | assert_response :success |
|
176 | assert_response :success | |
170 | assert_template 'edit' |
|
177 | assert_template 'edit' | |
171 |
|
178 | |||
172 | page = WikiPage.find_by_title('Page_with_sections') |
|
179 | page = WikiPage.find_by_title('Page_with_sections') | |
173 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) |
|
180 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) | |
174 |
|
181 | |||
175 | assert_tag 'textarea', |
|
182 | assert_tag 'textarea', | |
176 | :attributes => { :name => 'content[text]' }, |
|
183 | :attributes => { :name => 'content[text]' }, | |
177 | :content => section |
|
184 | :content => section | |
178 | assert_tag 'input', |
|
185 | assert_tag 'input', | |
179 | :attributes => { :name => 'section', :type => 'hidden', :value => '2' } |
|
186 | :attributes => { :name => 'section', :type => 'hidden', :value => '2' } | |
180 | assert_tag 'input', |
|
187 | assert_tag 'input', | |
181 | :attributes => { :name => 'section_hash', :type => 'hidden', :value => hash } |
|
188 | :attributes => { :name => 'section_hash', :type => 'hidden', :value => hash } | |
182 | end |
|
189 | end | |
183 |
|
190 | |||
184 | def test_edit_invalid_section_should_respond_with_404 |
|
191 | def test_edit_invalid_section_should_respond_with_404 | |
185 | @request.session[:user_id] = 2 |
|
192 | @request.session[:user_id] = 2 | |
186 | get :edit, :project_id => 'ecookbook', :id => 'Page_with_sections', :section => 10 |
|
193 | get :edit, :project_id => 'ecookbook', :id => 'Page_with_sections', :section => 10 | |
187 |
|
194 | |||
188 | assert_response 404 |
|
195 | assert_response 404 | |
189 | end |
|
196 | end | |
190 |
|
197 | |||
191 | def test_update_page |
|
198 | def test_update_page | |
192 | @request.session[:user_id] = 2 |
|
199 | @request.session[:user_id] = 2 | |
193 | assert_no_difference 'WikiPage.count' do |
|
200 | assert_no_difference 'WikiPage.count' do | |
194 | assert_no_difference 'WikiContent.count' do |
|
201 | assert_no_difference 'WikiContent.count' do | |
195 | assert_difference 'WikiContent::Version.count' do |
|
202 | assert_difference 'WikiContent::Version.count' do | |
196 | put :update, :project_id => 1, |
|
203 | put :update, :project_id => 1, | |
197 | :id => 'Another_page', |
|
204 | :id => 'Another_page', | |
198 | :content => { |
|
205 | :content => { | |
199 | :comments => "my comments", |
|
206 | :comments => "my comments", | |
200 | :text => "edited", |
|
207 | :text => "edited", | |
201 | :version => 1 |
|
208 | :version => 1 | |
202 | } |
|
209 | } | |
203 | end |
|
210 | end | |
204 | end |
|
211 | end | |
205 | end |
|
212 | end | |
206 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' |
|
213 | assert_redirected_to '/projects/ecookbook/wiki/Another_page' | |
207 |
|
214 | |||
208 | page = Wiki.find(1).pages.find_by_title('Another_page') |
|
215 | page = Wiki.find(1).pages.find_by_title('Another_page') | |
209 | assert_equal "edited", page.content.text |
|
216 | assert_equal "edited", page.content.text | |
210 | assert_equal 2, page.content.version |
|
217 | assert_equal 2, page.content.version | |
211 | assert_equal "my comments", page.content.comments |
|
218 | assert_equal "my comments", page.content.comments | |
212 | end |
|
219 | end | |
213 |
|
220 | |||
214 | def test_update_page_with_failure |
|
221 | def test_update_page_with_failure | |
215 | @request.session[:user_id] = 2 |
|
222 | @request.session[:user_id] = 2 | |
216 | assert_no_difference 'WikiPage.count' do |
|
223 | assert_no_difference 'WikiPage.count' do | |
217 | assert_no_difference 'WikiContent.count' do |
|
224 | assert_no_difference 'WikiContent.count' do | |
218 | assert_no_difference 'WikiContent::Version.count' do |
|
225 | assert_no_difference 'WikiContent::Version.count' do | |
219 | put :update, :project_id => 1, |
|
226 | put :update, :project_id => 1, | |
220 | :id => 'Another_page', |
|
227 | :id => 'Another_page', | |
221 | :content => { |
|
228 | :content => { | |
222 | :comments => 'a' * 300, # failure here, comment is too long |
|
229 | :comments => 'a' * 300, # failure here, comment is too long | |
223 | :text => 'edited', |
|
230 | :text => 'edited', | |
224 | :version => 1 |
|
231 | :version => 1 | |
225 | } |
|
232 | } | |
226 | end |
|
233 | end | |
227 | end |
|
234 | end | |
228 | end |
|
235 | end | |
229 | assert_response :success |
|
236 | assert_response :success | |
230 | assert_template 'edit' |
|
237 | assert_template 'edit' | |
231 |
|
238 | |||
232 | assert_error_tag :descendant => {:content => /Comment is too long/} |
|
239 | assert_error_tag :descendant => {:content => /Comment is too long/} | |
233 | assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => 'edited' |
|
240 | assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => 'edited' | |
234 | assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'} |
|
241 | assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'} | |
235 | end |
|
242 | end | |
236 |
|
243 | |||
237 | def test_update_stale_page_should_not_raise_an_error |
|
244 | def test_update_stale_page_should_not_raise_an_error | |
238 | @request.session[:user_id] = 2 |
|
245 | @request.session[:user_id] = 2 | |
239 | c = Wiki.find(1).find_page('Another_page').content |
|
246 | c = Wiki.find(1).find_page('Another_page').content | |
240 | c.text = 'Previous text' |
|
247 | c.text = 'Previous text' | |
241 | c.save! |
|
248 | c.save! | |
242 | assert_equal 2, c.version |
|
249 | assert_equal 2, c.version | |
243 |
|
250 | |||
244 | assert_no_difference 'WikiPage.count' do |
|
251 | assert_no_difference 'WikiPage.count' do | |
245 | assert_no_difference 'WikiContent.count' do |
|
252 | assert_no_difference 'WikiContent.count' do | |
246 | assert_no_difference 'WikiContent::Version.count' do |
|
253 | assert_no_difference 'WikiContent::Version.count' do | |
247 | put :update, :project_id => 1, |
|
254 | put :update, :project_id => 1, | |
248 | :id => 'Another_page', |
|
255 | :id => 'Another_page', | |
249 | :content => { |
|
256 | :content => { | |
250 | :comments => 'My comments', |
|
257 | :comments => 'My comments', | |
251 | :text => 'Text should not be lost', |
|
258 | :text => 'Text should not be lost', | |
252 | :version => 1 |
|
259 | :version => 1 | |
253 | } |
|
260 | } | |
254 | end |
|
261 | end | |
255 | end |
|
262 | end | |
256 | end |
|
263 | end | |
257 | assert_response :success |
|
264 | assert_response :success | |
258 | assert_template 'edit' |
|
265 | assert_template 'edit' | |
259 | assert_tag :div, |
|
266 | assert_tag :div, | |
260 | :attributes => { :class => /error/ }, |
|
267 | :attributes => { :class => /error/ }, | |
261 | :content => /Data has been updated by another user/ |
|
268 | :content => /Data has been updated by another user/ | |
262 | assert_tag 'textarea', |
|
269 | assert_tag 'textarea', | |
263 | :attributes => { :name => 'content[text]' }, |
|
270 | :attributes => { :name => 'content[text]' }, | |
264 | :content => /Text should not be lost/ |
|
271 | :content => /Text should not be lost/ | |
265 | assert_tag 'input', |
|
272 | assert_tag 'input', | |
266 | :attributes => { :name => 'content[comments]', :value => 'My comments' } |
|
273 | :attributes => { :name => 'content[comments]', :value => 'My comments' } | |
267 |
|
274 | |||
268 | c.reload |
|
275 | c.reload | |
269 | assert_equal 'Previous text', c.text |
|
276 | assert_equal 'Previous text', c.text | |
270 | assert_equal 2, c.version |
|
277 | assert_equal 2, c.version | |
271 | end |
|
278 | end | |
272 |
|
279 | |||
273 | def test_update_section |
|
280 | def test_update_section | |
274 | @request.session[:user_id] = 2 |
|
281 | @request.session[:user_id] = 2 | |
275 | page = WikiPage.find_by_title('Page_with_sections') |
|
282 | page = WikiPage.find_by_title('Page_with_sections') | |
276 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) |
|
283 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) | |
277 | text = page.content.text |
|
284 | text = page.content.text | |
278 |
|
285 | |||
279 | assert_no_difference 'WikiPage.count' do |
|
286 | assert_no_difference 'WikiPage.count' do | |
280 | assert_no_difference 'WikiContent.count' do |
|
287 | assert_no_difference 'WikiContent.count' do | |
281 | assert_difference 'WikiContent::Version.count' do |
|
288 | assert_difference 'WikiContent::Version.count' do | |
282 | put :update, :project_id => 1, :id => 'Page_with_sections', |
|
289 | put :update, :project_id => 1, :id => 'Page_with_sections', | |
283 | :content => { |
|
290 | :content => { | |
284 | :text => "New section content", |
|
291 | :text => "New section content", | |
285 | :version => 3 |
|
292 | :version => 3 | |
286 | }, |
|
293 | }, | |
287 | :section => 2, |
|
294 | :section => 2, | |
288 | :section_hash => hash |
|
295 | :section_hash => hash | |
289 | end |
|
296 | end | |
290 | end |
|
297 | end | |
291 | end |
|
298 | end | |
292 | assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections' |
|
299 | assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections' | |
293 | assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.reload.content.text |
|
300 | assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.reload.content.text | |
294 | end |
|
301 | end | |
295 |
|
302 | |||
296 | def test_update_section_should_allow_stale_page_update |
|
303 | def test_update_section_should_allow_stale_page_update | |
297 | @request.session[:user_id] = 2 |
|
304 | @request.session[:user_id] = 2 | |
298 | page = WikiPage.find_by_title('Page_with_sections') |
|
305 | page = WikiPage.find_by_title('Page_with_sections') | |
299 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) |
|
306 | section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2) | |
300 | text = page.content.text |
|
307 | text = page.content.text | |
301 |
|
308 | |||
302 | assert_no_difference 'WikiPage.count' do |
|
309 | assert_no_difference 'WikiPage.count' do | |
303 | assert_no_difference 'WikiContent.count' do |
|
310 | assert_no_difference 'WikiContent.count' do | |
304 | assert_difference 'WikiContent::Version.count' do |
|
311 | assert_difference 'WikiContent::Version.count' do | |
305 | put :update, :project_id => 1, :id => 'Page_with_sections', |
|
312 | put :update, :project_id => 1, :id => 'Page_with_sections', | |
306 | :content => { |
|
313 | :content => { | |
307 | :text => "New section content", |
|
314 | :text => "New section content", | |
308 | :version => 2 # Current version is 3 |
|
315 | :version => 2 # Current version is 3 | |
309 | }, |
|
316 | }, | |
310 | :section => 2, |
|
317 | :section => 2, | |
311 | :section_hash => hash |
|
318 | :section_hash => hash | |
312 | end |
|
319 | end | |
313 | end |
|
320 | end | |
314 | end |
|
321 | end | |
315 | assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections' |
|
322 | assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections' | |
316 | page.reload |
|
323 | page.reload | |
317 | assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.content.text |
|
324 | assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.content.text | |
318 | assert_equal 4, page.content.version |
|
325 | assert_equal 4, page.content.version | |
319 | end |
|
326 | end | |
320 |
|
327 | |||
321 | def test_update_section_should_not_allow_stale_section_update |
|
328 | def test_update_section_should_not_allow_stale_section_update | |
322 | @request.session[:user_id] = 2 |
|
329 | @request.session[:user_id] = 2 | |
323 |
|
330 | |||
324 | assert_no_difference 'WikiPage.count' do |
|
331 | assert_no_difference 'WikiPage.count' do | |
325 | assert_no_difference 'WikiContent.count' do |
|
332 | assert_no_difference 'WikiContent.count' do | |
326 | assert_no_difference 'WikiContent::Version.count' do |
|
333 | assert_no_difference 'WikiContent::Version.count' do | |
327 | put :update, :project_id => 1, :id => 'Page_with_sections', |
|
334 | put :update, :project_id => 1, :id => 'Page_with_sections', | |
328 | :content => { |
|
335 | :content => { | |
329 | :comments => 'My comments', |
|
336 | :comments => 'My comments', | |
330 | :text => "Text should not be lost", |
|
337 | :text => "Text should not be lost", | |
331 | :version => 3 |
|
338 | :version => 3 | |
332 | }, |
|
339 | }, | |
333 | :section => 2, |
|
340 | :section => 2, | |
334 | :section_hash => Digest::MD5.hexdigest("wrong hash") |
|
341 | :section_hash => Digest::MD5.hexdigest("wrong hash") | |
335 | end |
|
342 | end | |
336 | end |
|
343 | end | |
337 | end |
|
344 | end | |
338 | assert_response :success |
|
345 | assert_response :success | |
339 | assert_template 'edit' |
|
346 | assert_template 'edit' | |
340 | assert_tag :div, |
|
347 | assert_tag :div, | |
341 | :attributes => { :class => /error/ }, |
|
348 | :attributes => { :class => /error/ }, | |
342 | :content => /Data has been updated by another user/ |
|
349 | :content => /Data has been updated by another user/ | |
343 | assert_tag 'textarea', |
|
350 | assert_tag 'textarea', | |
344 | :attributes => { :name => 'content[text]' }, |
|
351 | :attributes => { :name => 'content[text]' }, | |
345 | :content => /Text should not be lost/ |
|
352 | :content => /Text should not be lost/ | |
346 | assert_tag 'input', |
|
353 | assert_tag 'input', | |
347 | :attributes => { :name => 'content[comments]', :value => 'My comments' } |
|
354 | :attributes => { :name => 'content[comments]', :value => 'My comments' } | |
348 | end |
|
355 | end | |
349 |
|
356 | |||
350 | def test_preview |
|
357 | def test_preview | |
351 | @request.session[:user_id] = 2 |
|
358 | @request.session[:user_id] = 2 | |
352 | xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation', |
|
359 | xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation', | |
353 | :content => { :comments => '', |
|
360 | :content => { :comments => '', | |
354 | :text => 'this is a *previewed text*', |
|
361 | :text => 'this is a *previewed text*', | |
355 | :version => 3 } |
|
362 | :version => 3 } | |
356 | assert_response :success |
|
363 | assert_response :success | |
357 | assert_template 'common/_preview' |
|
364 | assert_template 'common/_preview' | |
358 | assert_tag :tag => 'strong', :content => /previewed text/ |
|
365 | assert_tag :tag => 'strong', :content => /previewed text/ | |
359 | end |
|
366 | end | |
360 |
|
367 | |||
361 | def test_preview_new_page |
|
368 | def test_preview_new_page | |
362 | @request.session[:user_id] = 2 |
|
369 | @request.session[:user_id] = 2 | |
363 | xhr :post, :preview, :project_id => 1, :id => 'New page', |
|
370 | xhr :post, :preview, :project_id => 1, :id => 'New page', | |
364 | :content => { :text => 'h1. New page', |
|
371 | :content => { :text => 'h1. New page', | |
365 | :comments => '', |
|
372 | :comments => '', | |
366 | :version => 0 } |
|
373 | :version => 0 } | |
367 | assert_response :success |
|
374 | assert_response :success | |
368 | assert_template 'common/_preview' |
|
375 | assert_template 'common/_preview' | |
369 | assert_tag :tag => 'h1', :content => /New page/ |
|
376 | assert_tag :tag => 'h1', :content => /New page/ | |
370 | end |
|
377 | end | |
371 |
|
378 | |||
372 | def test_history |
|
379 | def test_history | |
373 | get :history, :project_id => 1, :id => 'CookBook_documentation' |
|
380 | get :history, :project_id => 1, :id => 'CookBook_documentation' | |
374 | assert_response :success |
|
381 | assert_response :success | |
375 | assert_template 'history' |
|
382 | assert_template 'history' | |
376 | assert_not_nil assigns(:versions) |
|
383 | assert_not_nil assigns(:versions) | |
377 | assert_equal 3, assigns(:versions).size |
|
384 | assert_equal 3, assigns(:versions).size | |
378 | assert_select "input[type=submit][name=commit]" |
|
385 | assert_select "input[type=submit][name=commit]" | |
379 | end |
|
386 | end | |
380 |
|
387 | |||
381 | def test_history_with_one_version |
|
388 | def test_history_with_one_version | |
382 | get :history, :project_id => 1, :id => 'Another_page' |
|
389 | get :history, :project_id => 1, :id => 'Another_page' | |
383 | assert_response :success |
|
390 | assert_response :success | |
384 | assert_template 'history' |
|
391 | assert_template 'history' | |
385 | assert_not_nil assigns(:versions) |
|
392 | assert_not_nil assigns(:versions) | |
386 | assert_equal 1, assigns(:versions).size |
|
393 | assert_equal 1, assigns(:versions).size | |
387 | assert_select "input[type=submit][name=commit]", false |
|
394 | assert_select "input[type=submit][name=commit]", false | |
388 | end |
|
395 | end | |
389 |
|
396 | |||
390 | def test_diff |
|
397 | def test_diff | |
391 | get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1 |
|
398 | get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1 | |
392 | assert_response :success |
|
399 | assert_response :success | |
393 | assert_template 'diff' |
|
400 | assert_template 'diff' | |
394 | assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, |
|
401 | assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, | |
395 | :content => /updated/ |
|
402 | :content => /updated/ | |
396 | end |
|
403 | end | |
397 |
|
404 | |||
398 | def test_annotate |
|
405 | def test_annotate | |
399 | get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2 |
|
406 | get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2 | |
400 | assert_response :success |
|
407 | assert_response :success | |
401 | assert_template 'annotate' |
|
408 | assert_template 'annotate' | |
402 |
|
409 | |||
403 | # Line 1 |
|
410 | # Line 1 | |
404 | assert_tag :tag => 'tr', :child => { |
|
411 | assert_tag :tag => 'tr', :child => { | |
405 | :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1', :sibling => { |
|
412 | :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1', :sibling => { | |
406 | :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/, :sibling => { |
|
413 | :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/, :sibling => { | |
407 | :tag => 'td', :content => /h1\. CookBook documentation/ |
|
414 | :tag => 'td', :content => /h1\. CookBook documentation/ | |
408 | } |
|
415 | } | |
409 | } |
|
416 | } | |
410 | } |
|
417 | } | |
411 |
|
418 | |||
412 | # Line 5 |
|
419 | # Line 5 | |
413 | assert_tag :tag => 'tr', :child => { |
|
420 | assert_tag :tag => 'tr', :child => { | |
414 | :tag => 'th', :attributes => {:class => 'line-num'}, :content => '5', :sibling => { |
|
421 | :tag => 'th', :attributes => {:class => 'line-num'}, :content => '5', :sibling => { | |
415 | :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/, :sibling => { |
|
422 | :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/, :sibling => { | |
416 | :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ |
|
423 | :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ | |
417 | } |
|
424 | } | |
418 | } |
|
425 | } | |
419 | } |
|
426 | } | |
420 | end |
|
427 | end | |
421 |
|
428 | |||
422 | def test_get_rename |
|
429 | def test_get_rename | |
423 | @request.session[:user_id] = 2 |
|
430 | @request.session[:user_id] = 2 | |
424 | get :rename, :project_id => 1, :id => 'Another_page' |
|
431 | get :rename, :project_id => 1, :id => 'Another_page' | |
425 | assert_response :success |
|
432 | assert_response :success | |
426 | assert_template 'rename' |
|
433 | assert_template 'rename' | |
427 | assert_tag 'option', |
|
434 | assert_tag 'option', | |
428 | :attributes => {:value => ''}, |
|
435 | :attributes => {:value => ''}, | |
429 | :content => '', |
|
436 | :content => '', | |
430 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} |
|
437 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} | |
431 | assert_no_tag 'option', |
|
438 | assert_no_tag 'option', | |
432 | :attributes => {:selected => 'selected'}, |
|
439 | :attributes => {:selected => 'selected'}, | |
433 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} |
|
440 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} | |
434 | end |
|
441 | end | |
435 |
|
442 | |||
436 | def test_get_rename_child_page |
|
443 | def test_get_rename_child_page | |
437 | @request.session[:user_id] = 2 |
|
444 | @request.session[:user_id] = 2 | |
438 | get :rename, :project_id => 1, :id => 'Child_1' |
|
445 | get :rename, :project_id => 1, :id => 'Child_1' | |
439 | assert_response :success |
|
446 | assert_response :success | |
440 | assert_template 'rename' |
|
447 | assert_template 'rename' | |
441 | assert_tag 'option', |
|
448 | assert_tag 'option', | |
442 | :attributes => {:value => ''}, |
|
449 | :attributes => {:value => ''}, | |
443 | :content => '', |
|
450 | :content => '', | |
444 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} |
|
451 | :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} | |
445 | assert_tag 'option', |
|
452 | assert_tag 'option', | |
446 | :attributes => {:value => '2', :selected => 'selected'}, |
|
453 | :attributes => {:value => '2', :selected => 'selected'}, | |
447 | :content => /Another page/, |
|
454 | :content => /Another page/, | |
448 | :parent => { |
|
455 | :parent => { | |
449 | :tag => 'select', |
|
456 | :tag => 'select', | |
450 | :attributes => {:name => 'wiki_page[parent_id]'} |
|
457 | :attributes => {:name => 'wiki_page[parent_id]'} | |
451 | } |
|
458 | } | |
452 | end |
|
459 | end | |
453 |
|
460 | |||
454 | def test_rename_with_redirect |
|
461 | def test_rename_with_redirect | |
455 | @request.session[:user_id] = 2 |
|
462 | @request.session[:user_id] = 2 | |
456 | post :rename, :project_id => 1, :id => 'Another_page', |
|
463 | post :rename, :project_id => 1, :id => 'Another_page', | |
457 | :wiki_page => { :title => 'Another renamed page', |
|
464 | :wiki_page => { :title => 'Another renamed page', | |
458 | :redirect_existing_links => 1 } |
|
465 | :redirect_existing_links => 1 } | |
459 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page' |
|
466 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page' | |
460 | wiki = Project.find(1).wiki |
|
467 | wiki = Project.find(1).wiki | |
461 | # Check redirects |
|
468 | # Check redirects | |
462 | assert_not_nil wiki.find_page('Another page') |
|
469 | assert_not_nil wiki.find_page('Another page') | |
463 | assert_nil wiki.find_page('Another page', :with_redirect => false) |
|
470 | assert_nil wiki.find_page('Another page', :with_redirect => false) | |
464 | end |
|
471 | end | |
465 |
|
472 | |||
466 | def test_rename_without_redirect |
|
473 | def test_rename_without_redirect | |
467 | @request.session[:user_id] = 2 |
|
474 | @request.session[:user_id] = 2 | |
468 | post :rename, :project_id => 1, :id => 'Another_page', |
|
475 | post :rename, :project_id => 1, :id => 'Another_page', | |
469 | :wiki_page => { :title => 'Another renamed page', |
|
476 | :wiki_page => { :title => 'Another renamed page', | |
470 | :redirect_existing_links => "0" } |
|
477 | :redirect_existing_links => "0" } | |
471 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page' |
|
478 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page' | |
472 | wiki = Project.find(1).wiki |
|
479 | wiki = Project.find(1).wiki | |
473 | # Check that there's no redirects |
|
480 | # Check that there's no redirects | |
474 | assert_nil wiki.find_page('Another page') |
|
481 | assert_nil wiki.find_page('Another page') | |
475 | end |
|
482 | end | |
476 |
|
483 | |||
477 | def test_rename_with_parent_assignment |
|
484 | def test_rename_with_parent_assignment | |
478 | @request.session[:user_id] = 2 |
|
485 | @request.session[:user_id] = 2 | |
479 | post :rename, :project_id => 1, :id => 'Another_page', |
|
486 | post :rename, :project_id => 1, :id => 'Another_page', | |
480 | :wiki_page => { :title => 'Another page', :redirect_existing_links => "0", :parent_id => '4' } |
|
487 | :wiki_page => { :title => 'Another page', :redirect_existing_links => "0", :parent_id => '4' } | |
481 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' |
|
488 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' | |
482 | assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent |
|
489 | assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent | |
483 | end |
|
490 | end | |
484 |
|
491 | |||
485 | def test_rename_with_parent_unassignment |
|
492 | def test_rename_with_parent_unassignment | |
486 | @request.session[:user_id] = 2 |
|
493 | @request.session[:user_id] = 2 | |
487 | post :rename, :project_id => 1, :id => 'Child_1', |
|
494 | post :rename, :project_id => 1, :id => 'Child_1', | |
488 | :wiki_page => { :title => 'Child 1', :redirect_existing_links => "0", :parent_id => '' } |
|
495 | :wiki_page => { :title => 'Child 1', :redirect_existing_links => "0", :parent_id => '' } | |
489 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1' |
|
496 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1' | |
490 | assert_nil WikiPage.find_by_title('Child_1').parent |
|
497 | assert_nil WikiPage.find_by_title('Child_1').parent | |
491 | end |
|
498 | end | |
492 |
|
499 | |||
493 | def test_destroy_child |
|
500 | def test_destroy_child | |
494 | @request.session[:user_id] = 2 |
|
501 | @request.session[:user_id] = 2 | |
495 | delete :destroy, :project_id => 1, :id => 'Child_1' |
|
502 | delete :destroy, :project_id => 1, :id => 'Child_1' | |
496 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
503 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
497 | end |
|
504 | end | |
498 |
|
505 | |||
499 | def test_destroy_parent |
|
506 | def test_destroy_parent | |
500 | @request.session[:user_id] = 2 |
|
507 | @request.session[:user_id] = 2 | |
501 | assert_no_difference('WikiPage.count') do |
|
508 | assert_no_difference('WikiPage.count') do | |
502 | delete :destroy, :project_id => 1, :id => 'Another_page' |
|
509 | delete :destroy, :project_id => 1, :id => 'Another_page' | |
503 | end |
|
510 | end | |
504 | assert_response :success |
|
511 | assert_response :success | |
505 | assert_template 'destroy' |
|
512 | assert_template 'destroy' | |
506 | end |
|
513 | end | |
507 |
|
514 | |||
508 | def test_destroy_parent_with_nullify |
|
515 | def test_destroy_parent_with_nullify | |
509 | @request.session[:user_id] = 2 |
|
516 | @request.session[:user_id] = 2 | |
510 | assert_difference('WikiPage.count', -1) do |
|
517 | assert_difference('WikiPage.count', -1) do | |
511 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'nullify' |
|
518 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'nullify' | |
512 | end |
|
519 | end | |
513 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
520 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
514 | assert_nil WikiPage.find_by_id(2) |
|
521 | assert_nil WikiPage.find_by_id(2) | |
515 | end |
|
522 | end | |
516 |
|
523 | |||
517 | def test_destroy_parent_with_cascade |
|
524 | def test_destroy_parent_with_cascade | |
518 | @request.session[:user_id] = 2 |
|
525 | @request.session[:user_id] = 2 | |
519 | assert_difference('WikiPage.count', -3) do |
|
526 | assert_difference('WikiPage.count', -3) do | |
520 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'destroy' |
|
527 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'destroy' | |
521 | end |
|
528 | end | |
522 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
529 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
523 | assert_nil WikiPage.find_by_id(2) |
|
530 | assert_nil WikiPage.find_by_id(2) | |
524 | assert_nil WikiPage.find_by_id(5) |
|
531 | assert_nil WikiPage.find_by_id(5) | |
525 | end |
|
532 | end | |
526 |
|
533 | |||
527 | def test_destroy_parent_with_reassign |
|
534 | def test_destroy_parent_with_reassign | |
528 | @request.session[:user_id] = 2 |
|
535 | @request.session[:user_id] = 2 | |
529 | assert_difference('WikiPage.count', -1) do |
|
536 | assert_difference('WikiPage.count', -1) do | |
530 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1 |
|
537 | delete :destroy, :project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1 | |
531 | end |
|
538 | end | |
532 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
539 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' | |
533 | assert_nil WikiPage.find_by_id(2) |
|
540 | assert_nil WikiPage.find_by_id(2) | |
534 | assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent |
|
541 | assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent | |
535 | end |
|
542 | end | |
536 |
|
543 | |||
537 | def test_index |
|
544 | def test_index | |
538 | get :index, :project_id => 'ecookbook' |
|
545 | get :index, :project_id => 'ecookbook' | |
539 | assert_response :success |
|
546 | assert_response :success | |
540 | assert_template 'index' |
|
547 | assert_template 'index' | |
541 | pages = assigns(:pages) |
|
548 | pages = assigns(:pages) | |
542 | assert_not_nil pages |
|
549 | assert_not_nil pages | |
543 | assert_equal Project.find(1).wiki.pages.size, pages.size |
|
550 | assert_equal Project.find(1).wiki.pages.size, pages.size | |
544 | assert_equal pages.first.content.updated_on, pages.first.updated_on |
|
551 | assert_equal pages.first.content.updated_on, pages.first.updated_on | |
545 |
|
552 | |||
546 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, |
|
553 | assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, | |
547 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' }, |
|
554 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' }, | |
548 | :content => 'CookBook documentation' }, |
|
555 | :content => 'CookBook documentation' }, | |
549 | :child => { :tag => 'ul', |
|
556 | :child => { :tag => 'ul', | |
550 | :child => { :tag => 'li', |
|
557 | :child => { :tag => 'li', | |
551 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, |
|
558 | :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, | |
552 | :content => 'Page with an inline image' } } } }, |
|
559 | :content => 'Page with an inline image' } } } }, | |
553 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, |
|
560 | :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, | |
554 | :content => 'Another page' } } |
|
561 | :content => 'Another page' } } | |
555 | end |
|
562 | end | |
556 |
|
563 | |||
557 | def test_index_should_include_atom_link |
|
564 | def test_index_should_include_atom_link | |
558 | get :index, :project_id => 'ecookbook' |
|
565 | get :index, :project_id => 'ecookbook' | |
559 | assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} |
|
566 | assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} | |
560 | end |
|
567 | end | |
561 |
|
568 | |||
562 | context "GET :export" do |
|
569 | context "GET :export" do | |
563 | context "with an authorized user to export the wiki" do |
|
570 | context "with an authorized user to export the wiki" do | |
564 | setup do |
|
571 | setup do | |
565 | @request.session[:user_id] = 2 |
|
572 | @request.session[:user_id] = 2 | |
566 | get :export, :project_id => 'ecookbook' |
|
573 | get :export, :project_id => 'ecookbook' | |
567 | end |
|
574 | end | |
568 |
|
575 | |||
569 | should_respond_with :success |
|
576 | should_respond_with :success | |
570 | should_assign_to :pages |
|
577 | should_assign_to :pages | |
571 | should_respond_with_content_type "text/html" |
|
578 | should_respond_with_content_type "text/html" | |
572 | should "export all of the wiki pages to a single html file" do |
|
579 | should "export all of the wiki pages to a single html file" do | |
573 | assert_select "a[name=?]", "CookBook_documentation" |
|
580 | assert_select "a[name=?]", "CookBook_documentation" | |
574 | assert_select "a[name=?]", "Another_page" |
|
581 | assert_select "a[name=?]", "Another_page" | |
575 | assert_select "a[name=?]", "Page_with_an_inline_image" |
|
582 | assert_select "a[name=?]", "Page_with_an_inline_image" | |
576 | end |
|
583 | end | |
577 |
|
584 | |||
578 | end |
|
585 | end | |
579 |
|
586 | |||
580 | context "with an unauthorized user" do |
|
587 | context "with an unauthorized user" do | |
581 | setup do |
|
588 | setup do | |
582 | get :export, :project_id => 'ecookbook' |
|
589 | get :export, :project_id => 'ecookbook' | |
583 |
|
590 | |||
584 | should_respond_with :redirect |
|
591 | should_respond_with :redirect | |
585 | should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} } |
|
592 | should_redirect_to('wiki index') { {:action => 'show', :project_id => @project, :id => nil} } | |
586 | end |
|
593 | end | |
587 | end |
|
594 | end | |
588 | end |
|
595 | end | |
589 |
|
596 | |||
590 | context "GET :date_index" do |
|
597 | context "GET :date_index" do | |
591 | setup do |
|
598 | setup do | |
592 | get :date_index, :project_id => 'ecookbook' |
|
599 | get :date_index, :project_id => 'ecookbook' | |
593 | end |
|
600 | end | |
594 |
|
601 | |||
595 | should_respond_with :success |
|
602 | should_respond_with :success | |
596 | should_assign_to :pages |
|
603 | should_assign_to :pages | |
597 | should_assign_to :pages_by_date |
|
604 | should_assign_to :pages_by_date | |
598 | should_render_template 'wiki/date_index' |
|
605 | should_render_template 'wiki/date_index' | |
599 |
|
606 | |||
600 | should "include atom link" do |
|
607 | should "include atom link" do | |
601 | assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} |
|
608 | assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} | |
602 | end |
|
609 | end | |
603 | end |
|
610 | end | |
604 |
|
611 | |||
605 | def test_not_found |
|
612 | def test_not_found | |
606 | get :show, :project_id => 999 |
|
613 | get :show, :project_id => 999 | |
607 | assert_response 404 |
|
614 | assert_response 404 | |
608 | end |
|
615 | end | |
609 |
|
616 | |||
610 | def test_protect_page |
|
617 | def test_protect_page | |
611 | page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') |
|
618 | page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') | |
612 | assert !page.protected? |
|
619 | assert !page.protected? | |
613 | @request.session[:user_id] = 2 |
|
620 | @request.session[:user_id] = 2 | |
614 | post :protect, :project_id => 1, :id => page.title, :protected => '1' |
|
621 | post :protect, :project_id => 1, :id => page.title, :protected => '1' | |
615 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' |
|
622 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' | |
616 | assert page.reload.protected? |
|
623 | assert page.reload.protected? | |
617 | end |
|
624 | end | |
618 |
|
625 | |||
619 | def test_unprotect_page |
|
626 | def test_unprotect_page | |
620 | page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') |
|
627 | page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') | |
621 | assert page.protected? |
|
628 | assert page.protected? | |
622 | @request.session[:user_id] = 2 |
|
629 | @request.session[:user_id] = 2 | |
623 | post :protect, :project_id => 1, :id => page.title, :protected => '0' |
|
630 | post :protect, :project_id => 1, :id => page.title, :protected => '0' | |
624 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation' |
|
631 | assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation' | |
625 | assert !page.reload.protected? |
|
632 | assert !page.reload.protected? | |
626 | end |
|
633 | end | |
627 |
|
634 | |||
628 | def test_show_page_with_edit_link |
|
635 | def test_show_page_with_edit_link | |
629 | @request.session[:user_id] = 2 |
|
636 | @request.session[:user_id] = 2 | |
630 | get :show, :project_id => 1 |
|
637 | get :show, :project_id => 1 | |
631 | assert_response :success |
|
638 | assert_response :success | |
632 | assert_template 'show' |
|
639 | assert_template 'show' | |
633 | assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } |
|
640 | assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } | |
634 | end |
|
641 | end | |
635 |
|
642 | |||
636 | def test_show_page_without_edit_link |
|
643 | def test_show_page_without_edit_link | |
637 | @request.session[:user_id] = 4 |
|
644 | @request.session[:user_id] = 4 | |
638 | get :show, :project_id => 1 |
|
645 | get :show, :project_id => 1 | |
639 | assert_response :success |
|
646 | assert_response :success | |
640 | assert_template 'show' |
|
647 | assert_template 'show' | |
641 | assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } |
|
648 | assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } | |
642 | end |
|
649 | end | |
643 |
|
650 | |||
644 | def test_show_pdf |
|
651 | def test_show_pdf | |
645 | @request.session[:user_id] = 2 |
|
652 | @request.session[:user_id] = 2 | |
646 | get :show, :project_id => 1, :format => 'pdf' |
|
653 | get :show, :project_id => 1, :format => 'pdf' | |
647 | assert_response :success |
|
654 | assert_response :success | |
648 | assert_not_nil assigns(:page) |
|
655 | assert_not_nil assigns(:page) | |
649 | assert_equal 'application/pdf', @response.content_type |
|
656 | assert_equal 'application/pdf', @response.content_type | |
650 | assert_equal 'attachment; filename="CookBook_documentation.pdf"', |
|
657 | assert_equal 'attachment; filename="CookBook_documentation.pdf"', | |
651 | @response.headers['Content-Disposition'] |
|
658 | @response.headers['Content-Disposition'] | |
652 | end |
|
659 | end | |
653 |
|
660 | |||
654 | def test_show_html |
|
661 | def test_show_html | |
655 | @request.session[:user_id] = 2 |
|
662 | @request.session[:user_id] = 2 | |
656 | get :show, :project_id => 1, :format => 'html' |
|
663 | get :show, :project_id => 1, :format => 'html' | |
657 | assert_response :success |
|
664 | assert_response :success | |
658 | assert_not_nil assigns(:page) |
|
665 | assert_not_nil assigns(:page) | |
659 | assert_equal 'text/html', @response.content_type |
|
666 | assert_equal 'text/html', @response.content_type | |
660 | assert_equal 'attachment; filename="CookBook_documentation.html"', |
|
667 | assert_equal 'attachment; filename="CookBook_documentation.html"', | |
661 | @response.headers['Content-Disposition'] |
|
668 | @response.headers['Content-Disposition'] | |
662 | end |
|
669 | end | |
663 |
|
670 | |||
664 | def test_show_txt |
|
671 | def test_show_txt | |
665 | @request.session[:user_id] = 2 |
|
672 | @request.session[:user_id] = 2 | |
666 | get :show, :project_id => 1, :format => 'txt' |
|
673 | get :show, :project_id => 1, :format => 'txt' | |
667 | assert_response :success |
|
674 | assert_response :success | |
668 | assert_not_nil assigns(:page) |
|
675 | assert_not_nil assigns(:page) | |
669 | assert_equal 'text/plain', @response.content_type |
|
676 | assert_equal 'text/plain', @response.content_type | |
670 | assert_equal 'attachment; filename="CookBook_documentation.txt"', |
|
677 | assert_equal 'attachment; filename="CookBook_documentation.txt"', | |
671 | @response.headers['Content-Disposition'] |
|
678 | @response.headers['Content-Disposition'] | |
672 | end |
|
679 | end | |
673 |
|
680 | |||
674 | def test_edit_unprotected_page |
|
681 | def test_edit_unprotected_page | |
675 | # Non members can edit unprotected wiki pages |
|
682 | # Non members can edit unprotected wiki pages | |
676 | @request.session[:user_id] = 4 |
|
683 | @request.session[:user_id] = 4 | |
677 | get :edit, :project_id => 1, :id => 'Another_page' |
|
684 | get :edit, :project_id => 1, :id => 'Another_page' | |
678 | assert_response :success |
|
685 | assert_response :success | |
679 | assert_template 'edit' |
|
686 | assert_template 'edit' | |
680 | end |
|
687 | end | |
681 |
|
688 | |||
682 | def test_edit_protected_page_by_nonmember |
|
689 | def test_edit_protected_page_by_nonmember | |
683 | # Non members can't edit protected wiki pages |
|
690 | # Non members can't edit protected wiki pages | |
684 | @request.session[:user_id] = 4 |
|
691 | @request.session[:user_id] = 4 | |
685 | get :edit, :project_id => 1, :id => 'CookBook_documentation' |
|
692 | get :edit, :project_id => 1, :id => 'CookBook_documentation' | |
686 | assert_response 403 |
|
693 | assert_response 403 | |
687 | end |
|
694 | end | |
688 |
|
695 | |||
689 | def test_edit_protected_page_by_member |
|
696 | def test_edit_protected_page_by_member | |
690 | @request.session[:user_id] = 2 |
|
697 | @request.session[:user_id] = 2 | |
691 | get :edit, :project_id => 1, :id => 'CookBook_documentation' |
|
698 | get :edit, :project_id => 1, :id => 'CookBook_documentation' | |
692 | assert_response :success |
|
699 | assert_response :success | |
693 | assert_template 'edit' |
|
700 | assert_template 'edit' | |
694 | end |
|
701 | end | |
695 |
|
702 | |||
696 | def test_history_of_non_existing_page_should_return_404 |
|
703 | def test_history_of_non_existing_page_should_return_404 | |
697 | get :history, :project_id => 1, :id => 'Unknown_page' |
|
704 | get :history, :project_id => 1, :id => 'Unknown_page' | |
698 | assert_response 404 |
|
705 | assert_response 404 | |
699 | end |
|
706 | end | |
700 | end |
|
707 | end |
General Comments 0
You need to be logged in to leave comments.
Login now