comparison test/functional/gantts_controller_test.rb @ 0:513646585e45

* Import Redmine trunk SVN rev 3859
author Chris Cannam
date Fri, 23 Jul 2010 15:52:44 +0100
parents
children 1d32c0a0efbf
comparison
equal deleted inserted replaced
-1:000000000000 0:513646585e45
1 require 'test_helper'
2
3 class GanttsControllerTest < ActionController::TestCase
4 fixtures :all
5
6 context "#gantt" do
7 should "work" do
8 get :show, :project_id => 1
9 assert_response :success
10 assert_template 'show.html.erb'
11 assert_not_nil assigns(:gantt)
12 events = assigns(:gantt).events
13 assert_not_nil events
14 # Issue with start and due dates
15 i = Issue.find(1)
16 assert_not_nil i.due_date
17 assert events.include?(Issue.find(1))
18 # Issue with without due date but targeted to a version with date
19 i = Issue.find(2)
20 assert_nil i.due_date
21 assert events.include?(i)
22 end
23
24 should "work cross project" do
25 get :show
26 assert_response :success
27 assert_template 'show.html.erb'
28 assert_not_nil assigns(:gantt)
29 events = assigns(:gantt).events
30 assert_not_nil events
31 end
32
33 should "export to pdf" do
34 get :show, :project_id => 1, :format => 'pdf'
35 assert_response :success
36 assert_equal 'application/pdf', @response.content_type
37 assert @response.body.starts_with?('%PDF')
38 assert_not_nil assigns(:gantt)
39 end
40
41 should "export to pdf cross project" do
42 get :show, :format => 'pdf'
43 assert_response :success
44 assert_equal 'application/pdf', @response.content_type
45 assert @response.body.starts_with?('%PDF')
46 assert_not_nil assigns(:gantt)
47 end
48
49 should "export to png" do
50 get :show, :project_id => 1, :format => 'png'
51 assert_response :success
52 assert_equal 'image/png', @response.content_type
53 end if Object.const_defined?(:Magick)
54
55 end
56 end