##// END OF EJS Templates
* Added links to previous and next revisions on revision view (patch by Cyril Mougel slightly edited)...
* Added links to previous and next revisions on revision view (patch by Cyril Mougel slightly edited) * Fixed TimelogController#report december error * Fixed ProjectsControllerTest#test_activity 1st and 2nd day of the month failure git-svn-id: http://redmine.rubyforge.org/svn/trunk@938 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r925:db002edabdec
r925:db002edabdec
Show More
projects_controller_test.rb
149 lines | 4.8 KiB | text/x-ruby | RubyLexer
/ test / functional / projects_controller_test.rb
Jean-Philippe Lang
v0.2.0...
r5 # redMine - project management software
Jean-Philippe Lang
Added the ability to archive projects:...
r546 # Copyright (C) 2006-2007 Jean-Philippe Lang
Jean-Philippe Lang
v0.2.0...
r5 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Philippe Lang
Initial commit...
r2 require File.dirname(__FILE__) + '/../test_helper'
require 'projects_controller'
# Re-raise errors caught by the controller.
class ProjectsController; def rescue_action(e) raise e end; end
class ProjectsControllerTest < Test::Unit::TestCase
Jean-Philippe Lang
Added per-project tracker selection. Trackers can be selected on project settings....
r907 fixtures :projects, :users, :roles, :members, :issues, :journals, :journal_details, :trackers, :projects_trackers, :issue_statuses, :enabled_modules, :enumerations
Jean-Philippe Lang
Initial commit...
r2
def setup
@controller = ProjectsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_index
get :index
assert_response :success
assert_template 'list'
end
def test_list
get :list
assert_response :success
assert_template 'list'
Jean-Philippe Lang
Added 'Estimated hours' attribute on issues....
r720 assert_not_nil assigns(:project_tree)
Jean-Philippe Lang
0.3 unstable...
r10 end
def test_show
get :show, :id => 1
assert_response :success
assert_template 'show'
assert_not_nil assigns(:project)
end
def test_list_documents
get :list_documents, :id => 1
assert_response :success
assert_template 'list_documents'
Jean-Philippe Lang
Removed IssueStatus html_color attribute....
r868 assert_not_nil assigns(:grouped)
Jean-Philippe Lang
0.3 unstable...
r10 end
Jean-Philippe Lang
Added 'Bulk edit' functionality....
r806
def test_bulk_edit_issues
@request.session[:user_id] = 2
# update issues priority
Jean-Philippe Lang
Fixed: error when bulk editing with Postgresql...
r853 post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => 'Bulk editing', :assigned_to_id => ''
Jean-Philippe Lang
Added 'Bulk edit' functionality....
r806 assert_response 302
# check that the issues were updated
assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
Jean-Philippe Lang
Fixed: error when bulk editing with Postgresql...
r853 assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes
Jean-Philippe Lang
0.3 unstable...
r10 end
def test_list_files
get :list_files, :id => 1
assert_response :success
assert_template 'list_files'
assert_not_nil assigns(:versions)
end
def test_changelog
get :changelog, :id => 1
assert_response :success
assert_template 'changelog'
Jean-Philippe Lang
Versions can now be created with no date....
r533 assert_not_nil assigns(:versions)
Jean-Philippe Lang
Initial commit...
r2 end
Jean-Philippe Lang
search engine improvements and simple test...
r282
Jean-Philippe Lang
added roadmap and activity calls in projects functional tests...
r368 def test_roadmap
get :roadmap, :id => 1
assert_response :success
assert_template 'roadmap'
assert_not_nil assigns(:versions)
end
def test_activity
Jean-Philippe Lang
* Added links to previous and next revisions on revision view (patch by Cyril Mougel slightly edited)...
r925 get :activity, :id => 1, :year => 2.days.ago.to_date.year, :month => 2.days.ago.to_date.month
Jean-Philippe Lang
added roadmap and activity calls in projects functional tests...
r368 assert_response :success
assert_template 'activity'
assert_not_nil assigns(:events_by_day)
Jean-Philippe Lang
Added issues status changes on the activity view (initial patch by Cyril Mougel)....
r879
assert_tag :tag => "h3",
:content => /#{2.days.ago.to_date.day}/,
:sibling => { :tag => "ul",
:child => { :tag => "li",
:child => { :tag => "p",
:content => /(#{IssueStatus.find(2).name})/,
}
}
}
assert_tag :tag => "h3",
:content => /#{3.day.ago.to_date.day}/,
:sibling => { :tag => "ul", :child => { :tag => "li",
:child => { :tag => "p",
:content => /#{Issue.find(1).subject}/,
}
}
}
Jean-Philippe Lang
added roadmap and activity calls in projects functional tests...
r368 end
Jean-Philippe Lang
Added the ability to archive projects:...
r546
def test_archive
@request.session[:user_id] = 1 # admin
post :archive, :id => 1
assert_redirected_to 'admin/projects'
assert !Project.find(1).active?
end
def test_unarchive
@request.session[:user_id] = 1 # admin
Project.find(1).archive
post :unarchive, :id => 1
assert_redirected_to 'admin/projects'
assert Project.find(1).active?
end
Jean-Philippe Lang
Added the hability to copy an issue....
r860
def test_add_issue
@request.session[:user_id] = 2
get :add_issue, :id => 1, :tracker_id => 1
assert_response :success
assert_template 'add_issue'
post :add_issue, :id => 1, :issue => {:tracker_id => 1, :subject => 'This is the test_add_issue issue', :description => 'This is the description', :priority_id => 5}
Jean-Philippe Lang
ProjectsController#list_issues, #export_issues_csv and #export_issues_pdf merged into IssuesController#index...
r874 assert_redirected_to 'projects/1/issues'
Jean-Philippe Lang
Added the hability to copy an issue....
r860 assert Issue.find_by_subject('This is the test_add_issue issue')
end
def test_copy_issue
@request.session[:user_id] = 2
get :add_issue, :id => 1, :copy_from => 1
assert_template 'add_issue'
assert_not_nil assigns(:issue)
orig = Issue.find(1)
assert_equal orig.subject, assigns(:issue).subject
end
Jean-Philippe Lang
Initial commit...
r2 end