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