Make sure that "today" does not change during tests.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9557 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-04-27 23:53:34 +00:00
parent c7d78ef094
commit f12942ff40
1 changed files with 13 additions and 13 deletions

View File

@ -121,7 +121,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
:tracker => @tracker, :tracker => @tracker,
:project => @project, :project => @project,
:done_ratio => 30, :done_ratio => 30,
:start_date => Date.yesterday, :start_date => (today - 1),
:due_date => (today + 7)) :due_date => (today + 7))
@project.issues << @issue @project.issues << @issue
end end
@ -186,7 +186,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
:tracker => @tracker, :tracker => @tracker,
:project => @project, :project => @project,
:done_ratio => 30, :done_ratio => 30,
:start_date => Date.yesterday, :start_date => (today - 1),
:due_date => (today + 7)) :due_date => (today + 7))
@project.issues << @issue @project.issues << @issue
end end
@ -200,9 +200,9 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
context "with subtasks" do context "with subtasks" do
setup do setup do
attrs = {:project => @project, :tracker => @tracker, :fixed_version => @version} attrs = {:project => @project, :tracker => @tracker, :fixed_version => @version}
@child1 = Issue.generate!(attrs.merge(:subject => 'child1', :parent_issue_id => @issue.id, :start_date => Date.yesterday, :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 => Date.today, :due_date => (today + 7))) @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 => Date.yesterday, :due_date => (today + 2))) @grandchild = Issue.generate!(attrs.merge(:subject => 'grandchild', :parent_issue_id => @child1.id, :start_date => (today - 1), :due_date => (today + 2)))
end end
should "indent subtasks" do should "indent subtasks" do
@ -232,7 +232,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
:tracker => @tracker, :tracker => @tracker,
:project => @project, :project => @project,
:done_ratio => 30, :done_ratio => 30,
:start_date => Date.yesterday, :start_date => (today - 1),
:due_date => (today + 7)) :due_date => (today + 7))
@project.issues << @issue @project.issues << @issue
@ -306,7 +306,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
should "style overdue projects" do should "style overdue projects" do
@project.enabled_module_names = [:issue_tracking] @project.enabled_module_names = [:issue_tracking]
@project.versions << Version.generate!(:effective_date => Date.yesterday) @project.versions << Version.generate!(:effective_date => (today - 1))
assert @project.reload.overdue?, "Need an overdue project for this test" assert @project.reload.overdue?, "Need an overdue project for this test"
@output_buffer = @gantt.subject_for_project(@project, {:format => :html}) @output_buffer = @gantt.subject_for_project(@project, {:format => :html})
@ -327,7 +327,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
@project.enabled_module_names = [:issue_tracking] @project.enabled_module_names = [:issue_tracking]
@tracker = Tracker.generate! @tracker = Tracker.generate!
@project.trackers << @tracker @project.trackers << @tracker
@version = Version.generate!(:effective_date => Date.yesterday) @version = Version.generate!(:effective_date => (today - 1))
@project.versions << @version @project.versions << @version
@project.issues << Issue.generate!(:fixed_version => @version, @project.issues << Issue.generate!(:fixed_version => @version,
@ -380,7 +380,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
context "starting marker" do context "starting marker" do
should "not appear if the starting point is off the gantt chart" do should "not appear if the starting point is off the gantt chart" do
# Shift the date range of the chart # Shift the date range of the chart
@gantt.instance_variable_set('@date_from', Date.today) @gantt.instance_variable_set('@date_from', today)
@output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4}) @output_buffer = @gantt.line_for_project(@project, {:format => :html, :zoom => 4})
assert_select "div.project.starting", false, @output_buffer assert_select "div.project.starting", false, @output_buffer
@ -438,14 +438,14 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
@project.enabled_module_names = [:issue_tracking] @project.enabled_module_names = [:issue_tracking]
@tracker = Tracker.generate! @tracker = Tracker.generate!
@project.trackers << @tracker @project.trackers << @tracker
@version = Version.generate!(:effective_date => Date.yesterday) @version = Version.generate!(:effective_date => (today - 1))
@project.versions << @version @project.versions << @version
@project.issues << Issue.generate!(:fixed_version => @version, @project.issues << Issue.generate!(:fixed_version => @version,
:subject => "gantt#subject_for_version", :subject => "gantt#subject_for_version",
:tracker => @tracker, :tracker => @tracker,
:project => @project, :project => @project,
:start_date => Date.today) :start_date => today)
end end
@ -547,7 +547,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
context "starting marker" do context "starting marker" do
should "not appear if the starting point is off the gantt chart" do should "not appear if the starting point is off the gantt chart" do
# Shift the date range of the chart # Shift the date range of the chart
@gantt.instance_variable_set('@date_from', Date.today) @gantt.instance_variable_set('@date_from', today)
@output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4}) @output_buffer = @gantt.line_for_version(@version, {:format => :html, :zoom => 4})
assert_select "div.version.starting", false assert_select "div.version.starting", false
@ -610,7 +610,7 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
:tracker => @tracker, :tracker => @tracker,
:project => @project, :project => @project,
:start_date => (today - 3), :start_date => (today - 3),
:due_date => Date.yesterday) :due_date => (today - 1))
@project.issues << @issue @project.issues << @issue
end end