##// END OF EJS Templates
Speeds up rendering of the project list for users who belong to hundreds of projects....
Speeds up rendering of the project list for users who belong to hundreds of projects. git-svn-id: http://svn.redmine.org/redmine/trunk@16123 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15279:2e4e610930cd
r15741:f8df935dcada
Show More
comments_controller_test.rb
64 lines | 2.3 KiB | text/x-ruby | RubyLexer
/ test / functional / comments_controller_test.rb
Toshi MARUYAMA
remove trailing white-spaces from test/functional/comments_controller_test.rb....
r6701 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 #
# 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 test/functional/comments_controller_test.rb....
r6701 #
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 # 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 test/functional/comments_controller_test.rb....
r6701 #
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 # 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__)
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056
Jean-Philippe Lang
Adds our own class for controller tests....
r15279 class CommentsControllerTest < Redmine::ControllerTest
Jean-Philippe Lang
Missing fixtures....
r13507 fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, :enabled_modules, :news, :comments
Toshi MARUYAMA
remove trailing white-spaces from test/functional/comments_controller_test.rb....
r6701
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 def setup
User.current = nil
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/comments_controller_test.rb....
r6701
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 def test_add_comment
@request.session[:user_id] = 2
post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
Jean-Philippe Lang
Adds leading slash to all assert_redirected_to arguments (#6887)....
r4293 assert_redirected_to '/news/1'
Toshi MARUYAMA
remove trailing white-spaces from test/functional/comments_controller_test.rb....
r6701
Toshi MARUYAMA
Rails3: test: fix ordering functional/comments_controller_test.rb...
r8867 comment = News.find(1).comments.last
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 assert_not_nil comment
assert_equal 'This is a test comment', comment.comments
assert_equal User.find(2), comment.author
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/comments_controller_test.rb....
r6701
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 def test_empty_comment_should_not_be_added
@request.session[:user_id] = 2
assert_no_difference 'Comment.count' do
post :create, :id => 1, :comment => { :comments => '' }
assert_response :redirect
Jean-Philippe Lang
Adds leading slash to all assert_redirected_to arguments (#6887)....
r4293 assert_redirected_to '/news/1'
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 end
end
Eric Davis
Refactor: move #destroy_comment method to CommentsController#destroy...
r4058
Jean-Philippe Lang
Adds a News#commentable? method to easily specific additional rules....
r8734 def test_create_should_be_denied_if_news_is_not_commentable
News.any_instance.stubs(:commentable?).returns(false)
@request.session[:user_id] = 2
assert_no_difference 'Comment.count' do
post :create, :id => 1, :comment => { :comments => 'This is a test comment' }
assert_response 403
end
end
Eric Davis
Refactor: move #destroy_comment method to CommentsController#destroy...
r4058 def test_destroy_comment
comments_count = News.find(1).comments.size
@request.session[:user_id] = 2
delete :destroy, :id => 1, :comment_id => 2
Jean-Philippe Lang
Adds leading slash to all assert_redirected_to arguments (#6887)....
r4293 assert_redirected_to '/news/1'
Eric Davis
Refactor: move #destroy_comment method to CommentsController#destroy...
r4058 assert_nil Comment.find_by_id(2)
assert_equal comments_count - 1, News.find(1).comments.size
end
Eric Davis
Refactor: move NewsController#add_comment to CommentsController#create...
r4056 end