code layout cleanup test/unit/lib/redmine/helpers/gantt_test.rb
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10063 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bd85428b01
commit
dadd294a25
|
@ -56,7 +56,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
end
|
||||
|
||||
context "#number_of_rows" do
|
||||
|
||||
context "with one project" do
|
||||
should "return the number of rows just for that project"
|
||||
end
|
||||
|
@ -70,12 +69,10 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
5.times do
|
||||
Issue.generate_for_project!(p)
|
||||
end
|
||||
|
||||
create_gantt(p)
|
||||
@gantt.render
|
||||
assert_equal 6, @gantt.number_of_rows
|
||||
assert !@gantt.truncated
|
||||
|
||||
create_gantt(p, :max_rows => 3)
|
||||
@gantt.render
|
||||
assert_equal 3, @gantt.number_of_rows
|
||||
|
@ -101,7 +98,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
version = Version.generate!
|
||||
@project.versions << version
|
||||
@project.issues << Issue.generate_for_project!(@project, :fixed_version => version)
|
||||
|
||||
assert_equal 3, @gantt.number_of_rows_on_project(@project)
|
||||
end
|
||||
end
|
||||
|
@ -115,7 +111,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@project.trackers << @tracker
|
||||
@version = Version.generate!(:effective_date => (today + 7), :sharing => 'none')
|
||||
@project.versions << @version
|
||||
|
||||
@issue = Issue.generate!(:fixed_version => @version,
|
||||
:subject => "gantt#line_for_project",
|
||||
:tracker => @tracker,
|
||||
|
@ -151,7 +146,9 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
|
||||
context "without assigned issues" do
|
||||
setup do
|
||||
@version = Version.generate!(:effective_date => (today + 14), :sharing => 'none', :name => 'empty_version')
|
||||
@version = Version.generate!(:effective_date => (today + 14),
|
||||
:sharing => 'none',
|
||||
:name => 'empty_version')
|
||||
@project.versions << @version
|
||||
end
|
||||
|
||||
|
@ -180,7 +177,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@shared_version = Version.generate!(:sharing => 'system')
|
||||
p.versions << @shared_version
|
||||
# Reassign the issue to a shared version of another project
|
||||
|
||||
@issue = Issue.generate!(:fixed_version => @shared_version,
|
||||
:subject => "gantt#assigned_to_shared_version",
|
||||
:tracker => @tracker,
|
||||
|
@ -200,9 +196,24 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
context "with subtasks" do
|
||||
setup do
|
||||
attrs = {:project => @project, :tracker => @tracker, :fixed_version => @version}
|
||||
@child1 = Issue.generate!(attrs.merge(:subject => 'child1', :parent_issue_id => @issue.id, :start_date => (today - 1), :due_date => (today + 2)))
|
||||
@child2 = Issue.generate!(attrs.merge(:subject => 'child2', :parent_issue_id => @issue.id, :start_date => today, :due_date => (today + 7)))
|
||||
@grandchild = Issue.generate!(attrs.merge(:subject => 'grandchild', :parent_issue_id => @child1.id, :start_date => (today - 1), :due_date => (today + 2)))
|
||||
@child1 = Issue.generate!(
|
||||
attrs.merge(:subject => 'child1',
|
||||
:parent_issue_id => @issue.id,
|
||||
:start_date => (today - 1),
|
||||
:due_date => (today + 2))
|
||||
)
|
||||
@child2 = Issue.generate!(
|
||||
attrs.merge(:subject => 'child2',
|
||||
:parent_issue_id => @issue.id,
|
||||
:start_date => today,
|
||||
:due_date => (today + 7))
|
||||
)
|
||||
@grandchild = Issue.generate!(
|
||||
attrs.merge(:subject => 'grandchild',
|
||||
:parent_issue_id => @child1.id,
|
||||
:start_date => (today - 1),
|
||||
:due_date => (today + 2))
|
||||
)
|
||||
end
|
||||
|
||||
should "indent subtasks" do
|
||||
|
@ -235,7 +246,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
:start_date => (today - 1),
|
||||
:due_date => (today + 7))
|
||||
@project.issues << @issue
|
||||
|
||||
@output_buffer = @gantt.lines
|
||||
end
|
||||
|
||||
|
@ -307,16 +317,11 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "style overdue projects" do
|
||||
@project.enabled_module_names = [:issue_tracking]
|
||||
@project.versions << Version.generate!(:effective_date => (today - 1))
|
||||
|
||||
assert @project.reload.overdue?, "Need an overdue project for this test"
|
||||
@output_buffer = @gantt.subject_for_project(@project, {:format => :html})
|
||||
|
||||
assert_select 'div span.project-overdue'
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
should "test the PNG format"
|
||||
should "test the PDF format"
|
||||
end
|
||||
|
@ -329,7 +334,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@project.trackers << @tracker
|
||||
@version = Version.generate!(:effective_date => (today - 1))
|
||||
@project.versions << @version
|
||||
|
||||
@project.issues << Issue.generate!(:fixed_version => @version,
|
||||
:subject => "gantt#line_for_project",
|
||||
:tracker => @tracker,
|
||||
|
@ -350,7 +354,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
|
||||
assert_select "div.project.task_todo[style*=width:58px]", true, @output_buffer
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "late line" do
|
||||
|
@ -381,7 +384,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "not appear if the starting point is off the gantt chart" do
|
||||
# Shift the date range of the chart
|
||||
@gantt.instance_variable_set('@date_from', today)
|
||||
|
||||
@output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
|
||||
assert_select "div.project.starting", false, @output_buffer
|
||||
end
|
||||
|
@ -396,10 +398,8 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "not appear if the starting point is off the gantt chart" do
|
||||
# Shift the date range of the chart
|
||||
@gantt.instance_variable_set('@date_to', (today - 14))
|
||||
|
||||
@output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
|
||||
assert_select "div.project.ending", false, @output_buffer
|
||||
|
||||
end
|
||||
|
||||
should "appear at the end of the date range" do
|
||||
|
@ -427,7 +427,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
should "test the PNG format"
|
||||
should "test the PDF format"
|
||||
end
|
||||
|
@ -473,14 +472,12 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "style late versions" do
|
||||
assert @version.overdue?, "Need an overdue version for this test"
|
||||
@output_buffer = @gantt.subject_for_version(@version, {:format => :html})
|
||||
|
||||
assert_select 'div span.version-behind-schedule'
|
||||
end
|
||||
|
||||
should "style behind schedule versions" do
|
||||
assert @version.behind_schedule?, "Need a behind schedule version for this test"
|
||||
@output_buffer = @gantt.subject_for_version(@version, {:format => :html})
|
||||
|
||||
assert_select 'div span.version-behind-schedule'
|
||||
end
|
||||
end
|
||||
|
@ -496,7 +493,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@project.trackers << @tracker
|
||||
@version = Version.generate!(:effective_date => (today + 7))
|
||||
@project.versions << @version
|
||||
|
||||
@project.issues << Issue.generate!(:fixed_version => @version,
|
||||
:subject => "gantt#line_for_project",
|
||||
:tracker => @tracker,
|
||||
|
@ -548,7 +544,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "not appear if the starting point is off the gantt chart" do
|
||||
# Shift the date range of the chart
|
||||
@gantt.instance_variable_set('@date_from', today)
|
||||
|
||||
@output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
|
||||
assert_select "div.version.starting", false
|
||||
end
|
||||
|
@ -563,10 +558,8 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "not appear if the starting point is off the gantt chart" do
|
||||
# Shift the date range of the chart
|
||||
@gantt.instance_variable_set('@date_to', (today - 14))
|
||||
|
||||
@output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
|
||||
assert_select "div.version.ending", false
|
||||
|
||||
end
|
||||
|
||||
should "appear at the end of the date range" do
|
||||
|
@ -578,7 +571,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
context "status content" do
|
||||
should "appear at the far left, even if it's far in the past" do
|
||||
@gantt.instance_variable_set('@date_to', (today - 14))
|
||||
|
||||
@output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
|
||||
assert_select "div.version.label", /#{@version.name}/
|
||||
end
|
||||
|
@ -594,7 +586,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
should "test the PNG format"
|
||||
should "test the PDF format"
|
||||
end
|
||||
|
@ -605,14 +596,12 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@project.enabled_module_names = [:issue_tracking]
|
||||
@tracker = Tracker.generate!
|
||||
@project.trackers << @tracker
|
||||
|
||||
@issue = Issue.generate!(:subject => "gantt#subject_for_issue",
|
||||
:tracker => @tracker,
|
||||
:project => @project,
|
||||
:start_date => (today - 3),
|
||||
:due_date => (today - 1))
|
||||
@project.issues << @issue
|
||||
|
||||
end
|
||||
|
||||
context ":html format" do
|
||||
|
@ -639,10 +628,8 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
should "style overdue issues" do
|
||||
assert @issue.overdue?, "Need an overdue issue for this test"
|
||||
@output_buffer = @gantt.subject_for_issue(@issue, {:format => :html})
|
||||
|
||||
assert_select 'div span.issue-overdue'
|
||||
end
|
||||
|
||||
end
|
||||
should "test the PNG format"
|
||||
should "test the PDF format"
|
||||
|
@ -677,7 +664,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
|
||||
assert_select "div.task_todo[style*=width:58px]", true, @output_buffer
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "late line" do
|
||||
|
@ -733,7 +719,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
context "status content" do
|
||||
should "appear at the far left, even if it's far in the past" do
|
||||
@gantt.instance_variable_set('@date_to', (today - 14))
|
||||
|
||||
@output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
|
||||
assert_select "div.task.label", true, @output_buffer
|
||||
end
|
||||
|
@ -754,7 +739,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
@output_buffer = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4})
|
||||
assert_select "div.tooltip", /#{@issue.subject}/
|
||||
end
|
||||
|
||||
should "test the PNG format"
|
||||
should "test the PDF format"
|
||||
end
|
||||
|
@ -766,5 +750,4 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
|
|||
context "#to_pdf" do
|
||||
should "be tested"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue