##// END OF EJS Templates
replace shoulda to Rails standard tests at functional gantts controller test...
Toshi MARUYAMA -
r9878:eb6260314400
parent child
Show More
@@ -1,95 +1,90
1 1 require File.expand_path('../../test_helper', __FILE__)
2 2
3 3 class GanttsControllerTest < ActionController::TestCase
4 4 fixtures :projects, :trackers, :issue_statuses, :issues,
5 5 :enumerations, :users, :issue_categories,
6 6 :projects_trackers,
7 7 :roles,
8 8 :member_roles,
9 9 :members,
10 10 :enabled_modules,
11 11 :workflows,
12 12 :versions
13 13
14 context "#gantt" do
15 should "work" do
14 def test_gantt_should_work
16 15 i2 = Issue.find(2)
17 16 i2.update_attribute(:due_date, 1.month.from_now)
18
19 17 get :show, :project_id => 1
20 18 assert_response :success
21 19 assert_template 'gantts/show'
22 20 assert_not_nil assigns(:gantt)
23 21 # Issue with start and due dates
24 22 i = Issue.find(1)
25 23 assert_not_nil i.due_date
26 24 assert_select "div a.issue", /##{i.id}/
27 25 # Issue with on a targeted version should not be in the events but loaded in the html
28 26 i = Issue.find(2)
29 27 assert_select "div a.issue", /##{i.id}/
30 28 end
31 29
32 should "work without issue due dates" do
30 def test_gantt_should_work_without_issue_due_dates
33 31 Issue.update_all("due_date = NULL")
34
35 32 get :show, :project_id => 1
36 33 assert_response :success
37 34 assert_template 'gantts/show'
38 35 assert_not_nil assigns(:gantt)
39 36 end
40 37
41 should "work without issue and version due dates" do
38 def test_gantt_should_work_without_issue_and_version_due_dates
42 39 Issue.update_all("due_date = NULL")
43 40 Version.update_all("effective_date = NULL")
44
45 41 get :show, :project_id => 1
46 42 assert_response :success
47 43 assert_template 'gantts/show'
48 44 assert_not_nil assigns(:gantt)
49 45 end
50 46
51 should "work cross project" do
47 def test_gantt_should_work_cross_project
52 48 get :show
53 49 assert_response :success
54 50 assert_template 'gantts/show'
55 51 assert_not_nil assigns(:gantt)
56 52 assert_not_nil assigns(:gantt).query
57 53 assert_nil assigns(:gantt).project
58 54 end
59 55
60 should "not disclose private projects" do
56 def test_gantt_should_not_disclose_private_projects
61 57 get :show
62 58 assert_response :success
63 59 assert_template 'gantts/show'
64
65 60 assert_tag 'a', :content => /eCookbook/
66 61 # Root private project
67 62 assert_no_tag 'a', {:content => /OnlineStore/}
68 63 # Private children of a public project
69 64 assert_no_tag 'a', :content => /Private child of eCookbook/
70 65 end
71 66
72 should "export to pdf" do
67 def test_gantt_should_export_to_pdf
73 68 get :show, :project_id => 1, :format => 'pdf'
74 69 assert_response :success
75 70 assert_equal 'application/pdf', @response.content_type
76 71 assert @response.body.starts_with?('%PDF')
77 72 assert_not_nil assigns(:gantt)
78 73 end
79 74
80 should "export to pdf cross project" do
75 def test_gantt_should_export_to_pdf_cross_project
81 76 get :show, :format => 'pdf'
82 77 assert_response :success
83 78 assert_equal 'application/pdf', @response.content_type
84 79 assert @response.body.starts_with?('%PDF')
85 80 assert_not_nil assigns(:gantt)
86 81 end
87 82
88 should "export to png" do
89 get :show, :project_id => 1, :format => 'png'
90 assert_response :success
91 assert_equal 'image/png', @response.content_type
92 end if Object.const_defined?(:Magick)
93
94 end
83 if Object.const_defined?(:Magick)
84 def test_gantt_should_export_to_png
85 get :show, :project_id => 1, :format => 'png'
86 assert_response :success
87 assert_equal 'image/png', @response.content_type
88 end
89 end
95 90 end
General Comments 0
You need to be logged in to leave comments. Login now