Test cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8462 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
84f8245abb
commit
13dca2fd3d
|
@ -16,11 +16,6 @@
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
require File.expand_path('../../test_helper', __FILE__)
|
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
|
class ReportsControllerTest < ActionController::TestCase
|
||||||
fixtures :projects, :trackers, :issue_statuses, :issues,
|
fixtures :projects, :trackers, :issue_statuses, :issues,
|
||||||
|
@ -34,54 +29,36 @@ class ReportsControllerTest < ActionController::TestCase
|
||||||
:versions
|
:versions
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = ReportsController.new
|
|
||||||
@request = ActionController::TestRequest.new
|
|
||||||
@response = ActionController::TestResponse.new
|
|
||||||
User.current = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "GET :issue_report without details" do
|
def test_get_issue_report
|
||||||
setup do
|
get :issue_report, :id => 1
|
||||||
get :issue_report, :id => 1
|
|
||||||
end
|
|
||||||
|
|
||||||
should_respond_with :success
|
assert_response :success
|
||||||
should_render_template :issue_report
|
assert_template 'issue_report'
|
||||||
|
|
||||||
[:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
|
[:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
|
||||||
:issues_by_author, :issues_by_subproject].each do |ivar|
|
:issues_by_author, :issues_by_subproject].each do |ivar|
|
||||||
should_assign_to ivar
|
assert_not_nil assigns(ivar)
|
||||||
should "set a value for #{ivar}" do
|
|
||||||
assert assigns[ivar.to_s].present?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
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|
|
%w(tracker version priority category assigned_to author subproject).each do |detail|
|
||||||
context "for #{detail}" do
|
get :issue_report_details, :id => 1, :detail => detail
|
||||||
setup do
|
|
||||||
get :issue_report_details, :id => 1, :detail => detail
|
|
||||||
end
|
|
||||||
|
|
||||||
should_respond_with :success
|
assert_response :success
|
||||||
should_render_template :issue_report_details
|
assert_template 'issue_report_details'
|
||||||
should_assign_to :field
|
assert_not_nil assigns(:field)
|
||||||
should_assign_to :rows
|
assert_not_nil assigns(:rows)
|
||||||
should_assign_to :data
|
assert_not_nil assigns(:data)
|
||||||
should_assign_to :report_title
|
assert_not_nil assigns(:report_title)
|
||||||
end
|
|
||||||
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
|
|
||||||
|
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue