Refactor: Move gantts to a separate controller.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3695 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
require 'test_helper'
|
||||
|
||||
class GanttsControllerTest < ActionController::TestCase
|
||||
fixtures :all
|
||||
|
||||
context "#gantt" do
|
||||
should "work" do
|
||||
get :show, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'show.html.erb'
|
||||
assert_not_nil assigns(:gantt)
|
||||
events = assigns(:gantt).events
|
||||
assert_not_nil events
|
||||
# Issue with start and due dates
|
||||
i = Issue.find(1)
|
||||
assert_not_nil i.due_date
|
||||
assert events.include?(Issue.find(1))
|
||||
# Issue with without due date but targeted to a version with date
|
||||
i = Issue.find(2)
|
||||
assert_nil i.due_date
|
||||
assert events.include?(i)
|
||||
end
|
||||
|
||||
should "work cross project" do
|
||||
get :show
|
||||
assert_response :success
|
||||
assert_template 'show.html.erb'
|
||||
assert_not_nil assigns(:gantt)
|
||||
events = assigns(:gantt).events
|
||||
assert_not_nil events
|
||||
end
|
||||
|
||||
should "export to pdf" do
|
||||
get :show, :project_id => 1, :format => 'pdf'
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
should "export to pdf cross project" do
|
||||
get :show, :format => 'pdf'
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
should "export to png" do
|
||||
get :show, :project_id => 1, :format => 'png'
|
||||
assert_response :success
|
||||
assert_equal 'image/png', @response.content_type
|
||||
end if Object.const_defined?(:Magick)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -231,58 +231,6 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
assert_equal columns, session[:query][:column_names].map(&:to_s)
|
||||
end
|
||||
|
||||
def test_gantt
|
||||
get :gantt, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'gantt.rhtml'
|
||||
assert_not_nil assigns(:gantt)
|
||||
events = assigns(:gantt).events
|
||||
assert_not_nil events
|
||||
# Issue with start and due dates
|
||||
i = Issue.find(1)
|
||||
assert_not_nil i.due_date
|
||||
assert events.include?(Issue.find(1))
|
||||
# Issue with without due date but targeted to a version with date
|
||||
i = Issue.find(2)
|
||||
assert_nil i.due_date
|
||||
assert events.include?(i)
|
||||
end
|
||||
|
||||
def test_cross_project_gantt
|
||||
get :gantt
|
||||
assert_response :success
|
||||
assert_template 'gantt.rhtml'
|
||||
assert_not_nil assigns(:gantt)
|
||||
events = assigns(:gantt).events
|
||||
assert_not_nil events
|
||||
end
|
||||
|
||||
def test_gantt_export_to_pdf
|
||||
get :gantt, :project_id => 1, :format => 'pdf'
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
def test_cross_project_gantt_export_to_pdf
|
||||
get :gantt, :format => 'pdf'
|
||||
assert_response :success
|
||||
assert_equal 'application/pdf', @response.content_type
|
||||
assert @response.body.starts_with?('%PDF')
|
||||
assert_not_nil assigns(:gantt)
|
||||
end
|
||||
|
||||
if Object.const_defined?(:Magick)
|
||||
def test_gantt_image
|
||||
get :gantt, :project_id => 1, :format => 'png'
|
||||
assert_response :success
|
||||
assert_equal 'image/png', @response.content_type
|
||||
end
|
||||
else
|
||||
puts "RMagick not installed. Skipping tests !!!"
|
||||
end
|
||||
|
||||
def test_calendar
|
||||
get :calendar, :project_id => 1
|
||||
assert_response :success
|
||||
|
||||
@@ -95,10 +95,10 @@ class RoutingTest < ActionController::IntegrationTest
|
||||
should_route :get, "/projects/project-name/issues/calendar", :controller => 'issues', :action => 'calendar', :project_id => 'project-name'
|
||||
should_route :post, "/projects/project-name/issues/calendar", :controller => 'issues', :action => 'calendar', :project_id => 'project-name'
|
||||
|
||||
should_route :get, "/issues/gantt", :controller => 'issues', :action => 'gantt'
|
||||
should_route :post, "/issues/gantt", :controller => 'issues', :action => 'gantt'
|
||||
should_route :get, "/projects/project-name/issues/gantt", :controller => 'issues', :action => 'gantt', :project_id => 'project-name'
|
||||
should_route :post, "/projects/project-name/issues/gantt", :controller => 'issues', :action => 'gantt', :project_id => 'project-name'
|
||||
should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
|
||||
should_route :post, "/issues/gantt", :controller => 'gantts', :action => 'show'
|
||||
should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
|
||||
should_route :post, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
|
||||
|
||||
should_route :get, "/issues/auto_complete", :controller => 'issues', :action => 'auto_complete'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user