def issue_report
@statuses = IssueStatus.find(:all, :order => 'position')
+ @trackers = @project.trackers
+ @versions = @project.shared_versions.sort
+ @priorities = IssuePriority.all
+ @categories = @project.issue_categories
+ @assignees = @project.members.collect { |m| m.user }.sort
+ @authors = @project.members.collect { |m| m.user }.sort
+ @subprojects = @project.descendants.active
+ issues_by_tracker
+ issues_by_version
+ issues_by_priority
+ issues_by_category
+ issues_by_assigned_to
+ issues_by_author
+ issues_by_subproject
+
+ render :template => "reports/issue_report"
+ end
+
+ def issue_report_details
+ @statuses = IssueStatus.find(:all, :order => 'position')
+
case params[:detail]
when "tracker"
@field = "tracker_id"
@report_title = l(:field_subproject)
render :template => "reports/issue_report_details"
else
- @trackers = @project.trackers
- @versions = @project.shared_versions.sort
- @priorities = IssuePriority.all
- @categories = @project.issue_categories
- @assignees = @project.members.collect { |m| m.user }.sort
- @authors = @project.members.collect { |m| m.user }.sort
- @subprojects = @project.descendants.active
- issues_by_tracker
- issues_by_version
- issues_by_priority
- issues_by_category
- issues_by_assigned_to
- issues_by_author
- issues_by_subproject
-
- render :template => "reports/issue_report"
+ redirect_to :action => 'issue_report', :id => @project
end
- end
-
+
+ end
private
def issues_by_tracker
@issues_by_tracker ||= Issue.by_tracker(@project)
relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
end
- map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports|
- reports.connect 'projects/:id/issues/report'
- reports.connect 'projects/:id/issues/report/:detail'
+ map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
+ reports.connect 'projects/:id/issues/report', :action => 'issue_report'
+ reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
end
map.with_options :controller => 'news' do |news_routes|
:issues => [:index, :changes, :show, :context_menu],
:versions => [:show, :status_by],
:queries => :index,
- :reports => :issue_report}
+ :reports => [:issue_report, :issue_report_details]}
map.permission :add_issues, {:issues => [:new, :update_form]}
map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
end
end
end
-
- def test_issue_report_details
+
+ context "GET :issue_report_details" do
%w(tracker version priority category assigned_to author subproject).each do |detail|
- get :issue_report, :id => 1, :detail => detail
- assert_response :success
- assert_template 'issue_report_details'
+ 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
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
class RoutingTest < ActionController::IntegrationTest
context "issue reports" do
should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
- should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report', :id => '567', :detail => 'assigned_to'
+ should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
end
end