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"
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'
User.generate_with_protected!
end
+ def self.fetch_priority
+ IssuePriority.first || IssuePriority.generate!
+ end
+
end
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
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,