comparison test/functional/gantts_controller_test.rb @ 909:cbb26bc654de redmine-1.3

Update to Redmine 1.3-stable branch (Redmine SVN rev 8964)
author Chris Cannam
date Fri, 24 Feb 2012 19:09:32 +0000
parents 8661b858af72
children 433d4f72a19b
comparison
equal deleted inserted replaced
908:c6c2cbd0afee 909:cbb26bc654de
1 require File.expand_path('../../test_helper', __FILE__) 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 class GanttsControllerTest < ActionController::TestCase 3 class GanttsControllerTest < ActionController::TestCase
4 fixtures :all 4 fixtures :projects, :trackers, :issue_statuses, :issues,
5 :enumerations, :users, :issue_categories,
6 :projects_trackers,
7 :roles,
8 :member_roles,
9 :members,
10 :enabled_modules,
11 :workflows,
12 :versions
5 13
6 context "#gantt" do 14 context "#gantt" do
7 should "work" do 15 should "work" do
8 i2 = Issue.find(2) 16 i2 = Issue.find(2)
9 i2.update_attribute(:due_date, 1.month.from_now) 17 i2.update_attribute(:due_date, 1.month.from_now)
10 18
11 get :show, :project_id => 1 19 get :show, :project_id => 1
12 assert_response :success 20 assert_response :success
13 assert_template 'show.html.erb' 21 assert_template 'gantts/show'
14 assert_not_nil assigns(:gantt) 22 assert_not_nil assigns(:gantt)
15 # Issue with start and due dates 23 # Issue with start and due dates
16 i = Issue.find(1) 24 i = Issue.find(1)
17 assert_not_nil i.due_date 25 assert_not_nil i.due_date
18 assert_select "div a.issue", /##{i.id}/ 26 assert_select "div a.issue", /##{i.id}/
19 # Issue with on a targeted version should not be in the events but loaded in the html 27 # Issue with on a targeted version should not be in the events but loaded in the html
20 i = Issue.find(2) 28 i = Issue.find(2)
21 assert_select "div a.issue", /##{i.id}/ 29 assert_select "div a.issue", /##{i.id}/
22 end 30 end
23 31
24 should "work without issue due dates" do 32 should "work without issue due dates" do
25 Issue.update_all("due_date = NULL") 33 Issue.update_all("due_date = NULL")
26 34
27 get :show, :project_id => 1 35 get :show, :project_id => 1
28 assert_response :success 36 assert_response :success
29 assert_template 'show.html.erb' 37 assert_template 'gantts/show'
30 assert_not_nil assigns(:gantt) 38 assert_not_nil assigns(:gantt)
31 end 39 end
32 40
33 should "work without issue and version due dates" do 41 should "work without issue and version due dates" do
34 Issue.update_all("due_date = NULL") 42 Issue.update_all("due_date = NULL")
35 Version.update_all("effective_date = NULL") 43 Version.update_all("effective_date = NULL")
36 44
37 get :show, :project_id => 1 45 get :show, :project_id => 1
38 assert_response :success 46 assert_response :success
39 assert_template 'show.html.erb' 47 assert_template 'gantts/show'
40 assert_not_nil assigns(:gantt) 48 assert_not_nil assigns(:gantt)
41 end 49 end
42 50
43 should "work cross project" do 51 should "work cross project" do
44 get :show 52 get :show
45 assert_response :success 53 assert_response :success
46 assert_template 'show.html.erb' 54 assert_template 'gantts/show'
47 assert_not_nil assigns(:gantt) 55 assert_not_nil assigns(:gantt)
48 assert_not_nil assigns(:gantt).query 56 assert_not_nil assigns(:gantt).query
49 assert_nil assigns(:gantt).project 57 assert_nil assigns(:gantt).project
50 end 58 end
51 59
52 should "not disclose private projects" do 60 should "not disclose private projects" do
53 get :show 61 get :show
54 assert_response :success 62 assert_response :success
55 assert_template 'show.html.erb' 63 assert_template 'gantts/show'
56 64
57 assert_tag 'a', :content => /eCookbook/ 65 assert_tag 'a', :content => /eCookbook/
58 # Root private project 66 # Root private project
59 assert_no_tag 'a', {:content => /OnlineStore/} 67 assert_no_tag 'a', {:content => /OnlineStore/}
60 # Private children of a public project 68 # Private children of a public project
61 assert_no_tag 'a', :content => /Private child of eCookbook/ 69 assert_no_tag 'a', :content => /Private child of eCookbook/
74 assert_response :success 82 assert_response :success
75 assert_equal 'application/pdf', @response.content_type 83 assert_equal 'application/pdf', @response.content_type
76 assert @response.body.starts_with?('%PDF') 84 assert @response.body.starts_with?('%PDF')
77 assert_not_nil assigns(:gantt) 85 assert_not_nil assigns(:gantt)
78 end 86 end
79 87
80 should "export to png" do 88 should "export to png" do
81 get :show, :project_id => 1, :format => 'png' 89 get :show, :project_id => 1, :format => 'png'
82 assert_response :success 90 assert_response :success
83 assert_equal 'image/png', @response.content_type 91 assert_equal 'image/png', @response.content_type
84 end if Object.const_defined?(:Magick) 92 end if Object.const_defined?(:Magick)