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