Test cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8462 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-01-01 19:57:30 +00:00
parent 84f8245abb
commit 13dca2fd3d
1 changed files with 18 additions and 41 deletions

View File

@ -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
def test_get_issue_report
get :issue_report, :id => 1
end
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
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
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
def test_get_issue_report_details_with_an_invalid_detail
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'}}
assert_redirected_to '/projects/ecookbook/issues/report'
end
end
end