@@ -1,56 +1,65 | |||||
1 | require File.dirname(__FILE__) + '/../test_helper' |
|
1 | require File.dirname(__FILE__) + '/../test_helper' | |
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 | ||||
|
24 | should "work without issue due dates" do | |||
|
25 | Issue.update_all("due_date = NULL") | |||
|
26 | ||||
|
27 | get :show, :project_id => 1 | |||
|
28 | assert_response :success | |||
|
29 | assert_template 'show.html.erb' | |||
|
30 | assert_not_nil assigns(:gantt) | |||
|
31 | end | |||
23 |
|
32 | |||
24 | should "work cross project" do |
|
33 | should "work cross project" do | |
25 | get :show |
|
34 | get :show | |
26 | assert_response :success |
|
35 | assert_response :success | |
27 | assert_template 'show.html.erb' |
|
36 | assert_template 'show.html.erb' | |
28 | assert_not_nil assigns(:gantt) |
|
37 | assert_not_nil assigns(:gantt) | |
29 | assert_not_nil assigns(:gantt).query |
|
38 | assert_not_nil assigns(:gantt).query | |
30 | assert_nil assigns(:gantt).project |
|
39 | assert_nil assigns(:gantt).project | |
31 | end |
|
40 | end | |
32 |
|
41 | |||
33 | should "export to pdf" do |
|
42 | should "export to pdf" do | |
34 | get :show, :project_id => 1, :format => 'pdf' |
|
43 | get :show, :project_id => 1, :format => 'pdf' | |
35 | assert_response :success |
|
44 | assert_response :success | |
36 | assert_equal 'application/pdf', @response.content_type |
|
45 | assert_equal 'application/pdf', @response.content_type | |
37 | assert @response.body.starts_with?('%PDF') |
|
46 | assert @response.body.starts_with?('%PDF') | |
38 | assert_not_nil assigns(:gantt) |
|
47 | assert_not_nil assigns(:gantt) | |
39 | end |
|
48 | end | |
40 |
|
49 | |||
41 | should "export to pdf cross project" do |
|
50 | should "export to pdf cross project" do | |
42 | get :show, :format => 'pdf' |
|
51 | get :show, :format => 'pdf' | |
43 | assert_response :success |
|
52 | assert_response :success | |
44 | assert_equal 'application/pdf', @response.content_type |
|
53 | assert_equal 'application/pdf', @response.content_type | |
45 | assert @response.body.starts_with?('%PDF') |
|
54 | assert @response.body.starts_with?('%PDF') | |
46 | assert_not_nil assigns(:gantt) |
|
55 | assert_not_nil assigns(:gantt) | |
47 | end |
|
56 | end | |
48 |
|
57 | |||
49 | should "export to png" do |
|
58 | should "export to png" do | |
50 | get :show, :project_id => 1, :format => 'png' |
|
59 | get :show, :project_id => 1, :format => 'png' | |
51 | assert_response :success |
|
60 | assert_response :success | |
52 | assert_equal 'image/png', @response.content_type |
|
61 | assert_equal 'image/png', @response.content_type | |
53 | end if Object.const_defined?(:Magick) |
|
62 | end if Object.const_defined?(:Magick) | |
54 |
|
63 | |||
55 | end |
|
64 | end | |
56 | end |
|
65 | end |
General Comments 0
You need to be logged in to leave comments.
Login now