2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2013-01-07 02:20:49 +04:00
|
|
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2009-03-01 14:39:01 +03:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
2010-12-13 02:24:34 +03:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
2009-01-26 04:47:51 +03:00
|
|
|
require 'reports_controller'
|
|
|
|
|
|
|
|
# Re-raise errors caught by the controller.
|
|
|
|
class ReportsController; def rescue_action(e) raise e end; end
|
|
|
|
|
|
|
|
|
2009-09-13 21:14:35 +04:00
|
|
|
class ReportsControllerTest < ActionController::TestCase
|
2009-03-01 14:39:01 +03:00
|
|
|
fixtures :all
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2009-03-01 14:39:01 +03:00
|
|
|
def setup
|
|
|
|
@controller = ReportsController.new
|
|
|
|
@request = ActionController::TestRequest.new
|
|
|
|
@response = ActionController::TestResponse.new
|
|
|
|
User.current = nil
|
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2010-02-03 19:49:16 +03:00
|
|
|
context "GET :issue_report without details" do
|
|
|
|
setup do
|
|
|
|
get :issue_report, :id => 1
|
|
|
|
end
|
|
|
|
|
|
|
|
should_respond_with :success
|
|
|
|
should_render_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
|
|
|
|
end
|
2009-03-01 14:39:01 +03:00
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
|
|
|
|
context "GET :issue_report_details" do
|
2009-03-01 14:39:01 +03:00
|
|
|
%w(tracker version priority category assigned_to author subproject).each do |detail|
|
2010-02-08 20:53:58 +03:00
|
|
|
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
|
|
|
|
end
|
2009-03-01 14:39:01 +03:00
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
|
|
|
|
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
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2009-03-01 14:39:01 +03:00
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2009-01-26 04:47:51 +03:00
|
|
|
end
|