Mercurial > hg > soundsoftware-site
comparison test/unit/lib/redmine/helpers/gantt_test.rb @ 22:40f7cfd4df19
* Update to SVN trunk rev 4173
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 24 Sep 2010 14:06:04 +0100 |
parents | |
children | af80e5618e9b |
comparison
equal
deleted
inserted
replaced
14:1d32c0a0efbf | 22:40f7cfd4df19 |
---|---|
1 # redMine - project management software | |
2 # Copyright (C) 2006-2008 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require File.dirname(__FILE__) + '/../../../../test_helper' | |
19 | |
20 class Redmine::Helpers::GanttTest < ActiveSupport::TestCase | |
21 # Utility methods and classes so assert_select can be used. | |
22 class GanttViewTest < ActionView::Base | |
23 include ActionView::Helpers::UrlHelper | |
24 include ActionView::Helpers::TextHelper | |
25 include ActionController::UrlWriter | |
26 include ApplicationHelper | |
27 include ProjectsHelper | |
28 include IssuesHelper | |
29 | |
30 def self.default_url_options | |
31 {:only_path => true } | |
32 end | |
33 | |
34 end | |
35 | |
36 include ActionController::Assertions::SelectorAssertions | |
37 | |
38 def setup | |
39 @response = ActionController::TestResponse.new | |
40 # Fixtures | |
41 ProjectCustomField.delete_all | |
42 Project.destroy_all | |
43 | |
44 User.current = User.find(1) | |
45 end | |
46 | |
47 def build_view | |
48 @view = GanttViewTest.new | |
49 end | |
50 | |
51 def html_document | |
52 HTML::Document.new(@response.body) | |
53 end | |
54 | |
55 # Creates a Gantt chart for a 4 week span | |
56 def create_gantt(project=Project.generate!) | |
57 @project = project | |
58 @gantt = Redmine::Helpers::Gantt.new | |
59 @gantt.project = @project | |
60 @gantt.query = Query.generate_default!(:project => @project) | |
61 @gantt.view = build_view | |
62 @gantt.instance_variable_set('@date_from', 2.weeks.ago.to_date) | |
63 @gantt.instance_variable_set('@date_to', 2.weeks.from_now.to_date) | |
64 end | |
65 | |
66 context "#number_of_rows" do | |
67 | |
68 context "with one project" do | |
69 should "return the number of rows just for that project" | |
70 end | |
71 | |
72 context "with no project" do | |
73 should "return the total number of rows for all the projects, resursively" | |
74 end | |
75 | |
76 end | |
77 | |
78 context "#number_of_rows_on_project" do | |
79 setup do | |
80 create_gantt | |
81 end | |
82 | |
83 should "clear the @query.project so cross-project issues and versions can be counted" do | |
84 assert @gantt.query.project | |
85 @gantt.number_of_rows_on_project(@project) | |
86 assert_nil @gantt.query.project | |
87 end | |
88 | |
89 should "count 1 for the project itself" do | |
90 assert_equal 1, @gantt.number_of_rows_on_project(@project) | |
91 end | |
92 | |
93 should "count the number of issues without a version" do | |
94 @project.issues << Issue.generate_for_project!(@project, :fixed_version => nil) | |
95 assert_equal 2, @gantt.number_of_rows_on_project(@project) | |
96 end | |
97 | |
98 should "count the number of versions" do | |
99 @project.versions << Version.generate! | |
100 @project.versions << Version.generate! | |
101 assert_equal 3, @gantt.number_of_rows_on_project(@project) | |
102 end | |
103 | |
104 should "count the number of issues on versions, including cross-project" do | |
105 version = Version.generate! | |
106 @project.versions << version | |
107 @project.issues << Issue.generate_for_project!(@project, :fixed_version => version) | |
108 | |
109 assert_equal 3, @gantt.number_of_rows_on_project(@project) | |
110 end | |
111 | |
112 should "recursive and count the number of rows on each subproject" do | |
113 @project.versions << Version.generate! # +1 | |
114 | |
115 @subproject = Project.generate!(:enabled_module_names => ['issue_tracking']) # +1 | |
116 @subproject.set_parent!(@project) | |
117 @subproject.issues << Issue.generate_for_project!(@subproject) # +1 | |
118 @subproject.issues << Issue.generate_for_project!(@subproject) # +1 | |
119 | |
120 @subsubproject = Project.generate!(:enabled_module_names => ['issue_tracking']) # +1 | |
121 @subsubproject.set_parent!(@subproject) | |
122 @subsubproject.issues << Issue.generate_for_project!(@subsubproject) # +1 | |
123 | |
124 assert_equal 7, @gantt.number_of_rows_on_project(@project) # +1 for self | |
125 end | |
126 end | |
127 | |
128 # TODO: more of an integration test | |
129 context "#subjects" do | |
130 setup do | |
131 create_gantt | |
132 @project.enabled_module_names = [:issue_tracking] | |
133 @tracker = Tracker.generate! | |
134 @project.trackers << @tracker | |
135 @version = Version.generate!(:effective_date => 1.week.from_now.to_date, :sharing => 'none') | |
136 @project.versions << @version | |
137 | |
138 @issue = Issue.generate!(:fixed_version => @version, | |
139 :subject => "gantt#line_for_project", | |
140 :tracker => @tracker, | |
141 :project => @project, | |
142 :done_ratio => 30, | |
143 :start_date => Date.yesterday, | |
144 :due_date => 1.week.from_now.to_date) | |
145 @project.issues << @issue | |
146 | |
147 @response.body = @gantt.subjects | |
148 end | |
149 | |
150 context "project" do | |
151 should "be rendered" do | |
152 assert_select "div.project-name a", /#{@project.name}/ | |
153 end | |
154 | |
155 should "have an indent of 4" do | |
156 assert_select "div.project-name[style*=left:4px]" | |
157 end | |
158 end | |
159 | |
160 context "version" do | |
161 should "be rendered" do | |
162 assert_select "div.version-name a", /#{@version.name}/ | |
163 end | |
164 | |
165 should "be indented 24 (one level)" do | |
166 assert_select "div.version-name[style*=left:24px]" | |
167 end | |
168 end | |
169 | |
170 context "issue" do | |
171 should "be rendered" do | |
172 assert_select "div.issue-subject", /#{@issue.subject}/ | |
173 end | |
174 | |
175 should "be indented 44 (two levels)" do | |
176 assert_select "div.issue-subject[style*=left:44px]" | |
177 end | |
178 end | |
179 end | |
180 | |
181 context "#lines" do | |
182 setup do | |
183 create_gantt | |
184 @project.enabled_module_names = [:issue_tracking] | |
185 @tracker = Tracker.generate! | |
186 @project.trackers << @tracker | |
187 @version = Version.generate!(:effective_date => 1.week.from_now.to_date) | |
188 @project.versions << @version | |
189 @issue = Issue.generate!(:fixed_version => @version, | |
190 :subject => "gantt#line_for_project", | |
191 :tracker => @tracker, | |
192 :project => @project, | |
193 :done_ratio => 30, | |
194 :start_date => Date.yesterday, | |
195 :due_date => 1.week.from_now.to_date) | |
196 @project.issues << @issue | |
197 | |
198 @response.body = @gantt.lines | |
199 end | |
200 | |
201 context "project" do | |
202 should "be rendered" do | |
203 assert_select "div.project_todo" | |
204 assert_select "div.project-line.starting" | |
205 assert_select "div.project-line.ending" | |
206 assert_select "div.label.project-name", /#{@project.name}/ | |
207 end | |
208 end | |
209 | |
210 context "version" do | |
211 should "be rendered" do | |
212 assert_select "div.milestone_todo" | |
213 assert_select "div.milestone.starting" | |
214 assert_select "div.milestone.ending" | |
215 assert_select "div.label.version-name", /#{@version.name}/ | |
216 end | |
217 end | |
218 | |
219 context "issue" do | |
220 should "be rendered" do | |
221 assert_select "div.task_todo" | |
222 assert_select "div.label.issue-name", /#{@issue.done_ratio}/ | |
223 assert_select "div.tooltip", /#{@issue.subject}/ | |
224 end | |
225 end | |
226 end | |
227 | |
228 context "#render_project" do | |
229 should "be tested" | |
230 end | |
231 | |
232 context "#render_issues" do | |
233 should "be tested" | |
234 end | |
235 | |
236 context "#render_version" do | |
237 should "be tested" | |
238 end | |
239 | |
240 context "#subject_for_project" do | |
241 setup do | |
242 create_gantt | |
243 end | |
244 | |
245 context ":html format" do | |
246 should "add an absolute positioned div" do | |
247 @response.body = @gantt.subject_for_project(@project, {:format => :html}) | |
248 assert_select "div[style*=absolute]" | |
249 end | |
250 | |
251 should "use the indent option to move the div to the right" do | |
252 @response.body = @gantt.subject_for_project(@project, {:format => :html, :indent => 40}) | |
253 assert_select "div[style*=left:40]" | |
254 end | |
255 | |
256 should "include the project name" do | |
257 @response.body = @gantt.subject_for_project(@project, {:format => :html}) | |
258 assert_select 'div', :text => /#{@project.name}/ | |
259 end | |
260 | |
261 should "include a link to the project" do | |
262 @response.body = @gantt.subject_for_project(@project, {:format => :html}) | |
263 assert_select 'a[href=?]', "/projects/#{@project.identifier}", :text => /#{@project.name}/ | |
264 end | |
265 | |
266 should "style overdue projects" do | |
267 @project.enabled_module_names = [:issue_tracking] | |
268 @project.versions << Version.generate!(:effective_date => Date.yesterday) | |
269 | |
270 assert @project.overdue?, "Need an overdue project for this test" | |
271 @response.body = @gantt.subject_for_project(@project, {:format => :html}) | |
272 | |
273 assert_select 'div span.project-overdue' | |
274 end | |
275 | |
276 | |
277 end | |
278 | |
279 should "test the PNG format" | |
280 should "test the PDF format" | |
281 end | |
282 | |
283 context "#line_for_project" do | |
284 setup do | |
285 create_gantt | |
286 @project.enabled_module_names = [:issue_tracking] | |
287 @tracker = Tracker.generate! | |
288 @project.trackers << @tracker | |
289 @version = Version.generate!(:effective_date => Date.yesterday) | |
290 @project.versions << @version | |
291 | |
292 @project.issues << Issue.generate!(:fixed_version => @version, | |
293 :subject => "gantt#line_for_project", | |
294 :tracker => @tracker, | |
295 :project => @project, | |
296 :done_ratio => 30, | |
297 :start_date => Date.yesterday, | |
298 :due_date => 1.week.from_now.to_date) | |
299 end | |
300 | |
301 context ":html format" do | |
302 context "todo line" do | |
303 should "start from the starting point on the left" do | |
304 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
305 assert_select "div.project_todo[style*=left:52px]" | |
306 end | |
307 | |
308 should "be the total width of the project" do | |
309 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
310 assert_select "div.project_todo[style*=width:31px]" | |
311 end | |
312 | |
313 end | |
314 | |
315 context "late line" do | |
316 should "start from the starting point on the left" do | |
317 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
318 assert_select "div.project_late[style*=left:52px]" | |
319 end | |
320 | |
321 should "be the total delayed width of the project" do | |
322 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
323 assert_select "div.project_late[style*=width:6px]" | |
324 end | |
325 end | |
326 | |
327 context "done line" do | |
328 should "start from the starting point on the left" do | |
329 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
330 assert_select "div.project_done[style*=left:52px]" | |
331 end | |
332 | |
333 should "Be the total done width of the project" do | |
334 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
335 assert_select "div.project_done[style*=left:52px]" | |
336 end | |
337 end | |
338 | |
339 context "starting marker" do | |
340 should "not appear if the starting point is off the gantt chart" do | |
341 # Shift the date range of the chart | |
342 @gantt.instance_variable_set('@date_from', Date.today) | |
343 | |
344 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
345 assert_select "div.project-line.starting", false | |
346 end | |
347 | |
348 should "appear at the starting point" do | |
349 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
350 assert_select "div.project-line.starting[style*=left:52px]" | |
351 end | |
352 end | |
353 | |
354 context "ending marker" do | |
355 should "not appear if the starting point is off the gantt chart" do | |
356 # Shift the date range of the chart | |
357 @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
358 | |
359 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
360 assert_select "div.project-line.ending", false | |
361 | |
362 end | |
363 | |
364 should "appear at the end of the date range" do | |
365 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
366 assert_select "div.project-line.ending[style*=left:84px]" | |
367 end | |
368 end | |
369 | |
370 context "status content" do | |
371 should "appear at the far left, even if it's far in the past" do | |
372 @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
373 | |
374 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
375 assert_select "div.project-name", /#{@project.name}/ | |
376 end | |
377 | |
378 should "show the project name" do | |
379 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
380 assert_select "div.project-name", /#{@project.name}/ | |
381 end | |
382 | |
383 should "show the percent complete" do | |
384 @response.body = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) | |
385 assert_select "div.project-name", /0%/ | |
386 end | |
387 end | |
388 end | |
389 | |
390 should "test the PNG format" | |
391 should "test the PDF format" | |
392 end | |
393 | |
394 context "#subject_for_version" do | |
395 setup do | |
396 create_gantt | |
397 @project.enabled_module_names = [:issue_tracking] | |
398 @tracker = Tracker.generate! | |
399 @project.trackers << @tracker | |
400 @version = Version.generate!(:effective_date => Date.yesterday) | |
401 @project.versions << @version | |
402 | |
403 @project.issues << Issue.generate!(:fixed_version => @version, | |
404 :subject => "gantt#subject_for_version", | |
405 :tracker => @tracker, | |
406 :project => @project, | |
407 :start_date => Date.today) | |
408 | |
409 end | |
410 | |
411 context ":html format" do | |
412 should "add an absolute positioned div" do | |
413 @response.body = @gantt.subject_for_version(@version, {:format => :html}) | |
414 assert_select "div[style*=absolute]" | |
415 end | |
416 | |
417 should "use the indent option to move the div to the right" do | |
418 @response.body = @gantt.subject_for_version(@version, {:format => :html, :indent => 40}) | |
419 assert_select "div[style*=left:40]" | |
420 end | |
421 | |
422 should "include the version name" do | |
423 @response.body = @gantt.subject_for_version(@version, {:format => :html}) | |
424 assert_select 'div', :text => /#{@version.name}/ | |
425 end | |
426 | |
427 should "include a link to the version" do | |
428 @response.body = @gantt.subject_for_version(@version, {:format => :html}) | |
429 assert_select 'a[href=?]', Regexp.escape("/versions/show/#{@version.to_param}"), :text => /#{@version.name}/ | |
430 end | |
431 | |
432 should "style late versions" do | |
433 assert @version.overdue?, "Need an overdue version for this test" | |
434 @response.body = @gantt.subject_for_version(@version, {:format => :html}) | |
435 | |
436 assert_select 'div span.version-behind-schedule' | |
437 end | |
438 | |
439 should "style behind schedule versions" do | |
440 assert @version.behind_schedule?, "Need a behind schedule version for this test" | |
441 @response.body = @gantt.subject_for_version(@version, {:format => :html}) | |
442 | |
443 assert_select 'div span.version-behind-schedule' | |
444 end | |
445 end | |
446 should "test the PNG format" | |
447 should "test the PDF format" | |
448 end | |
449 | |
450 context "#line_for_version" do | |
451 setup do | |
452 create_gantt | |
453 @project.enabled_module_names = [:issue_tracking] | |
454 @tracker = Tracker.generate! | |
455 @project.trackers << @tracker | |
456 @version = Version.generate!(:effective_date => 1.week.from_now.to_date) | |
457 @project.versions << @version | |
458 | |
459 @project.issues << Issue.generate!(:fixed_version => @version, | |
460 :subject => "gantt#line_for_project", | |
461 :tracker => @tracker, | |
462 :project => @project, | |
463 :done_ratio => 30, | |
464 :start_date => Date.yesterday, | |
465 :due_date => 1.week.from_now.to_date) | |
466 end | |
467 | |
468 context ":html format" do | |
469 context "todo line" do | |
470 should "start from the starting point on the left" do | |
471 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
472 assert_select "div.milestone_todo[style*=left:52px]" | |
473 end | |
474 | |
475 should "be the total width of the version" do | |
476 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
477 assert_select "div.milestone_todo[style*=width:31px]" | |
478 end | |
479 | |
480 end | |
481 | |
482 context "late line" do | |
483 should "start from the starting point on the left" do | |
484 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
485 assert_select "div.milestone_late[style*=left:52px]" | |
486 end | |
487 | |
488 should "be the total delayed width of the version" do | |
489 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
490 assert_select "div.milestone_late[style*=width:6px]" | |
491 end | |
492 end | |
493 | |
494 context "done line" do | |
495 should "start from the starting point on the left" do | |
496 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
497 assert_select "div.milestone_done[style*=left:52px]" | |
498 end | |
499 | |
500 should "Be the total done width of the version" do | |
501 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
502 assert_select "div.milestone_done[style*=left:52px]" | |
503 end | |
504 end | |
505 | |
506 context "starting marker" do | |
507 should "not appear if the starting point is off the gantt chart" do | |
508 # Shift the date range of the chart | |
509 @gantt.instance_variable_set('@date_from', Date.today) | |
510 | |
511 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
512 assert_select "div.milestone.starting", false | |
513 end | |
514 | |
515 should "appear at the starting point" do | |
516 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
517 assert_select "div.milestone.starting[style*=left:52px]" | |
518 end | |
519 end | |
520 | |
521 context "ending marker" do | |
522 should "not appear if the starting point is off the gantt chart" do | |
523 # Shift the date range of the chart | |
524 @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
525 | |
526 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
527 assert_select "div.milestone.ending", false | |
528 | |
529 end | |
530 | |
531 should "appear at the end of the date range" do | |
532 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
533 assert_select "div.milestone.ending[style*=left:84px]" | |
534 end | |
535 end | |
536 | |
537 context "status content" do | |
538 should "appear at the far left, even if it's far in the past" do | |
539 @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
540 | |
541 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
542 assert_select "div.version-name", /#{@version.name}/ | |
543 end | |
544 | |
545 should "show the version name" do | |
546 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
547 assert_select "div.version-name", /#{@version.name}/ | |
548 end | |
549 | |
550 should "show the percent complete" do | |
551 @response.body = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) | |
552 assert_select "div.version-name", /30%/ | |
553 end | |
554 end | |
555 end | |
556 | |
557 should "test the PNG format" | |
558 should "test the PDF format" | |
559 end | |
560 | |
561 context "#subject_for_issue" do | |
562 setup do | |
563 create_gantt | |
564 @project.enabled_module_names = [:issue_tracking] | |
565 @tracker = Tracker.generate! | |
566 @project.trackers << @tracker | |
567 | |
568 @issue = Issue.generate!(:subject => "gantt#subject_for_issue", | |
569 :tracker => @tracker, | |
570 :project => @project, | |
571 :start_date => 3.days.ago.to_date, | |
572 :due_date => Date.yesterday) | |
573 @project.issues << @issue | |
574 | |
575 end | |
576 | |
577 context ":html format" do | |
578 should "add an absolute positioned div" do | |
579 @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) | |
580 assert_select "div[style*=absolute]" | |
581 end | |
582 | |
583 should "use the indent option to move the div to the right" do | |
584 @response.body = @gantt.subject_for_issue(@issue, {:format => :html, :indent => 40}) | |
585 assert_select "div[style*=left:40]" | |
586 end | |
587 | |
588 should "include the issue subject" do | |
589 @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) | |
590 assert_select 'div', :text => /#{@issue.subject}/ | |
591 end | |
592 | |
593 should "include a link to the issue" do | |
594 @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) | |
595 assert_select 'a[href=?]', Regexp.escape("/issues/#{@issue.to_param}"), :text => /#{@tracker.name} ##{@issue.id}/ | |
596 end | |
597 | |
598 should "style overdue issues" do | |
599 assert @issue.overdue?, "Need an overdue issue for this test" | |
600 @response.body = @gantt.subject_for_issue(@issue, {:format => :html}) | |
601 | |
602 assert_select 'div span.issue-overdue' | |
603 end | |
604 | |
605 end | |
606 should "test the PNG format" | |
607 should "test the PDF format" | |
608 end | |
609 | |
610 context "#line_for_issue" do | |
611 setup do | |
612 create_gantt | |
613 @project.enabled_module_names = [:issue_tracking] | |
614 @tracker = Tracker.generate! | |
615 @project.trackers << @tracker | |
616 @version = Version.generate!(:effective_date => 1.week.from_now.to_date) | |
617 @project.versions << @version | |
618 @issue = Issue.generate!(:fixed_version => @version, | |
619 :subject => "gantt#line_for_project", | |
620 :tracker => @tracker, | |
621 :project => @project, | |
622 :done_ratio => 30, | |
623 :start_date => Date.yesterday, | |
624 :due_date => 1.week.from_now.to_date) | |
625 @project.issues << @issue | |
626 end | |
627 | |
628 context ":html format" do | |
629 context "todo line" do | |
630 should "start from the starting point on the left" do | |
631 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
632 assert_select "div.task_todo[style*=left:52px]" | |
633 end | |
634 | |
635 should "be the total width of the issue" do | |
636 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
637 assert_select "div.task_todo[style*=width:34px]" | |
638 end | |
639 | |
640 end | |
641 | |
642 context "late line" do | |
643 should "start from the starting point on the left" do | |
644 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
645 assert_select "div.task_late[style*=left:52px]" | |
646 end | |
647 | |
648 should "be the total delayed width of the issue" do | |
649 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
650 assert_select "div.task_late[style*=width:6px]" | |
651 end | |
652 end | |
653 | |
654 context "done line" do | |
655 should "start from the starting point on the left" do | |
656 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
657 assert_select "div.task_done[style*=left:52px]" | |
658 end | |
659 | |
660 should "Be the total done width of the issue" do | |
661 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
662 assert_select "div.task_done[style*=left:52px]" | |
663 end | |
664 end | |
665 | |
666 context "status content" do | |
667 should "appear at the far left, even if it's far in the past" do | |
668 @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) | |
669 | |
670 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
671 assert_select "div.issue-name" | |
672 end | |
673 | |
674 should "show the issue status" do | |
675 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
676 assert_select "div.issue-name", /#{@issue.status.name}/ | |
677 end | |
678 | |
679 should "show the percent complete" do | |
680 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
681 assert_select "div.issue-name", /30%/ | |
682 end | |
683 end | |
684 end | |
685 | |
686 should "have an issue tooltip" do | |
687 @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) | |
688 assert_select "div.tooltip", /#{@issue.subject}/ | |
689 end | |
690 | |
691 should "test the PNG format" | |
692 should "test the PDF format" | |
693 end | |
694 | |
695 context "#to_image" do | |
696 should "be tested" | |
697 end | |
698 | |
699 context "#to_pdf" do | |
700 should "be tested" | |
701 end | |
702 | |
703 end |