summaryrefslogtreecommitdiffstats
path: root/test/functional/reports_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-01 19:57:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-01 19:57:30 +0000
commit13dca2fd3dd49bd38a364f97dad7e146e911c04e (patch)
tree5b6510e4915bcd9bd3637a6cbc83c10e0d6e3b83 /test/functional/reports_controller_test.rb
parent84f8245abb5b5f1b597cc7f3a9d634df90a90e96 (diff)
downloadredmine-13dca2fd3dd49bd38a364f97dad7e146e911c04e.tar.gz
redmine-13dca2fd3dd49bd38a364f97dad7e146e911c04e.zip
Test cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8462 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/reports_controller_test.rb')
-rw-r--r--test/functional/reports_controller_test.rb57
1 files changed, 17 insertions, 40 deletions
diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb
index 88df190f2..40a1a498c 100644
--- a/test/functional/reports_controller_test.rb
+++ b/test/functional/reports_controller_test.rb
@@ -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,36 @@ class ReportsControllerTest < ActionController::TestCase
: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
- end
+ def test_get_issue_report
+ get :issue_report, :id => 1
- should_respond_with :success
- should_render_template :issue_report
+ 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].each do |ivar|
- should_assign_to ivar
- should "set a value for #{ivar}" do
- assert assigns[ivar.to_s].present?
- end
+ assert_not_nil assigns(ivar)
end
end
- context "GET :issue_report_details" do
+ def test_get_issue_report_details
%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
+ get :issue_report_details, :id => 1, :detail => detail
- 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
+ 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 "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_with_an_invalid_detail
+ get :issue_report_details, :id => 1, :detail => 'invalid'
+ assert_redirected_to '/projects/ecookbook/issues/report'
end
-
end