Mercurial > hg > soundsoftware-site
diff test/functional/reports_controller_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
line wrap: on
line diff
--- a/test/functional/reports_controller_test.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/test/functional/reports_controller_test.rb Mon Jan 07 12:01:42 2013 +0000 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -16,11 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. require File.expand_path('../../test_helper', __FILE__) -require 'reports_controller' - -# Re-raise errors caught by the controller. -class ReportsController; def rescue_action(e) raise e end; end - class ReportsControllerTest < ActionController::TestCase fixtures :projects, :trackers, :issue_statuses, :issues, @@ -34,54 +29,43 @@ :versions def setup - @controller = ReportsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - User.current = nil end - context "GET :issue_report without details" do - setup do - get :issue_report, :id => 1 + def test_get_issue_report + get :issue_report, :id => 1 + + assert_response :success + assert_template 'issue_report' + + [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, + :issues_by_author, :issues_by_subproject, :issues_by_priority].each do |ivar| + assert_not_nil assigns(ivar) end - should_respond_with :success - should_render_template :issue_report + assert_equal IssuePriority.all.reverse, assigns(:priorities) + end - [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, - :issues_by_author, :issues_by_subproject].each do |ivar| - should_assign_to ivar - should "set a value for #{ivar}" do - assert assigns[ivar.to_s].present? - end + def test_get_issue_report_details + %w(tracker version priority category assigned_to author subproject).each do |detail| + get :issue_report_details, :id => 1, :detail => detail + + assert_response :success + assert_template 'issue_report_details' + assert_not_nil assigns(:field) + assert_not_nil assigns(:rows) + assert_not_nil assigns(:data) + assert_not_nil assigns(:report_title) end end - context "GET :issue_report_details" do - %w(tracker version priority category assigned_to author subproject).each do |detail| - context "for #{detail}" do - setup do - get :issue_report_details, :id => 1, :detail => detail - end - - should_respond_with :success - should_render_template :issue_report_details - should_assign_to :field - should_assign_to :rows - should_assign_to :data - should_assign_to :report_title - end - end - - context "with an invalid detail" do - setup do - get :issue_report_details, :id => 1, :detail => 'invalid' - end - - should_respond_with :redirect - should_redirect_to('the issue report') {{:controller => 'reports', :action => 'issue_report', :id => 'ecookbook'}} - end - + def test_get_issue_report_details_by_priority + get :issue_report_details, :id => 1, :detail => 'priority' + assert_equal IssuePriority.all.reverse, assigns(:rows) end + def test_get_issue_report_details_with_an_invalid_detail + get :issue_report_details, :id => 1, :detail => 'invalid' + + assert_redirected_to '/projects/ecookbook/issues/report' + end end