summaryrefslogtreecommitdiffstats
path: root/test/functional/gantts_controller_test.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-04-28 15:54:46 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-04-28 15:54:46 +0000
commite65c3cfc7df3da58071c8de158c98861dab7d852 (patch)
treee2ce1076fba209a370e49888eac588731e927f2f /test/functional/gantts_controller_test.rb
parenta925435b294331079b65e96d2480bb99d1c6f109 (diff)
downloadredmine-e65c3cfc7df3da58071c8de158c98861dab7d852.tar.gz
redmine-e65c3cfc7df3da58071c8de158c98861dab7d852.zip
Refactor: Move gantts to a separate controller.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3695 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/gantts_controller_test.rb')
-rw-r--r--test/functional/gantts_controller_test.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb
new file mode 100644
index 000000000..4c27de7cd
--- /dev/null
+++ b/test/functional/gantts_controller_test.rb
@@ -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