summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-03 19:47:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-03 19:47:20 +0000
commitb4f22b93e9f82bc925bfb2fd34a1630f70ff77ac (patch)
treeaff892d19bb2267fbe42cc7e51296eb6afe8145a /test
parentb3866b05c14bd0f1fff4c54051f522e03e2bec36 (diff)
downloadredmine-b4f22b93e9f82bc925bfb2fd34a1630f70ff77ac.tar.gz
redmine-b4f22b93e9f82bc925bfb2fd34a1630f70ff77ac.zip
Use regular create! instead of generate!
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9062 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/version_test.rb25
1 files changed, 9 insertions, 16 deletions
diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb
index 90a8cf30a..2cab5598f 100644
--- a/test/unit/version_test.rb
+++ b/test/unit/version_test.rb
@@ -110,10 +110,10 @@ class VersionTest < ActiveSupport::TestCase
context "#behind_schedule?" do
setup do
ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
- @project = Project.generate!(:identifier => 'test0')
- @project.trackers << Tracker.generate!
+ @project = Project.create!(:name => 'test0', :identifier => 'test0')
+ @project.trackers << Tracker.create!(:name => 'track')
- @version = Version.generate!(:project => @project, :effective_date => nil)
+ @version = Version.create!(:project => @project, :effective_date => nil, :name => 'version')
end
should "be false if there are no issues assigned" do
@@ -127,33 +127,26 @@ class VersionTest < ActiveSupport::TestCase
should "be false if all of the issues are ahead of schedule" do
@version.update_attribute(:effective_date, 7.days.from_now.to_date)
- @version.fixed_issues = [
- Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 60), # 14 day span, 60% done, 50% time left
- Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
- ]
+ add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
+ add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
assert_equal 60, @version.completed_pourcent
assert_equal false, @version.behind_schedule?
end
should "be true if any of the issues are behind schedule" do
@version.update_attribute(:effective_date, 7.days.from_now.to_date)
- @version.fixed_issues = [
- Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 60), # 14 day span, 60% done, 50% time left
- Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
- ]
+ add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
+ add_issue(@version, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
assert_equal 40, @version.completed_pourcent
assert_equal true, @version.behind_schedule?
end
should "be false if all of the issues are complete" do
@version.update_attribute(:effective_date, 7.days.from_now.to_date)
- @version.fixed_issues = [
- Issue.generate_for_project!(@project, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)), # 7 day span
- Issue.generate_for_project!(@project, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
- ]
+ add_issue(@version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
+ add_issue(@version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
assert_equal 100, @version.completed_pourcent
assert_equal false, @version.behind_schedule?
-
end
end