##// END OF EJS Templates
acts_as_versioned use old style (Rails 2.x) of method call for #all (#24348)....
acts_as_versioned use old style (Rails 2.x) of method call for #all (#24348). git-svn-id: http://svn.redmine.org/redmine/trunk@15950 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15367:650a64cb0020
r15568:2b70d977052a
Show More
wiki_controller_test.rb
1103 lines | 37.5 KiB | text/x-ruby | RubyLexer
/ test / functional / wiki_controller_test.rb
Jean-Philippe Lang
Moved wiki page updated_on eager load to a scope and fixed timestamp titles on wiki page index (#7818)....
r4978 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682 #
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 # 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.
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682 #
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 # 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.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Added some functional tests (wiki)....
r986
Jean-Philippe Lang
Adds our own class for controller tests....
r15279 class WikiControllerTest < Redmine::ControllerTest
Jean-Philippe Lang
Add support for multiple email addresses per user (#4244)....
r13504 fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
Toshi MARUYAMA
code layout clean up of test/functional/wiki_controller_test.rb...
r7618 :enabled_modules, :wikis, :wiki_pages, :wiki_contents,
Toshi MARUYAMA
add missing fixtures to test/functional/wiki_controller_test.rb...
r13208 :wiki_content_versions, :attachments,
Jean-Philippe Lang
Missing fixtures....
r14329 :issues, :issue_statuses, :trackers
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def setup
User.current = nil
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_show_start_page
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook'}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Adds child_pages macro for wiki pages (#528)....
r1690
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'h1', :text => /CookBook documentation/
Jean-Philippe Lang
Adds child_pages macro for wiki pages (#528)....
r1690 # child_pages macro
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'ul.pages-hierarchy>li>a[href=?]', '/projects/ecookbook/wiki/Page_with_an_inline_image',
:text => 'Page with an inline image'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Jean-Philippe Lang
Fixed: Wiki export link doesn't work for users without :view_wiki_edits permission (#9682)....
r7851
def test_export_link
Role.anonymous.add_permission! :export_wiki_pages
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook'}
Jean-Philippe Lang
Fixed: Wiki export link doesn't work for users without :view_wiki_edits permission (#9682)....
r7851 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation.txt'
Jean-Philippe Lang
Fixed: Wiki export link doesn't work for users without :view_wiki_edits permission (#9682)....
r7851 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_show_page_with_name
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Another_page'}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h1', :text => /Another page/
Jean-Philippe Lang
Fixed: inline image not displayed when including a wiki page (closes #1001)....
r1312 # Included page with an inline image
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'p', :text => /This is an inline image/
assert_select 'img[src=?][alt=?]', '/attachments/download/3/logo.gif', 'This is a logo'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476 def test_show_old_version
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 with_settings :default_language => 'en' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'}
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 end
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476 assert_response :success
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/1', :text => /Previous/
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/diff', :text => /diff/
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/3', :text => /Next/
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/
end
Jean-Philippe Lang
Fixed that viewing the history of a wiki page with attachments raises an error (#12801)....
r10927 def test_show_old_version_with_attachments
page = WikiPage.find(4)
assert page.attachments.any?
content = page.content
content.text = "update"
content.save!
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook', :id => page.title, :version => '1'}
Jean-Philippe Lang
Fixed that viewing the history of a wiki page with attachments raises an error (#12801)....
r10927 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_an_inline_image', :text => /Current version/
Jean-Philippe Lang
Fixed that viewing the history of a wiki page with attachments raises an error (#12801)....
r10927 end
Jean-Philippe Lang
REST API for retrieving wiki pages (#7082)....
r10504 def test_show_old_version_without_permission_should_be_denied
Role.anonymous.remove_permission! :view_wiki_edits
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '2'}
Jean-Philippe Lang
REST API for retrieving wiki pages (#7082)....
r10504 assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fprojects%2Fecookbook%2Fwiki%2FCookBook_documentation%2F2'
end
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476 def test_show_first_version
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 with_settings :default_language => 'en' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => '1'}
Jean-Philippe Lang
Merged rails-4.1 branch (#14534)....
r13100 end
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476 assert_response :success
assert_select 'a', :text => /Previous/, :count => 0
assert_select 'a', :text => /diff/, :count => 0
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => /Next/
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => /Current version/
end
Jean-Philippe Lang
Do a redirect when accessing a renamed wiki page....
r5303 def test_show_redirected_page
WikiRedirect.create!(:wiki_id => 1, :title => 'Old_title', :redirects_to => 'Another_page')
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 'ecookbook', :id => 'Old_title'}
Jean-Philippe Lang
Do a redirect when accessing a renamed wiki page....
r5303 assert_redirected_to '/projects/ecookbook/wiki/Another_page'
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Makes the wiki sidebar editable (#5208)....
r3518 def test_show_with_sidebar
page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
page.save!
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Another_page'}
Jean-Philippe Lang
Makes the wiki sidebar editable (#5208)....
r3518 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'div#sidebar', :text => /Side bar content for test_show_with_sidebar/
Jean-Philippe Lang
Makes the wiki sidebar editable (#5208)....
r3518 end
Jean-Philippe Lang
Fixes section edit links when text includes pre/code tag (#2222)....
r7715
def test_show_should_display_section_edit_links
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Page with sections'}
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242
assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_sections/edit?section=1', 0
assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_sections/edit?section=2'
assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_sections/edit?section=3'
Jean-Philippe Lang
Fixes section edit links when text includes pre/code tag (#2222)....
r7715 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed: Section-edit buttons not available when a the version parameter is provided even if it's the current version (#9674)....
r7850 def test_show_current_version_should_display_section_edit_links
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 3}
Jean-Philippe Lang
Fixed: Section-edit buttons not available when a the version parameter is provided even if it's the current version (#9674)....
r7850
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_sections/edit?section=2'
Jean-Philippe Lang
Fixed: Section-edit buttons not available when a the version parameter is provided even if it's the current version (#9674)....
r7850 end
def test_show_old_version_should_not_display_section_edit_links
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 2}
Jean-Philippe Lang
Fixed: Section-edit buttons not available when a the version parameter is provided even if it's the current version (#9674)....
r7850
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/ecookbook/wiki/Page_with_sections/edit?section=2', 0
Jean-Philippe Lang
Fixed: Section-edit buttons not available when a the version parameter is provided even if it's the current version (#9674)....
r7850 end
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 def test_show_unexistent_page_without_edit_right
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Unexistent page'}
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 assert_response 404
end
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_show_unexistent_page_with_edit_right
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Unexistent page'}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'textarea[name=?]', 'content[text]'
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 end
Jean-Philippe Lang
Fixed that requesting a specific version of a non-existent wiki page raises an error (#16255)....
r12696 def test_show_specific_version_of_an_unexistent_page_without_edit_right
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Unexistent page', :version => 1}
Jean-Philippe Lang
Fixed that requesting a specific version of a non-existent wiki page raises an error (#16255)....
r12696 assert_response 404
end
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 def test_show_unexistent_page_with_parent_should_preselect_parent
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 @request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Unexistent page', :parent => 'Another_page'}
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'select[name=?] option[value="2"][selected=selected]', 'wiki_page[parent_id]'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adds a test for when accessing wiki history without permission....
r7944 def test_show_should_not_show_history_without_permission
Role.anonymous.remove_permission! :view_wiki_edits
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'Page with sections', :version => 2}
Jean-Philippe Lang
Adds a test for when accessing wiki history without permission....
r7944
assert_response 302
end
Jean-Philippe Lang
Fixed that viewing/editing a wiki page without WikiContent raises an error (#14986)....
r11990 def test_show_page_without_content_should_display_the_edit_form
@request.session[:user_id] = 2
WikiPage.create!(:title => 'NoContent', :wiki => Project.find(1).wiki)
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :id => 'NoContent'}
Jean-Philippe Lang
Fixed that viewing/editing a wiki page without WikiContent raises an error (#14986)....
r11990 assert_response :success
assert_select 'textarea[name=?]', 'content[text]'
end
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 def test_get_new
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :new, :params => {:project_id => 'ecookbook'}
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'input[name=?]', 'title'
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 end
def test_get_new_xhr
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 xhr :get, :new, :params => {:project_id => 'ecookbook'}
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_include 'Unallowed characters', response.body
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 end
def test_post_new_with_valid_title_should_redirect_to_edit
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :new, :params => {:project_id => 'ecookbook', :title => 'New Page'}
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 assert_redirected_to '/projects/ecookbook/wiki/New_Page'
end
def test_post_new_xhr_with_valid_title_should_redirect_to_edit
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 xhr :post, :new, :params => {:project_id => 'ecookbook', :title => 'New Page'}
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 assert_response :success
assert_equal 'window.location = "/projects/ecookbook/wiki/New_Page"', response.body
end
def test_post_new_with_invalid_title_should_display_errors
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 assert_response :success
assert_select_error 'Title has already been taken'
end
Jean-Philippe Lang
Creating a wiki page named "Sidebar" without proper permission raises an exception (#23700)....
r15367 def test_post_new_with_protected_title_should_display_errors
Role.find(1).remove_permission!(:protect_wiki_pages)
@request.session[:user_id] = 2
post :new, :params => {:project_id => 'ecookbook', :title => 'Sidebar'}
assert_response :success
assert_select_error /Title/
end
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 def test_post_new_xhr_with_invalid_title_should_display_errors
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 xhr :post, :new, :params => {:project_id => 'ecookbook', :title => 'Another page'}
Jean-Philippe Lang
Adds "New wiki page" link to create a new wiki page (#5536)....
r14964 assert_response :success
assert_include 'Title has already been taken', response.body
end
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_create_page
@request.session[:user_id] = 2
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 assert_difference 'WikiPage.count' do
assert_difference 'WikiContent.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'New page',
:content => {
:comments => 'Created the page',
:text => "h1. New page\n\nThis is a new page",
:version => 0
}
}
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 end
end
Eric Davis
Refactor: use :id instead of :page when linking to Wiki Pages...
r4182 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'New_page'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 page = Project.find(1).wiki.find_page('New page')
assert !page.new_record?
assert_not_nil page.content
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 assert_nil page.parent
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_equal 'Created the page', page.content.comments
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adds attachments upload on wiki edit form (#1223)....
r3386 def test_create_page_with_attachments
@request.session[:user_id] = 2
assert_difference 'WikiPage.count' do
assert_difference 'Attachment.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'New page',
:content => {
:comments => 'Created the page',
:text => "h1. New page\n\nThis is a new page",
:version => 0
},
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
}
Jean-Philippe Lang
Adds attachments upload on wiki edit form (#1223)....
r3386 end
end
page = Project.find(1).wiki.find_page('New page')
assert_equal 1, page.attachments.count
assert_equal 'testfile.txt', page.attachments.first.filename
end
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 def test_create_page_with_parent
@request.session[:user_id] = 2
assert_difference 'WikiPage.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'New page',
:content => {
:text => "h1. New page\n\nThis is a new page",
:version => 0
},
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 :wiki_page => {:parent_id => 2}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Option to set parent automatically for new wiki pages (#3108)....
r8135 end
page = Project.find(1).wiki.find_page('New page')
assert_equal WikiPage.find(2), page.parent
end
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 def test_edit_page
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :edit, :params => {:project_id => 'ecookbook', :id => 'Another_page'}
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709
assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'textarea[name=?]', 'content[text]',
:text => WikiPage.find_by_title('Another_page').content.text
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 end
def test_edit_section
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2}
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709
assert_response :success
page = WikiPage.find_by_title('Page_with_sections')
section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2)
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'textarea[name=?]', 'content[text]', :text => section
assert_select 'input[name=section][type=hidden][value="2"]'
assert_select 'input[name=section_hash][type=hidden][value=?]', hash
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 end
def test_edit_invalid_section_should_respond_with_404
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 10}
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709
assert_response 404
end
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 def test_update_page
@request.session[:user_id] = 2
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 :id => 'Another_page',
:content => {
:comments => "my comments",
:text => "edited",
:version => 1
}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 end
end
end
assert_redirected_to '/projects/ecookbook/wiki/Another_page'
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 page = Wiki.find(1).pages.find_by_title('Another_page')
assert_equal "edited", page.content.text
assert_equal 2, page.content.version
assert_equal "my comments", page.content.comments
end
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 def test_update_page_with_parent
@request.session[:user_id] = 2
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 :id => 'Another_page',
:content => {
:comments => "my comments",
:text => "edited",
:version => 1
},
:wiki_page => {:parent_id => '1'}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 end
end
end
assert_redirected_to '/projects/ecookbook/wiki/Another_page'
page = Wiki.find(1).pages.find_by_title('Another_page')
assert_equal "edited", page.content.text
assert_equal 2, page.content.version
assert_equal "my comments", page.content.comments
assert_equal WikiPage.find(1), page.parent
end
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 def test_update_page_with_failure
@request.session[:user_id] = 2
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 :id => 'Another_page',
:content => {
Jean-Philippe Lang
Raises wiki edits comments limit to 1024 (#19886)....
r14240 :comments => 'a' * 1300, # failure here, comment is too long
Jean-Philippe Lang
Adds a few tests....
r13313 :text => 'edited'
},
:wiki_page => {
:parent_id => ""
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 }
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 end
end
Jean-Philippe Lang
Adds a few tests....
r13313 end
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 assert_response :success
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select_error /Comment is too long/
assert_select 'textarea#content_text', :text => "edited"
assert_select 'input#content_version[value="1"]'
Jean-Philippe Lang
Fixed: Missing template wiki/update.erb error introduced in r4272 (#6987)....
r4315 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 def test_update_page_with_parent_change_only_should_not_create_content_version
@request.session[:user_id] = 2
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 :id => 'Another_page',
:content => {
:comments => '',
:text => Wiki.find(1).find_page('Another_page').content.text,
:version => 1
},
:wiki_page => {:parent_id => '1'}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 end
end
end
page = Wiki.find(1).pages.find_by_title('Another_page')
assert_equal 1, page.content.version
assert_equal WikiPage.find(1), page.parent
end
Jean-Philippe Lang
Additional tests for WikiController....
r8142 def test_update_page_with_attachments_only_should_not_create_content_version
@request.session[:user_id] = 2
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiContent::Version.count' do
assert_difference 'Attachment.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
Jean-Philippe Lang
Additional tests for WikiController....
r8142 :id => 'Another_page',
:content => {
:comments => '',
:text => Wiki.find(1).find_page('Another_page').content.text,
:version => 1
},
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Additional tests for WikiController....
r8142 end
end
end
end
Jean-Philippe Lang
Ability to edit a wiki page's parent on the edit page (#6449)....
r8667 page = Wiki.find(1).pages.find_by_title('Another_page')
assert_equal 1, page.content.version
Jean-Philippe Lang
Additional tests for WikiController....
r8142 end
Jean-Philippe Lang
Fixed: Simultaneous wiki updates cause internal error (#7939)....
r5065 def test_update_stale_page_should_not_raise_an_error
@request.session[:user_id] = 2
c = Wiki.find(1).find_page('Another_page').content
c.text = 'Previous text'
c.save!
assert_equal 2, c.version
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed: Simultaneous wiki updates cause internal error (#7939)....
r5065 assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
Jean-Philippe Lang
Fixed: Simultaneous wiki updates cause internal error (#7939)....
r5065 :id => 'Another_page',
:content => {
:comments => 'My comments',
:text => 'Text should not be lost',
:version => 1
}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Fixed: Simultaneous wiki updates cause internal error (#7939)....
r5065 end
end
end
assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'div.error', :text => /Data has been updated by another user/
assert_select 'textarea[name=?]', 'content[text]', :text => /Text should not be lost/
assert_select 'input[name=?][value=?]', 'content[comments]', 'My comments'
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed: Simultaneous wiki updates cause internal error (#7939)....
r5065 c.reload
assert_equal 'Previous text', c.text
assert_equal 2, c.version
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed that viewing/editing a wiki page without WikiContent raises an error (#14986)....
r11990 def test_update_page_without_content_should_create_content
@request.session[:user_id] = 2
page = WikiPage.create!(:title => 'NoContent', :wiki => Project.find(1).wiki)
assert_no_difference 'WikiPage.count' do
assert_difference 'WikiContent.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'NoContent',
:content => {:text => 'Some content'}
}
Jean-Philippe Lang
Fixed that viewing/editing a wiki page without WikiContent raises an error (#14986)....
r11990 assert_response 302
end
end
assert_equal 'Some content', page.reload.content.text
end
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 def test_update_section
@request.session[:user_id] = 2
page = WikiPage.find_by_title('Page_with_sections')
section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2)
text = page.content.text
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'Page_with_sections',
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 :content => {
:text => "New section content",
:version => 3
},
:section => 2,
:section_hash => hash
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 end
end
end
Jean-Philippe Lang
Return to section anchor after wiki section edit (#15182)....
r12009 assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections#section-2'
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.reload.content.text
end
def test_update_section_should_allow_stale_page_update
@request.session[:user_id] = 2
page = WikiPage.find_by_title('Page_with_sections')
section, hash = Redmine::WikiFormatting::Textile::Formatter.new(page.content.text).get_section(2)
text = page.content.text
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'Page_with_sections',
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 :content => {
:text => "New section content",
:version => 2 # Current version is 3
},
:section => 2,
:section_hash => hash
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 end
end
end
Jean-Philippe Lang
Return to section anchor after wiki section edit (#15182)....
r12009 assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections#section-2'
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 page.reload
assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.content.text
assert_equal 4, page.content.version
end
def test_update_section_should_not_allow_stale_section_update
@request.session[:user_id] = 2
assert_no_difference 'WikiPage.count' do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiContent::Version.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 put :update, :params => {
:project_id => 1,
:id => 'Page_with_sections',
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 :content => {
:comments => 'My comments',
:text => "Text should not be lost",
:version => 3
},
:section => 2,
:section_hash => Digest::MD5.hexdigest("wrong hash")
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 end
end
end
assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'div.error', :text => /Data has been updated by another user/
assert_select 'textarea[name=?]', 'content[text]', :text => /Text should not be lost/
assert_select 'input[name=?][value=?]', 'content[comments]', 'My comments'
Jean-Philippe Lang
Wiki: allows single section edit (#2222)....
r7709 end
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_preview
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 xhr :post, :preview, :params => {
:project_id => 1,
:id => 'CookBook_documentation',
:content => {
:comments => '',
:text => 'this is a *previewed text*',
:version => 3
}
}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'strong', :text => /previewed text/
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed: error when previewing a new wiki page (#1292) introduced in r1415....
r1431 def test_preview_new_page
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 xhr :post, :preview, :params => {
:project_id => 1,
:id => 'New page',
:content => {
:text => 'h1. New page',
:comments => '',
:version => 0
}
}
Jean-Philippe Lang
Fixed: error when previewing a new wiki page (#1292) introduced in r1415....
r1431 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h1', :text => /New page/
Jean-Philippe Lang
Fixed: error when previewing a new wiki page (#1292) introduced in r1415....
r1431 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_history
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493 @request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :history, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation'}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
assert_select 'table.wiki-page-versions tbody' do
assert_select 'tr', 3
end
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476
Eric Davis
Hiding the View Differences button when a wiki page's history only has one version....
r1748 assert_select "input[type=submit][name=commit]"
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476 assert_select 'td' do
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => '2'
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493 assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2/annotate', :text => 'Annotate'
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation/2', :text => 'Delete'
Jean-Philippe Lang
Wiki page versions routes cleanup....
r10476 end
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Eric Davis
Hiding the View Differences button when a wiki page's history only has one version....
r1748
def test_history_with_one_version
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493 @request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :history, :params => {:project_id => 'ecookbook', :id => 'Another_page'}
Eric Davis
Hiding the View Differences button when a wiki page's history only has one version....
r1748 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
assert_select 'table.wiki-page-versions tbody' do
assert_select 'tr', 1
end
Eric Davis
Hiding the View Differences button when a wiki page's history only has one version....
r1748 assert_select "input[type=submit][name=commit]", false
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493 assert_select 'td' do
assert_select 'a[href=?]', '/projects/ecookbook/wiki/Another_page/1', :text => '1'
assert_select 'a[href=?]', '/projects/ecookbook/wiki/Another_page/1/annotate', :text => 'Annotate'
assert_select 'a[href=?]', '/projects/ecookbook/wiki/Another_page/1', :text => 'Delete', :count => 0
end
Eric Davis
Hiding the View Differences button when a wiki page's history only has one version....
r1748 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_diff
Jean-Philippe Lang
Fixed that wiki diff may produce html (#11209)....
r9712 content = WikiPage.find(1).content
assert_difference 'WikiContent::Version.count', 2 do
content.text = "Line removed\nThis is a sample text for testing diffs"
content.save!
content.text = "This is a sample text for testing diffs\nLine added"
content.save!
end
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :diff, :params => {
:project_id => 1, :id => 'CookBook_documentation',
:version => content.version,
:version_from => (content.version - 1)
}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Fixed that wiki diff may produce html (#11209)....
r9712 assert_select 'span.diff_out', :text => 'Line removed'
assert_select 'span.diff_in', :text => 'Line added'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Respond with 404 instead of 500 when requesting a wiki diff with invalid versions (#12434)....
r10650 def test_diff_with_invalid_version_should_respond_with_404
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :diff, :params => {
:project_id => 1, :id => 'CookBook_documentation',
:version => '99'
}
Jean-Philippe Lang
Respond with 404 instead of 500 when requesting a wiki diff with invalid versions (#12434)....
r10650 assert_response 404
end
def test_diff_with_invalid_version_from_should_respond_with_404
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :diff, :params => {
:project_id => 1, :id => 'CookBook_documentation',
:version => '99',
:version_from => '98'
}
Jean-Philippe Lang
Respond with 404 instead of 500 when requesting a wiki diff with invalid versions (#12434)....
r10650 assert_response 404
end
Jean-Philippe Lang
Added wiki annotate view. It's accessible for each version from the page history view. ...
r1007 def test_annotate
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :annotate, :params => {
:project_id => 1, :id => 'CookBook_documentation',
:version => 2
}
Jean-Philippe Lang
Added wiki annotate view. It's accessible for each version from the page history view. ...
r1007 assert_response :success
Toshi MARUYAMA
remove trailing white-spaces from test/functional/wiki_controller_test.rb....
r6438
Jean-Philippe Lang
Added wiki annotate view. It's accessible for each version from the page history view. ...
r1007 # Line 1
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'table.annotate tr:nth-child(1)' do
assert_select 'th.line-num', :text => '1'
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'td.author', :text => /Redmine Admin/
assert_select 'td', :text => /h1\. CookBook documentation v2/
end
# Line 4
assert_select 'table.annotate tr:nth-child(4)' do
assert_select 'th.line-num', :text => '4'
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'td.author', :text => /John Smith/
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'td', :text => /Line from v1/
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/wiki_controller_test.rb....
r6438
Jean-Philippe Lang
Fixed: Wiki annotated page does not display author of version 1 (#8449)....
r6086 # Line 5
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'table.annotate tr:nth-child(5)' do
assert_select 'th.line-num', :text => '5'
assert_select 'td.author', :text => /Redmine Admin/
assert_select 'td', :text => /Some updated \[\[documentation\]\] here/
end
Jean-Philippe Lang
Added wiki annotate view. It's accessible for each version from the page history view. ...
r1007 end
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261
Jean-Philippe Lang
Respond with 404 instead of 500 when requesting a wiki diff with invalid versions (#12434)....
r10650 def test_annotate_with_invalid_version_should_respond_with_404
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :annotate, :params => {
:project_id => 1, :id => 'CookBook_documentation',
:version => '99'
}
Jean-Philippe Lang
Respond with 404 instead of 500 when requesting a wiki diff with invalid versions (#12434)....
r10650 assert_response 404
end
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 def test_get_rename
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :rename, :params => {:project_id => 1, :id => 'Another_page'}
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242
assert_select 'select[name=?]', 'wiki_page[parent_id]' do
assert_select 'option[value=""]', :text => ''
assert_select 'option[selected=selected]', 0
end
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 def test_get_rename_child_page
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :rename, :params => {:project_id => 1, :id => 'Child_1'}
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 assert_response :success
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242
assert_select 'select[name=?]', 'wiki_page[parent_id]' do
assert_select 'option[value=""]', :text => ''
assert_select 'option[value="2"][selected=selected]', :text => /Another page/
end
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_rename_with_redirect
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :rename, :params => {
:project_id => 1,
:id => 'Another_page',
:wiki_page => {
:title => 'Another renamed page',
:redirect_existing_links => 1
}
}
Eric Davis
Refactor: use :id instead of :page when linking to Wiki Pages...
r4182 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 wiki = Project.find(1).wiki
# Check redirects
assert_not_nil wiki.find_page('Another page')
assert_nil wiki.find_page('Another page', :with_redirect => false)
end
def test_rename_without_redirect
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :rename, :params => {
:project_id => 1,
:id => 'Another_page',
:wiki_page => {
:title => 'Another renamed page',
:redirect_existing_links => "0"
}
}
Eric Davis
Refactor: use :id instead of :page when linking to Wiki Pages...
r4182 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_renamed_page'
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 wiki = Project.find(1).wiki
# Check that there's no redirects
assert_nil wiki.find_page('Another page')
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 def test_rename_with_parent_assignment
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :rename, :params => {
:project_id => 1,
:id => 'Another_page',
:wiki_page => {
:title => 'Another page',
:redirect_existing_links => "0",
:parent_id => '4'
}
}
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
assert_equal WikiPage.find(4), WikiPage.find_by_title('Another_page').parent
end
def test_rename_with_parent_unassignment
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :rename, :params => {
:project_id => 1,
:id => 'Child_1',
:wiki_page => {
:title => 'Child 1',
:redirect_existing_links => "0",
:parent_id => ''
}
}
Jean-Philippe Lang
Adds a combo to select parent on wiki page rename (#5136)....
r4261 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1'
assert_nil WikiPage.find_by_title('Child_1').parent
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Move wiki page to other project (#5450)....
r13261 def test_get_rename_should_show_target_projects_list
@request.session[:user_id] = 2
project = Project.find(5)
project.enable_module! :wiki
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :rename, :params => {:project_id => 1, :id => 'Another_page'}
Jean-Philippe Lang
Move wiki page to other project (#5450)....
r13261 assert_response :success
assert_select 'select[name=?]', 'wiki_page[wiki_id]' do
assert_select 'option', 2
assert_select 'option[value=?][selected=selected]', '1', :text => /eCookbook/
assert_select 'option[value=?]', project.wiki.id.to_s, :text => /#{project.name}/
end
end
def test_rename_with_move
@request.session[:user_id] = 2
project = Project.find(5)
project.enable_module! :wiki
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :rename, :params => {
:project_id => 1,
:id => 'Another_page',
Jean-Philippe Lang
Move wiki page to other project (#5450)....
r13261 :wiki_page => {
:wiki_id => project.wiki.id.to_s,
:title => 'Another renamed page',
:redirect_existing_links => 1
}
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 }
Jean-Philippe Lang
Move wiki page to other project (#5450)....
r13261 assert_redirected_to '/projects/private-child/wiki/Another_renamed_page'
page = WikiPage.find(2)
assert_equal project.wiki.id, page.wiki_id
end
Jean-Philippe Lang
Adjust tests for new fixture....
r10221 def test_destroy_a_page_without_children_should_not_ask_confirmation
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 @request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy, :params => {:project_id => 1, :id => 'Child_2'}
Eric Davis
Refactor: Rename WikiController#page_index to #index...
r4176 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
Eric Davis
Converted routing and urls to follow the Rails REST convention....
r2315 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adjust tests for new fixture....
r10221 def test_destroy_parent_should_ask_confirmation
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 @request.session[:user_id] = 2
assert_no_difference('WikiPage.count') do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy, :params => {:project_id => 1, :id => 'Another_page'}
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 end
assert_response :success
Jean-Philippe Lang
Adds assertions on the confirmation form....
r10222 assert_select 'form' do
assert_select 'input[name=todo][value=nullify]'
assert_select 'input[name=todo][value=destroy]'
assert_select 'input[name=todo][value=reassign]'
end
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adjust tests for new fixture....
r10221 def test_destroy_parent_with_nullify_should_delete_parent_only
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 @request.session[:user_id] = 2
assert_difference('WikiPage.count', -1) do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'nullify'}
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 end
Eric Davis
Refactor: Rename WikiController#page_index to #index...
r4176 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 assert_nil WikiPage.find_by_id(2)
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Adjust tests for new fixture....
r10221 def test_destroy_parent_with_cascade_should_delete_descendants
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 @request.session[:user_id] = 2
Jean-Philippe Lang
Adjust tests for new fixture....
r10221 assert_difference('WikiPage.count', -4) do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'destroy'}
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 end
Eric Davis
Refactor: Rename WikiController#page_index to #index...
r4176 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 assert_nil WikiPage.find_by_id(2)
assert_nil WikiPage.find_by_id(5)
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 def test_destroy_parent_with_reassign
@request.session[:user_id] = 2
assert_difference('WikiPage.count', -1) do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy, :params => {:project_id => 1, :id => 'Another_page', :todo => 'reassign', :reassign_to_id => 1}
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 end
Eric Davis
Refactor: Rename WikiController#page_index to #index...
r4176 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
Jean-Philippe Lang
Ask user what to do with child pages when deleting a parent wiki page (#3202)....
r2584 assert_nil WikiPage.find_by_id(2)
assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493 def test_destroy_version
@request.session[:user_id] = 2
assert_difference 'WikiContent::Version.count', -1 do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiPage.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy_version, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => 2}
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493 assert_redirected_to '/projects/ecookbook/wiki/CookBook_documentation/history'
end
end
end
end
Jean-Philippe Lang
Fixed that #destroy_version with invalid version destroys wiki page content (#21155)....
r14474
def test_destroy_invalid_version_should_respond_with_404
@request.session[:user_id] = 2
assert_no_difference 'WikiContent::Version.count' do
assert_no_difference 'WikiContent.count' do
assert_no_difference 'WikiPage.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 delete :destroy_version, :params => {:project_id => 'ecookbook', :id => 'CookBook_documentation', :version => 99}
Jean-Philippe Lang
Fixed that #destroy_version with invalid version destroys wiki page content (#21155)....
r14474 end
end
end
assert_response 404
end
Jean-Philippe Lang
Ability to delete a version from a wiki page history (#10852)....
r10493
Eric Davis
Refactor: Rename WikiController#page_index to #index...
r4176 def test_index
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :index, :params => {:project_id => 'ecookbook'}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
assert_select 'ul.pages-hierarchy' do
assert_select 'li', Project.find(1).wiki.pages.count
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'ul.pages-hierarchy' do
assert_select 'li' do
assert_select 'a[href=?]', '/projects/ecookbook/wiki/CookBook_documentation', :text => 'CookBook documentation'
assert_select 'ul li a[href=?]', '/projects/ecookbook/wiki/Page_with_an_inline_image', :text => 'Page with an inline image'
end
assert_select 'li a[href=?]', '/projects/ecookbook/wiki/Another_page', :text => 'Another page'
end
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Fixed: atom links on wiki index broken by r4266....
r5066 def test_index_should_include_atom_link
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :index, :params => {:project_id => 'ecookbook'}
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/ecookbook/activity.atom?show_wiki_edits=1'
Jean-Philippe Lang
Fixed: atom links on wiki index broken by r4266....
r5066 end
Eric Davis
Refactor: extract method in WikiController#special to create a new #export method...
r4137
Jean-Philippe Lang
Adds export of all wiki pages to a PDF file (#3463)....
r8614 def test_export_to_html
Jean-Philippe Lang
Test cleanup....
r8343 @request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :export, :params => {:project_id => 'ecookbook'}
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Test cleanup....
r8343 assert_response :success
assert_equal "text/html", @response.content_type
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Test cleanup....
r8343 assert_select "a[name=?]", "CookBook_documentation"
assert_select "a[name=?]", "Another_page"
assert_select "a[name=?]", "Page_with_an_inline_image"
end
Eric Davis
Refactor: extract method in WikiController#special to create a new #export method...
r4137
Jean-Philippe Lang
Adds export of all wiki pages to a PDF file (#3463)....
r8614 def test_export_to_pdf
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :export, :params => {:project_id => 'ecookbook', :format => 'pdf'}
Jean-Philippe Lang
Adds export of all wiki pages to a PDF file (#3463)....
r8614
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert_equal 'attachment; filename="ecookbook.pdf"', @response.headers['Content-Disposition']
assert @response.body.starts_with?('%PDF')
end
Jean-Philippe Lang
Removed useless permission check in wiki controller....
r8615 def test_export_without_permission_should_be_denied
@request.session[:user_id] = 2
Role.find_by_name('Manager').remove_permission! :export_wiki_pages
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :export, :params => {:project_id => 'ecookbook'}
Eric Davis
Refactor: extract method in WikiController#special to create a new #export method...
r4137
Jean-Philippe Lang
Removed useless permission check in wiki controller....
r8615 assert_response 403
Eric Davis
Refactor: extract method in WikiController#special to create a new #export method...
r4137 end
Eric Davis
Refactor: extract method from WikiController#special...
r4147
Jean-Philippe Lang
Test cleanup....
r8343 def test_date_index
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :date_index, :params => {:project_id => 'ecookbook'}
Eric Davis
Refactor: extract method from WikiController#special...
r4147
Jean-Philippe Lang
Test cleanup....
r8343 assert_response :success
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/ecookbook/activity.atom?show_wiki_edits=1'
Eric Davis
Refactor: extract method from WikiController#special...
r4147 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 def test_not_found
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 999}
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 assert_response 404
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_protect_page
page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page')
assert !page.protected?
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :protect, :params => {:project_id => 1, :id => page.title, :protected => '1'}
Eric Davis
Refactor: use :id instead of :page when linking to Wiki Pages...
r4182 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page'
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert page.reload.protected?
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_unprotect_page
page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation')
assert page.protected?
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :protect, :params => {:project_id => 1, :id => page.title, :protected => '0'}
Eric Davis
Refactor: use :id instead of :page when linking to Wiki Pages...
r4182 assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation'
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert !page.reload.protected?
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_show_page_with_edit_link
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1}
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/edit'
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_show_page_without_edit_link
@request.session[:user_id] = 4
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1}
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/edit', 0
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682 end
Toshi MARUYAMA
test: functional: wiki: add tests to show pdf (#401)...
r7622 def test_show_pdf
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :format => 'pdf'}
Toshi MARUYAMA
test: functional: wiki: add tests to show pdf (#401)...
r7622 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Toshi MARUYAMA
test: functional: wiki: add tests to show pdf (#401)...
r7622 assert_equal 'application/pdf', @response.content_type
assert_equal 'attachment; filename="CookBook_documentation.pdf"',
@response.headers['Content-Disposition']
end
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 def test_show_html
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :format => 'html'}
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 assert_equal 'text/html', @response.content_type
assert_equal 'attachment; filename="CookBook_documentation.html"',
@response.headers['Content-Disposition']
Jean-Philippe Lang
Replaced remaining #assert_tag with #assert_select....
r13242 assert_select 'h1', :text => /CookBook documentation/
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 end
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 def test_show_versioned_html
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :format => 'html', :version => 2}
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 assert_equal 'text/html', @response.content_type
assert_equal 'attachment; filename="CookBook_documentation.html"',
@response.headers['Content-Disposition']
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_select 'h1', :text => /CookBook documentation v2/
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 end
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 def test_show_txt
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :format => 'txt'}
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 assert_equal 'text/plain', @response.content_type
assert_equal 'attachment; filename="CookBook_documentation.txt"',
@response.headers['Content-Disposition']
Jean-Philippe Lang
Adds assertions on the content of a wiki page export (#6941)....
r9227 assert_include 'h1. CookBook documentation', @response.body
Toshi MARUYAMA
test: functional: wiki: add tests to show html and txt (#401)...
r7619 end
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 def test_show_versioned_txt
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :show, :params => {:project_id => 1, :format => 'txt', :version => 2}
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 assert_response :success
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 assert_equal 'text/plain', @response.content_type
assert_equal 'attachment; filename="CookBook_documentation.txt"',
@response.headers['Content-Disposition']
Jean-Philippe Lang
Removes calls to #assert_template and #assigns in functional tests....
r15342 assert_include 'h1. CookBook documentation v2', @response.body
Jean-Philippe Lang
Adds assertions on the content of a versioned wiki page export (#6941)....
r9228 end
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_edit_unprotected_page
# Non members can edit unprotected wiki pages
@request.session[:user_id] = 4
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :edit, :params => {:project_id => 1, :id => 'Another_page'}
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert_response :success
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_edit_protected_page_by_nonmember
Jean-Philippe Lang
Replaced "can't" with "cannot" in error messages....
r13399 # Non members cannot edit protected wiki pages
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 @request.session[:user_id] = 4
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :edit, :params => {:project_id => 1, :id => 'CookBook_documentation'}
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert_response 403
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 def test_edit_protected_page_by_member
@request.session[:user_id] = 2
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :edit, :params => {:project_id => 1, :id => 'CookBook_documentation'}
Jean-Philippe Lang
Wiki page protection (#851, patch #1146 by Mateo Murphy with slight changes)....
r1400 assert_response :success
end
Toshi MARUYAMA
remove trailing white-spaces from functional wiki controller test....
r5682
Jean-Philippe Lang
Check that wiki page exists before processing (#2360)....
r2143 def test_history_of_non_existing_page_should_return_404
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 get :history, :params => {:project_id => 1, :id => 'Unknown_page'}
Jean-Philippe Lang
Check that wiki page exists before processing (#2360)....
r2143 assert_response 404
end
Jean-Philippe Lang
Additional tests for WikiController....
r8142
def test_add_attachment
@request.session[:user_id] = 2
assert_difference 'Attachment.count' do
Jean-Philippe Lang
Pass parameters with :params in controller tests....
r15284 post :add_attachment, :params => {
:project_id => 1,
:id => 'CookBook_documentation',
:attachments => {
'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
}
}
Jean-Philippe Lang
Additional tests for WikiController....
r8142 end
Toshi MARUYAMA
Rails4: replace deprecated Relation#first with finder options at WikiControllerTest...
r12360 attachment = Attachment.order('id DESC').first
Jean-Philippe Lang
Additional tests for WikiController....
r8142 assert_equal Wiki.find(1).find_page('CookBook_documentation'), attachment.container
end
Jean-Philippe Lang
Added some functional tests (wiki)....
r986 end