@@ -1,87 +1,87 | |||
|
1 | 1 | require File.expand_path('../../test_helper', __FILE__) |
|
2 | 2 | |
|
3 | 3 | class GanttsControllerTest < ActionController::TestCase |
|
4 | 4 | fixtures :all |
|
5 | 5 | |
|
6 | 6 | context "#gantt" do |
|
7 | 7 | should "work" do |
|
8 | 8 | i2 = Issue.find(2) |
|
9 | 9 | i2.update_attribute(:due_date, 1.month.from_now) |
|
10 | ||
|
10 | ||
|
11 | 11 | get :show, :project_id => 1 |
|
12 | 12 | assert_response :success |
|
13 | 13 | assert_template 'show.html.erb' |
|
14 | 14 | assert_not_nil assigns(:gantt) |
|
15 | 15 | # Issue with start and due dates |
|
16 | 16 | i = Issue.find(1) |
|
17 | 17 | assert_not_nil i.due_date |
|
18 | 18 | assert_select "div a.issue", /##{i.id}/ |
|
19 | 19 | # Issue with on a targeted version should not be in the events but loaded in the html |
|
20 | 20 | i = Issue.find(2) |
|
21 | 21 | assert_select "div a.issue", /##{i.id}/ |
|
22 | 22 | end |
|
23 | ||
|
23 | ||
|
24 | 24 | should "work without issue due dates" do |
|
25 | 25 | Issue.update_all("due_date = NULL") |
|
26 | ||
|
26 | ||
|
27 | 27 | get :show, :project_id => 1 |
|
28 | 28 | assert_response :success |
|
29 | 29 | assert_template 'show.html.erb' |
|
30 | 30 | assert_not_nil assigns(:gantt) |
|
31 | 31 | end |
|
32 | ||
|
32 | ||
|
33 | 33 | should "work without issue and version due dates" do |
|
34 | 34 | Issue.update_all("due_date = NULL") |
|
35 | 35 | Version.update_all("effective_date = NULL") |
|
36 | ||
|
36 | ||
|
37 | 37 | get :show, :project_id => 1 |
|
38 | 38 | assert_response :success |
|
39 | 39 | assert_template 'show.html.erb' |
|
40 | 40 | assert_not_nil assigns(:gantt) |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | should "work cross project" do |
|
44 | 44 | get :show |
|
45 | 45 | assert_response :success |
|
46 | 46 | assert_template 'show.html.erb' |
|
47 | 47 | assert_not_nil assigns(:gantt) |
|
48 | 48 | assert_not_nil assigns(:gantt).query |
|
49 | 49 | assert_nil assigns(:gantt).project |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | should "not disclose private projects" do |
|
53 | 53 | get :show |
|
54 | 54 | assert_response :success |
|
55 | 55 | assert_template 'show.html.erb' |
|
56 | ||
|
56 | ||
|
57 | 57 | assert_tag 'a', :content => /eCookbook/ |
|
58 | 58 | # Root private project |
|
59 | 59 | assert_no_tag 'a', {:content => /OnlineStore/} |
|
60 | 60 | # Private children of a public project |
|
61 | 61 | assert_no_tag 'a', :content => /Private child of eCookbook/ |
|
62 | 62 | end |
|
63 | 63 | |
|
64 | 64 | should "export to pdf" do |
|
65 | 65 | get :show, :project_id => 1, :format => 'pdf' |
|
66 | 66 | assert_response :success |
|
67 | 67 | assert_equal 'application/pdf', @response.content_type |
|
68 | 68 | assert @response.body.starts_with?('%PDF') |
|
69 | 69 | assert_not_nil assigns(:gantt) |
|
70 | 70 | end |
|
71 | 71 | |
|
72 | 72 | should "export to pdf cross project" do |
|
73 | 73 | get :show, :format => 'pdf' |
|
74 | 74 | assert_response :success |
|
75 | 75 | assert_equal 'application/pdf', @response.content_type |
|
76 | 76 | assert @response.body.starts_with?('%PDF') |
|
77 | 77 | assert_not_nil assigns(:gantt) |
|
78 | 78 | end |
|
79 | ||
|
79 | ||
|
80 | 80 | should "export to png" do |
|
81 | 81 | get :show, :project_id => 1, :format => 'png' |
|
82 | 82 | assert_response :success |
|
83 | 83 | assert_equal 'image/png', @response.content_type |
|
84 | 84 | end if Object.const_defined?(:Magick) |
|
85 | 85 | |
|
86 | 86 | end |
|
87 | 87 | end |
General Comments 0
You need to be logged in to leave comments.
Login now