To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / .svn / pristine / 78 / 78656abccdc6e881919c3599b07b9c04e13170fc.svn-base @ 1297:0a574315af3e

History | View | Annotate | Download (2.73 KB)

1
# Redmine - project management software
2
# Copyright (C) 2006-2011  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

    
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

    
25
class ReportsControllerTest < ActionController::TestCase
26
  fixtures :projects, :trackers, :issue_statuses, :issues,
27
           :enumerations, :users, :issue_categories,
28
           :projects_trackers,
29
           :roles,
30
           :member_roles,
31
           :members,
32
           :enabled_modules,
33
           :workflows,
34
           :versions
35

    
36
  def setup
37
    @controller = ReportsController.new
38
    @request    = ActionController::TestRequest.new
39
    @response   = ActionController::TestResponse.new
40
    User.current = nil
41
  end
42

    
43
  context "GET :issue_report without details" do
44
    setup do
45
      get :issue_report, :id => 1
46
    end
47

    
48
    should_respond_with :success
49
    should_render_template :issue_report
50

    
51
    [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
52
     :issues_by_author, :issues_by_subproject].each do |ivar|
53
      should_assign_to ivar
54
      should "set a value for #{ivar}" do
55
        assert assigns[ivar.to_s].present?
56
      end
57
    end
58
  end
59

    
60
  context "GET :issue_report_details" do
61
    %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
66

    
67
        should_respond_with :success
68
        should_render_template :issue_report_details
69
        should_assign_to :field
70
        should_assign_to :rows
71
        should_assign_to :data
72
        should_assign_to :report_title
73
      end
74
    end
75

    
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
84

    
85
  end
86

    
87
end