class AuthSource < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'Auth0'
- def self.next_name
- @last_name ||= 'Auth0'
- @last_name.succ!
- @last_name
- end
end
class Board < ActiveRecord::Base
- generator_for :name, :method => :next_name
- generator_for :description, :method => :next_description
+ generator_for :name, :start => 'A Forum'
+ generator_for :description, :start => 'Some description here'
generator_for :project, :method => :generate_project
- def self.next_name
- @last_name ||= 'A Forum'
- @last_name.succ!
- @last_name
- end
-
- def self.next_description
- @last_description ||= 'Some description here'
- @last_description.succ!
- @last_description
- end
-
def self.generate_project
Project.generate!
end
class Change < ActiveRecord::Base
generator_for :action => 'A'
- generator_for :path, :method => :next_path
+ generator_for :path, :start => 'test/dir/aaa0001'
generator_for :changeset, :method => :generate_changeset
- def self.next_path
- @last_path ||= 'test/dir/aaa0001'
- @last_path.succ!
- @last_path
- end
-
def self.generate_changeset
Changeset.generate!
end
class Changeset < ActiveRecord::Base
- generator_for :revision, :method => :next_revision
+ generator_for :revision, :start => '1'
generator_for :committed_on => Date.today
generator_for :repository, :method => :generate_repository
- def self.next_revision
- @last_revision ||= '1'
- @last_revision.succ!
- @last_revision
- end
-
def self.generate_repository
Repository::Subversion.generate!
end
class CustomField < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'CustomField0'
generator_for :field_format => 'string'
- def self.next_name
- @last_name ||= 'CustomField0'
- @last_name.succ!
- @last_name
- end
end
class DocumentCategory < Enumeration
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'DocumentCategory0'
generator_for :type => 'DocumentCategory'
- def self.next_name
- @last_name ||= 'DocumentCategory0'
- @last_name.succ!
- @last_name
- end
end
class Document < ActiveRecord::Base
- generator_for :title, :method => :next_title
+ generator_for :title, :start => 'Document001'
- def self.next_title
- @last_title ||= 'Document001'
- @last_title.succ!
- @last_title
- end
end
class EnabledModule < ActiveRecord::Base
- generator_for :name, :method => :next_name
-
- def self.next_name
- @last_name ||= 'module_001'
- @last_name.succ!
- @last_name
- end
+ generator_for :name, :start => 'module_001'
end
class Enumeration < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'Enumeration0'
generator_for :type => 'TimeEntryActivity'
- def self.next_name
- @last_name ||= 'Enumeration0'
- @last_name.succ!
- @last_name
- end
end
class Group < Principal
- generator_for :lastname, :method => :next_lastname
-
- def self.next_lastname
- @last_lastname ||= 'Group'
- @last_lastname.succ!
- @last_lastname
- end
+ generator_for :lastname, :start => 'Group'
end
class IssueCategory < ActiveRecord::Base
- generator_for :name, :method => :next_name
-
- def self.next_name
- @last_name ||= 'Category 0001'
- @last_name.succ!
- @last_name
- end
+ generator_for :name, :start => 'Category 0001'
+
end
class Issue < ActiveRecord::Base
- generator_for :subject, :method => :next_subject
+ generator_for :subject, :start => 'Subject 0'
generator_for :author, :method => :next_author
generator_for :priority, :method => :fetch_priority
-
- def self.next_subject
- @last_subject ||= 'Subject 0'
- @last_subject.succ!
- @last_subject
- end
def self.next_author
User.generate_with_protected!
def self.fetch_priority
IssuePriority.first || IssuePriority.generate!
end
-
end
class IssuePriority < Enumeration
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'IssuePriority0'
generator_for :type => 'IssuePriority'
- def self.next_name
- @last_name ||= 'IssuePriority0'
- @last_name.succ!
- @last_name
- end
end
class IssueStatus < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'Status 0'
- def self.next_name
- @last_name ||= 'Status 0'
- @last_name.succ!
- @last_name
- end
end
class Message < ActiveRecord::Base
- generator_for :subject, :method => :next_subject
- generator_for :content, :method => :next_content
+ generator_for :subject, :start => 'A Message'
+ generator_for :content, :start => 'Some content here'
generator_for :board, :method => :generate_board
- def self.next_subject
- @last_subject ||= 'A Message'
- @last_subject.succ!
- @last_subject
- end
-
- def self.next_content
- @last_content ||= 'Some content here'
- @last_content.succ!
- @last_content
- end
-
def self.generate_board
Board.generate!
end
class News < ActiveRecord::Base
- generator_for :title, :method => :next_title
- generator_for :description, :method => :next_description
+ generator_for :title, :start => 'A New Item'
+ generator_for :description, :start => 'Some content here'
- def self.next_title
- @last_title ||= 'A New Item'
- @last_title.succ!
- @last_title
- end
-
- def self.next_description
- @last_description ||= 'Some content here'
- @last_description.succ!
- @last_description
- end
end
class Project < ActiveRecord::Base
- generator_for :name, :method => :next_name
- generator_for :identifier, :method => :next_identifier_from_object_daddy
+ generator_for :name, :start => 'Project 0'
+ generator_for :identifier, :start => 'project-0000'
generator_for :enabled_modules, :method => :all_modules
generator_for :trackers, :method => :next_tracker
-
- 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 ||= 'project-0000'
- @last_identifier.succ!
- @last_identifier
- end
def self.all_modules
[].tap do |modules|
class Query < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'Query 0'
- def self.next_name
- @last_name ||= 'Query 0'
- @last_name.succ!
- @last_name
- end
end
class Repository < ActiveRecord::Base
generator_for :type => 'Subversion'
- generator_for :url, :method => :next_url
-
- def self.next_url
- @last_url ||= 'file:///test/svn'
- @last_url.succ!
- @last_url
- end
+ generator_for :url, :start => 'file:///test/svn'
end
class Role < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'Role0'
- def self.next_name
- @last_name ||= 'Role0'
- @last_name.succ!
- end
end
class Repository::Subversion < Repository
generator_for :type, :method => 'Subversion'
- generator_for :url, :method => :next_url
-
- def self.next_url
- @last_url ||= 'file:///test/svn'
- @last_url.succ!
- @last_url
- end
+ generator_for :url, :start => 'file:///test/svn'
end
class TimeEntryActivity < Enumeration
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'TimeEntryActivity0'
generator_for :type => 'TimeEntryActivity'
- def self.next_name
- @last_name ||= 'TimeEntryActivity0'
- @last_name.succ!
- @last_name
- end
end
def self.generate_user
User.generate_with_protected!
end
-
end
class Tracker < ActiveRecord::Base
- generator_for :name, :method => :next_name
+ generator_for :name, :start => 'Tracker 0'
- def self.next_name
- @last_name ||= 'Tracker 0'
- @last_name.succ!
- @last_name
- end
end
class User < Principal
- generator_for :login, :method => :next_login
+ generator_for :login, :start => 'user1'
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
-
+ generator_for :firstname, :start => 'Bob'
+ generator_for :lastname, :start => 'Doe'
+
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
class Version < ActiveRecord::Base\r
- generator_for :name, :method => :next_name\r
+ generator_for :name, :start => 'Version 1.0.0'\r
generator_for :status => 'open'\r
- \r
- def self.next_name\r
- @last_name ||= 'Version 1.0.0'\r
- @last_name.succ!\r
- @last_name\r
- end\r
\r
end\r
class WikiPage < ActiveRecord::Base
- generator_for :title, :method => :next_title
+ generator_for :title, :start => 'AWikiPage'
generator_for :wiki, :method => :generate_wiki
- def self.next_title
- @last_title ||= 'AWikiPage'
- @last_title.succ!
- @last_title
- end
-
def self.generate_wiki
Wiki.generate!
end
class WikiRedirect < ActiveRecord::Base
- generator_for :title, :method => :next_title
- generator_for :redirects_to, :method => :next_redirects_to
+ generator_for :title, :start => 'AWikiPage'
+ generator_for :redirects_to, :start => '/a/path/000001'
generator_for :wiki, :method => :generate_wiki
- def self.next_title
- @last_title ||= 'AWikiPage'
- @last_title.succ!
- @last_title
- end
-
- def self.next_redirects_to
- @last_redirect ||= '/a/path/000001'
- @last_redirect.succ!
- @last_redirect
- end
-
def self.generate_wiki
Wiki.generate!
end