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