Chris@0: require 'test_helper' Chris@0: Chris@0: class GanttsControllerTest < ActionController::TestCase Chris@0: fixtures :all Chris@0: Chris@0: context "#gantt" do Chris@0: should "work" do Chris@0: get :show, :project_id => 1 Chris@0: assert_response :success Chris@0: assert_template 'show.html.erb' Chris@0: assert_not_nil assigns(:gantt) Chris@0: events = assigns(:gantt).events Chris@0: assert_not_nil events Chris@0: # Issue with start and due dates Chris@0: i = Issue.find(1) Chris@0: assert_not_nil i.due_date Chris@0: assert events.include?(Issue.find(1)) Chris@0: # Issue with without due date but targeted to a version with date Chris@0: i = Issue.find(2) Chris@0: assert_nil i.due_date Chris@0: assert events.include?(i) Chris@0: end Chris@0: Chris@0: should "work cross project" do Chris@0: get :show Chris@0: assert_response :success Chris@0: assert_template 'show.html.erb' Chris@0: assert_not_nil assigns(:gantt) Chris@0: events = assigns(:gantt).events Chris@0: assert_not_nil events Chris@0: end Chris@0: Chris@0: should "export to pdf" do Chris@0: get :show, :project_id => 1, :format => 'pdf' Chris@0: assert_response :success Chris@0: assert_equal 'application/pdf', @response.content_type Chris@0: assert @response.body.starts_with?('%PDF') Chris@0: assert_not_nil assigns(:gantt) Chris@0: end Chris@0: Chris@0: should "export to pdf cross project" do Chris@0: get :show, :format => 'pdf' Chris@0: assert_response :success Chris@0: assert_equal 'application/pdf', @response.content_type Chris@0: assert @response.body.starts_with?('%PDF') Chris@0: assert_not_nil assigns(:gantt) Chris@0: end Chris@0: Chris@0: should "export to png" do Chris@0: get :show, :project_id => 1, :format => 'png' Chris@0: assert_response :success Chris@0: assert_equal 'image/png', @response.content_type Chris@0: end if Object.const_defined?(:Magick) Chris@0: Chris@0: end Chris@0: end