}
config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com"
+config.gem "nofxx-object_daddy", :lib => "object_daddy", :source => "http://gems.github.com"
--- /dev/null
+class CustomField < ActiveRecord::Base
+ generator_for :name, :method => :next_name
+ generator_for :field_format => 'string'
+
+ def self.next_name
+ @last_name ||= 'CustomField0'
+ @last_name.succ!
+ @last_name
+ end
+end
--- /dev/null
+class CustomValue < ActiveRecord::Base
+end
--- /dev/null
+class Enumeration < ActiveRecord::Base
+ generator_for :name, :method => :next_name
+ generator_for :type => 'TimeEntryActivity'
+
+ def self.next_name
+ @last_name ||= 'Enumeration0'
+ @last_name.succ!
+ @last_name
+ end
+end
--- /dev/null
+class Issue < ActiveRecord::Base
+ generator_for :subject, :method => :next_subject
+ generator_for :author, :method => :next_author
+
+ def self.next_subject
+ @last_subject ||= 'Subject 0'
+ @last_subject.succ!
+ @last_subject
+ end
+
+ def self.next_author
+ User.generate_with_protected!
+ end
+
+end
--- /dev/null
+class IssueStatus < ActiveRecord::Base
+ generator_for :name, :method => :next_name
+
+ def self.next_name
+ @last_name ||= 'Status 0'
+ @last_name.succ!
+ @last_name
+ end
+end
--- /dev/null
+class Member < ActiveRecord::Base
+end
--- /dev/null
+class Project < ActiveRecord::Base
+ generator_for :name, :method => :next_name
+ generator_for :identifier, :method => :next_identifier_from_object_daddy
+
+ def self.next_name
+ @last_name ||= 'Project 0'
+ @last_name.succ!
+ @last_name
+ end
+
+ # Project#next_identifier is defined on Redmine
+ def self.next_identifier_from_object_daddy
+ @last_identifier ||= 'project0'
+ @last_identifier.succ!
+ @last_identifier
+ end
+end
--- /dev/null
+class Role < ActiveRecord::Base
+ generator_for :name, :method => :next_name
+
+ def self.next_name
+ @last_name ||= 'Role0'
+ @last_name.succ!
+ end
+end
--- /dev/null
+class TimeEntryActivity < Enumeration
+ generator_for :name, :method => :next_name
+ generator_for :type => 'TimeEntryActivity'
+
+ def self.next_name
+ @last_name ||= 'TimeEntryActivity0'
+ @last_name.succ!
+ @last_name
+ end
+end
--- /dev/null
+class TimeEntry < ActiveRecord::Base
+ generator_for(:spent_on) { Date.today }
+ generator_for(:hours) { (rand * 10).round(2) } # 0.01 to 9.99
+
+end
--- /dev/null
+class Tracker < ActiveRecord::Base
+ generator_for :name, :method => :next_name
+
+ def self.next_name
+ @last_name ||= 'Tracker 0'
+ @last_name.succ!
+ @last_name
+ end
+end
--- /dev/null
+class User < ActiveRecord::Base
+ generator_for :login, :method => :next_email
+ generator_for :mail, :method => :next_email
+ generator_for :firstname, :method => :next_firstname
+ generator_for :lastname, :method => :next_lastname
+
+ def self.next_login
+ @gen_login ||= 'user1'
+ @gen_login.succ!
+ @gen_login
+ end
+
+ def self.next_email
+ @last_email ||= 'user1'
+ @last_email.succ!
+ "#{@last_email}@example.com"
+ end
+
+ def self.next_firstname
+ @last_firstname ||= 'Bob'
+ @last_firstname.succ!
+ @last_firstname
+ end
+
+ def self.next_lastname
+ @last_lastname ||= 'Doe'
+ @last_lastname.succ!
+ @last_lastname
+ end
+end
assert true
end
+ test "Generating with object_daddy" do
+ assert_difference "IssueStatus.count" do
+ IssueStatus.generate!
+ end
+ end
+
should "work with shoulda" do
assert true
end