]> source.dussan.org Git - redmine.git/commitdiff
Updated object_daddy to a newer version (bugfixes)
authorEric Davis <edavis@littlestreamsoftware.com>
Mon, 8 Feb 2010 18:53:12 +0000 (18:53 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Mon, 8 Feb 2010 18:53:12 +0000 (18:53 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3398 e93f8b46-1217-0410-a6f0-8f06a7374b81

config/environments/test.rb
test/exemplars/issue_exemplar.rb
test/object_daddy_helpers.rb
test/unit/project_test.rb

index 0d1b42e5be2ff1ad148913625a4464ac13177ba4..291e80cd00d6ec24b381b470f61616cbd8d4c2f9 100644 (file)
@@ -25,5 +25,5 @@ config.action_controller.session = {
 config.action_controller.allow_forgery_protection  = false
 
 config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com"
-config.gem "nofxx-object_daddy", :lib => "object_daddy", :source => "http://gems.github.com"
+config.gem "edavis10-object_daddy", :lib => "object_daddy"
 config.gem "mocha"
index 48a92ee4ae13f7d9b6f7dadfc9a0a7987f884bd0..568f054ce03f371429dedcb6bd76d8f99140657b 100644 (file)
@@ -1,6 +1,7 @@
 class Issue < ActiveRecord::Base
   generator_for :subject, :method => :next_subject
   generator_for :author, :method => :next_author
+  generator_for :priority, :method => :fetch_priority
   
   def self.next_subject
     @last_subject ||= 'Subject 0'
@@ -12,4 +13,8 @@ class Issue < ActiveRecord::Base
     User.generate_with_protected!
   end
 
+  def self.fetch_priority
+    IssuePriority.first || IssuePriority.generate!
+  end
+
 end
index ce6e00bd7d6215ff9dccce20f91a32ad4dcf8feb..4a2b85a9e492ace17083d0f9925898532a49a879 100644 (file)
@@ -1,30 +1,16 @@
 module ObjectDaddyHelpers
-  # TODO: The gem or official version of ObjectDaddy doesn't set
-  # protected attributes so they need to be wrapped.
+  # TODO: Remove these three once everyone has ported their code to use the
+  # new object_daddy version with protected attribute support
   def User.generate_with_protected(attributes={})
-    user = User.spawn_with_protected(attributes)
-    user.save
-    user
+    User.generate(attributes)
   end
 
-  # TODO: The gem or official version of ObjectDaddy doesn't set
-  # protected attributes so they need to be wrapped.
   def User.generate_with_protected!(attributes={})
-    user = User.spawn_with_protected(attributes)
-    user.save!
-    user
+    User.generate!(attributes)
   end
 
-  # TODO: The gem or official version of ObjectDaddy doesn't set
-  # protected attributes so they need to be wrapped.
   def User.spawn_with_protected(attributes={})
-    user = User.spawn(attributes) do |user|
-      user.login = User.next_login
-      attributes.each do |attr,v|
-        user.send("#{attr}=", v)
-      end
-    end
-    user
+    User.spawn(attributes)
   end
 
   # Generate the default Query
index c1fc84330e5e39437f2275e8b2579a704b3955a0..8b8ce585f4cb6c6ed5ae4818115df9a10511d31a 100644 (file)
@@ -555,7 +555,7 @@ class ProjectTest < ActiveSupport::TestCase
     end
 
     should "copy issues" do
-      @source_project.issues << Issue.generate!(:status_id => 5,
+      @source_project.issues << Issue.generate!(:status => IssueStatus.find_by_name('Closed'),
                                                 :subject => "copy issue status",
                                                 :tracker_id => 1,
                                                 :assigned_to_id => 2,