Cleanup test exemplars and fix subsequent @#generate@ calls generating same values (#7613).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7458 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Etienne Massip 2011-09-22 20:51:42 +00:00
parent 4ac5a2c338
commit 189b316016
28 changed files with 36 additions and 229 deletions

View File

@ -1,9 +1,4 @@
class AuthSource < ActiveRecord::Base 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 end

View File

@ -1,20 +1,8 @@
class Board < ActiveRecord::Base class Board < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'A Forum'
generator_for :description, :method => :next_description generator_for :description, :start => 'Some description here'
generator_for :project, :method => :generate_project 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 def self.generate_project
Project.generate! Project.generate!
end end

View File

@ -1,14 +1,8 @@
class Change < ActiveRecord::Base class Change < ActiveRecord::Base
generator_for :action => 'A' generator_for :action => 'A'
generator_for :path, :method => :next_path generator_for :path, :start => 'test/dir/aaa0001'
generator_for :changeset, :method => :generate_changeset 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 def self.generate_changeset
Changeset.generate! Changeset.generate!
end end

View File

@ -1,14 +1,8 @@
class Changeset < ActiveRecord::Base class Changeset < ActiveRecord::Base
generator_for :revision, :method => :next_revision generator_for :revision, :start => '1'
generator_for :committed_on => Date.today generator_for :committed_on => Date.today
generator_for :repository, :method => :generate_repository generator_for :repository, :method => :generate_repository
def self.next_revision
@last_revision ||= '1'
@last_revision.succ!
@last_revision
end
def self.generate_repository def self.generate_repository
Repository::Subversion.generate! Repository::Subversion.generate!
end end

View File

@ -1,10 +1,5 @@
class CustomField < ActiveRecord::Base class CustomField < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'CustomField0'
generator_for :field_format => 'string' generator_for :field_format => 'string'
def self.next_name
@last_name ||= 'CustomField0'
@last_name.succ!
@last_name
end
end end

View File

@ -1,10 +1,5 @@
class DocumentCategory < Enumeration class DocumentCategory < Enumeration
generator_for :name, :method => :next_name generator_for :name, :start => 'DocumentCategory0'
generator_for :type => 'DocumentCategory' generator_for :type => 'DocumentCategory'
def self.next_name
@last_name ||= 'DocumentCategory0'
@last_name.succ!
@last_name
end
end end

View File

@ -1,9 +1,4 @@
class Document < ActiveRecord::Base 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 end

View File

@ -1,10 +1,4 @@
class EnabledModule < ActiveRecord::Base class EnabledModule < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'module_001'
def self.next_name
@last_name ||= 'module_001'
@last_name.succ!
@last_name
end
end end

View File

@ -1,10 +1,5 @@
class Enumeration < ActiveRecord::Base class Enumeration < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'Enumeration0'
generator_for :type => 'TimeEntryActivity' generator_for :type => 'TimeEntryActivity'
def self.next_name
@last_name ||= 'Enumeration0'
@last_name.succ!
@last_name
end
end end

View File

@ -1,10 +1,4 @@
class Group < Principal class Group < Principal
generator_for :lastname, :method => :next_lastname generator_for :lastname, :start => 'Group'
def self.next_lastname
@last_lastname ||= 'Group'
@last_lastname.succ!
@last_lastname
end
end end

View File

@ -1,9 +1,4 @@
class IssueCategory < ActiveRecord::Base class IssueCategory < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'Category 0001'
def self.next_name
@last_name ||= 'Category 0001'
@last_name.succ!
@last_name
end
end end

View File

@ -1,13 +1,7 @@
class Issue < ActiveRecord::Base class Issue < ActiveRecord::Base
generator_for :subject, :method => :next_subject generator_for :subject, :start => 'Subject 0'
generator_for :author, :method => :next_author generator_for :author, :method => :next_author
generator_for :priority, :method => :fetch_priority generator_for :priority, :method => :fetch_priority
def self.next_subject
@last_subject ||= 'Subject 0'
@last_subject.succ!
@last_subject
end
def self.next_author def self.next_author
User.generate_with_protected! User.generate_with_protected!
@ -16,5 +10,4 @@ class Issue < ActiveRecord::Base
def self.fetch_priority def self.fetch_priority
IssuePriority.first || IssuePriority.generate! IssuePriority.first || IssuePriority.generate!
end end
end end

View File

@ -1,10 +1,5 @@
class IssuePriority < Enumeration class IssuePriority < Enumeration
generator_for :name, :method => :next_name generator_for :name, :start => 'IssuePriority0'
generator_for :type => 'IssuePriority' generator_for :type => 'IssuePriority'
def self.next_name
@last_name ||= 'IssuePriority0'
@last_name.succ!
@last_name
end
end end

View File

@ -1,9 +1,4 @@
class IssueStatus < ActiveRecord::Base 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 end

View File

@ -1,20 +1,8 @@
class Message < ActiveRecord::Base class Message < ActiveRecord::Base
generator_for :subject, :method => :next_subject generator_for :subject, :start => 'A Message'
generator_for :content, :method => :next_content generator_for :content, :start => 'Some content here'
generator_for :board, :method => :generate_board 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 def self.generate_board
Board.generate! Board.generate!
end end

View File

@ -1,16 +1,5 @@
class News < ActiveRecord::Base class News < ActiveRecord::Base
generator_for :title, :method => :next_title generator_for :title, :start => 'A New Item'
generator_for :description, :method => :next_description 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 end

View File

@ -1,21 +1,8 @@
class Project < ActiveRecord::Base class Project < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'Project 0'
generator_for :identifier, :method => :next_identifier_from_object_daddy generator_for :identifier, :start => 'project-0000'
generator_for :enabled_modules, :method => :all_modules generator_for :enabled_modules, :method => :all_modules
generator_for :trackers, :method => :next_tracker 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 def self.all_modules
[].tap do |modules| [].tap do |modules|

View File

@ -1,9 +1,4 @@
class Query < ActiveRecord::Base 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 end

View File

@ -1,11 +1,5 @@
class Repository < ActiveRecord::Base class Repository < ActiveRecord::Base
generator_for :type => 'Subversion' generator_for :type => 'Subversion'
generator_for :url, :method => :next_url generator_for :url, :start => 'file:///test/svn'
def self.next_url
@last_url ||= 'file:///test/svn'
@last_url.succ!
@last_url
end
end end

View File

@ -1,8 +1,4 @@
class Role < ActiveRecord::Base 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 end

View File

@ -1,11 +1,5 @@
class Repository::Subversion < Repository class Repository::Subversion < Repository
generator_for :type, :method => 'Subversion' generator_for :type, :method => 'Subversion'
generator_for :url, :method => :next_url generator_for :url, :start => 'file:///test/svn'
def self.next_url
@last_url ||= 'file:///test/svn'
@last_url.succ!
@last_url
end
end end

View File

@ -1,10 +1,5 @@
class TimeEntryActivity < Enumeration class TimeEntryActivity < Enumeration
generator_for :name, :method => :next_name generator_for :name, :start => 'TimeEntryActivity0'
generator_for :type => 'TimeEntryActivity' generator_for :type => 'TimeEntryActivity'
def self.next_name
@last_name ||= 'TimeEntryActivity0'
@last_name.succ!
@last_name
end
end end

View File

@ -6,5 +6,4 @@ class TimeEntry < ActiveRecord::Base
def self.generate_user def self.generate_user
User.generate_with_protected! User.generate_with_protected!
end end
end end

View File

@ -1,9 +1,4 @@
class Tracker < ActiveRecord::Base 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 end

View File

@ -1,30 +1,12 @@
class User < Principal class User < Principal
generator_for :login, :method => :next_login generator_for :login, :start => 'user1'
generator_for :mail, :method => :next_email generator_for :mail, :method => :next_email
generator_for :firstname, :method => :next_firstname generator_for :firstname, :start => 'Bob'
generator_for :lastname, :method => :next_lastname generator_for :lastname, :start => 'Doe'
def self.next_login
@gen_login ||= 'user1'
@gen_login.succ!
@gen_login
end
def self.next_email def self.next_email
@last_email ||= 'user1' @last_email ||= 'user1'
@last_email.succ! @last_email.succ!
"#{@last_email}@example.com" "#{@last_email}@example.com"
end 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 end

View File

@ -1,11 +1,5 @@
class Version < ActiveRecord::Base class Version < ActiveRecord::Base
generator_for :name, :method => :next_name generator_for :name, :start => 'Version 1.0.0'
generator_for :status => 'open' generator_for :status => 'open'
def self.next_name
@last_name ||= 'Version 1.0.0'
@last_name.succ!
@last_name
end
end end

View File

@ -1,13 +1,7 @@
class WikiPage < ActiveRecord::Base class WikiPage < ActiveRecord::Base
generator_for :title, :method => :next_title generator_for :title, :start => 'AWikiPage'
generator_for :wiki, :method => :generate_wiki generator_for :wiki, :method => :generate_wiki
def self.next_title
@last_title ||= 'AWikiPage'
@last_title.succ!
@last_title
end
def self.generate_wiki def self.generate_wiki
Wiki.generate! Wiki.generate!
end end

View File

@ -1,20 +1,8 @@
class WikiRedirect < ActiveRecord::Base class WikiRedirect < ActiveRecord::Base
generator_for :title, :method => :next_title generator_for :title, :start => 'AWikiPage'
generator_for :redirects_to, :method => :next_redirects_to generator_for :redirects_to, :start => '/a/path/000001'
generator_for :wiki, :method => :generate_wiki 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 def self.generate_wiki
Wiki.generate! Wiki.generate!
end end