##// END OF EJS Templates
Test cleanup....
Jean-Philippe Lang -
r8342:13dca2fd3dd4
parent child
Show More
@@ -16,11 +16,6
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19 require 'reports_controller'
20
21 # Re-raise errors caught by the controller.
22 class ReportsController; def rescue_action(e) raise e end; end
23
24
19
25 class ReportsControllerTest < ActionController::TestCase
20 class ReportsControllerTest < ActionController::TestCase
26 fixtures :projects, :trackers, :issue_statuses, :issues,
21 fixtures :projects, :trackers, :issue_statuses, :issues,
@@ -34,54 +29,36 class ReportsControllerTest < ActionController::TestCase
34 :versions
29 :versions
35
30
36 def setup
31 def setup
37 @controller = ReportsController.new
38 @request = ActionController::TestRequest.new
39 @response = ActionController::TestResponse.new
40 User.current = nil
41 end
32 end
42
33
43 context "GET :issue_report without details" do
34 def test_get_issue_report
44 setup do
45 get :issue_report, :id => 1
35 get :issue_report, :id => 1
46 end
47
36
48 should_respond_with :success
37 assert_response :success
49 should_render_template :issue_report
38 assert_template 'issue_report'
50
39
51 [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
40 [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
52 :issues_by_author, :issues_by_subproject].each do |ivar|
41 :issues_by_author, :issues_by_subproject].each do |ivar|
53 should_assign_to ivar
42 assert_not_nil assigns(ivar)
54 should "set a value for #{ivar}" do
55 assert assigns[ivar.to_s].present?
56 end
57 end
43 end
58 end
44 end
59
45
60 context "GET :issue_report_details" do
46 def test_get_issue_report_details
61 %w(tracker version priority category assigned_to author subproject).each do |detail|
47 %w(tracker version priority category assigned_to author subproject).each do |detail|
62 context "for #{detail}" do
63 setup do
64 get :issue_report_details, :id => 1, :detail => detail
48 get :issue_report_details, :id => 1, :detail => detail
65 end
66
49
67 should_respond_with :success
50 assert_response :success
68 should_render_template :issue_report_details
51 assert_template 'issue_report_details'
69 should_assign_to :field
52 assert_not_nil assigns(:field)
70 should_assign_to :rows
53 assert_not_nil assigns(:rows)
71 should_assign_to :data
54 assert_not_nil assigns(:data)
72 should_assign_to :report_title
55 assert_not_nil assigns(:report_title)
73 end
56 end
74 end
57 end
75
58
76 context "with an invalid detail" do
59 def test_get_issue_report_details_with_an_invalid_detail
77 setup do
78 get :issue_report_details, :id => 1, :detail => 'invalid'
60 get :issue_report_details, :id => 1, :detail => 'invalid'
79 end
80
81 should_respond_with :redirect
82 should_redirect_to('the issue report') {{:controller => 'reports', :action => 'issue_report', :id => 'ecookbook'}}
83 end
84
61
62 assert_redirected_to '/projects/ecookbook/issues/report'
85 end
63 end
86
87 end
64 end
General Comments 0
You need to be logged in to leave comments. Login now