@@ -16,11 +16,6 | |||
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 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 | 20 | class ReportsControllerTest < ActionController::TestCase |
|
26 | 21 | fixtures :projects, :trackers, :issue_statuses, :issues, |
@@ -34,54 +29,36 class ReportsControllerTest < ActionController::TestCase | |||
|
34 | 29 | :versions |
|
35 | 30 | |
|
36 | 31 | def setup |
|
37 | @controller = ReportsController.new | |
|
38 | @request = ActionController::TestRequest.new | |
|
39 | @response = ActionController::TestResponse.new | |
|
40 | User.current = nil | |
|
41 | 32 | end |
|
42 | 33 | |
|
43 | context "GET :issue_report without details" do | |
|
44 | setup do | |
|
45 | get :issue_report, :id => 1 | |
|
46 | end | |
|
34 | def test_get_issue_report | |
|
35 | get :issue_report, :id => 1 | |
|
47 | 36 | |
|
48 |
|
|
|
49 |
|
|
|
37 | assert_response :success | |
|
38 | assert_template 'issue_report' | |
|
50 | 39 | |
|
51 | 40 | [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to, |
|
52 | 41 | :issues_by_author, :issues_by_subproject].each do |ivar| |
|
53 |
|
|
|
54 | should "set a value for #{ivar}" do | |
|
55 | assert assigns[ivar.to_s].present? | |
|
56 | end | |
|
42 | assert_not_nil assigns(ivar) | |
|
57 | 43 | end |
|
58 | 44 | end |
|
59 | 45 | |
|
60 |
|
|
|
46 | def test_get_issue_report_details | |
|
61 | 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 | |
|
65 | end | |
|
48 | get :issue_report_details, :id => 1, :detail => detail | |
|
66 | 49 | |
|
67 |
|
|
|
68 |
|
|
|
69 | should_assign_to :field | |
|
70 | should_assign_to :rows | |
|
71 | should_assign_to :data | |
|
72 |
|
|
|
73 | end | |
|
50 | assert_response :success | |
|
51 | assert_template 'issue_report_details' | |
|
52 | assert_not_nil assigns(:field) | |
|
53 | assert_not_nil assigns(:rows) | |
|
54 | assert_not_nil assigns(:data) | |
|
55 | assert_not_nil assigns(:report_title) | |
|
74 | 56 | end |
|
57 | end | |
|
75 | 58 | |
|
76 | context "with an invalid detail" do | |
|
77 | setup do | |
|
78 | 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 | |
|
59 | def test_get_issue_report_details_with_an_invalid_detail | |
|
60 | get :issue_report_details, :id => 1, :detail => 'invalid' | |
|
84 | 61 | |
|
62 | assert_redirected_to '/projects/ecookbook/issues/report' | |
|
85 | 63 | end |
|
86 | ||
|
87 | 64 | end |
General Comments 0
You need to be logged in to leave comments.
Login now