From 16f56a4677421fb03a6de55ef3dca6e014aef21b Mon Sep 17 00:00:00 2001 From: Etienne Massip Date: Fri, 23 Sep 2011 17:23:22 +0000 Subject: [PATCH] Merged r7458 from trunk (#7613). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@7482 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/exemplars/auth_source_exemplar.rb | 7 +---- test/exemplars/board_exemplar.rb | 16 ++---------- test/exemplars/change_exemplar.rb | 8 +----- test/exemplars/changeset_exemplar.rb | 8 +----- test/exemplars/custom_field_exemplar.rb | 7 +---- test/exemplars/document_category_exemplar.rb | 7 +---- test/exemplars/document_exemplar.rb | 7 +---- test/exemplars/enabled_module_exemplar.rb | 8 +----- test/exemplars/enumeration_exemplar.rb | 7 +---- test/exemplars/group_exemplar.rb | 8 +----- test/exemplars/issue_category_exemplar.rb | 9 ++----- test/exemplars/issue_exemplar.rb | 9 +------ test/exemplars/issue_priority_exemplar.rb | 7 +---- test/exemplars/issue_status_exemplar.rb | 7 +---- test/exemplars/message_exemplar.rb | 16 ++---------- test/exemplars/news_exemplar.rb | 15 ++--------- test/exemplars/project_exemplar.rb | 17 ++---------- test/exemplars/query_exemplar.rb | 7 +---- test/exemplars/repository_exemplar.rb | 8 +----- test/exemplars/role_exemplar.rb | 6 +---- .../subversion_repository_exemplar.rb | 8 +----- test/exemplars/time_entry_activity.rb | 7 +---- test/exemplars/time_entry_exemplar.rb | 1 - test/exemplars/tracker_exemplar.rb | 7 +---- test/exemplars/user_exemplar.rb | 26 +++---------------- test/exemplars/version_exemplar.rb | 8 +----- test/exemplars/wiki_page_exemplar.rb | 8 +----- test/exemplars/wiki_redirect_exemplar.rb | 16 ++---------- 28 files changed, 36 insertions(+), 229 deletions(-) diff --git a/test/exemplars/auth_source_exemplar.rb b/test/exemplars/auth_source_exemplar.rb index da277e2ad..3976aebb8 100644 --- a/test/exemplars/auth_source_exemplar.rb +++ b/test/exemplars/auth_source_exemplar.rb @@ -1,9 +1,4 @@ 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 diff --git a/test/exemplars/board_exemplar.rb b/test/exemplars/board_exemplar.rb index 264ea8107..eb8643dcd 100644 --- a/test/exemplars/board_exemplar.rb +++ b/test/exemplars/board_exemplar.rb @@ -1,20 +1,8 @@ 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 diff --git a/test/exemplars/change_exemplar.rb b/test/exemplars/change_exemplar.rb index 97985fbf5..07f30ecef 100644 --- a/test/exemplars/change_exemplar.rb +++ b/test/exemplars/change_exemplar.rb @@ -1,14 +1,8 @@ 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 diff --git a/test/exemplars/changeset_exemplar.rb b/test/exemplars/changeset_exemplar.rb index a14997759..62d6ee34c 100644 --- a/test/exemplars/changeset_exemplar.rb +++ b/test/exemplars/changeset_exemplar.rb @@ -1,14 +1,8 @@ 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 diff --git a/test/exemplars/custom_field_exemplar.rb b/test/exemplars/custom_field_exemplar.rb index b9577bb93..81e77884d 100644 --- a/test/exemplars/custom_field_exemplar.rb +++ b/test/exemplars/custom_field_exemplar.rb @@ -1,10 +1,5 @@ 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 diff --git a/test/exemplars/document_category_exemplar.rb b/test/exemplars/document_category_exemplar.rb index 5ffe9a94a..758b6d4c1 100644 --- a/test/exemplars/document_category_exemplar.rb +++ b/test/exemplars/document_category_exemplar.rb @@ -1,10 +1,5 @@ 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 diff --git a/test/exemplars/document_exemplar.rb b/test/exemplars/document_exemplar.rb index ae9a4a25a..1d8e71028 100644 --- a/test/exemplars/document_exemplar.rb +++ b/test/exemplars/document_exemplar.rb @@ -1,9 +1,4 @@ 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 diff --git a/test/exemplars/enabled_module_exemplar.rb b/test/exemplars/enabled_module_exemplar.rb index 85a38b509..60f0631cf 100644 --- a/test/exemplars/enabled_module_exemplar.rb +++ b/test/exemplars/enabled_module_exemplar.rb @@ -1,10 +1,4 @@ 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 diff --git a/test/exemplars/enumeration_exemplar.rb b/test/exemplars/enumeration_exemplar.rb index 6665a6d5d..29e4f45d4 100644 --- a/test/exemplars/enumeration_exemplar.rb +++ b/test/exemplars/enumeration_exemplar.rb @@ -1,10 +1,5 @@ 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 diff --git a/test/exemplars/group_exemplar.rb b/test/exemplars/group_exemplar.rb index 5d2cd747b..a6851b422 100644 --- a/test/exemplars/group_exemplar.rb +++ b/test/exemplars/group_exemplar.rb @@ -1,10 +1,4 @@ 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 diff --git a/test/exemplars/issue_category_exemplar.rb b/test/exemplars/issue_category_exemplar.rb index 318947c29..246eafcfb 100644 --- a/test/exemplars/issue_category_exemplar.rb +++ b/test/exemplars/issue_category_exemplar.rb @@ -1,9 +1,4 @@ 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 diff --git a/test/exemplars/issue_exemplar.rb b/test/exemplars/issue_exemplar.rb index 568f054ce..17868e6a4 100644 --- a/test/exemplars/issue_exemplar.rb +++ b/test/exemplars/issue_exemplar.rb @@ -1,13 +1,7 @@ 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! @@ -16,5 +10,4 @@ class Issue < ActiveRecord::Base def self.fetch_priority IssuePriority.first || IssuePriority.generate! end - end diff --git a/test/exemplars/issue_priority_exemplar.rb b/test/exemplars/issue_priority_exemplar.rb index 0819a8dc2..5059da5a1 100644 --- a/test/exemplars/issue_priority_exemplar.rb +++ b/test/exemplars/issue_priority_exemplar.rb @@ -1,10 +1,5 @@ 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 diff --git a/test/exemplars/issue_status_exemplar.rb b/test/exemplars/issue_status_exemplar.rb index 9d3ccdc1b..0576568dd 100644 --- a/test/exemplars/issue_status_exemplar.rb +++ b/test/exemplars/issue_status_exemplar.rb @@ -1,9 +1,4 @@ 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 diff --git a/test/exemplars/message_exemplar.rb b/test/exemplars/message_exemplar.rb index 0a310fc9d..67c5b67e2 100644 --- a/test/exemplars/message_exemplar.rb +++ b/test/exemplars/message_exemplar.rb @@ -1,20 +1,8 @@ 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 diff --git a/test/exemplars/news_exemplar.rb b/test/exemplars/news_exemplar.rb index c7e22c5a7..d58a2924f 100644 --- a/test/exemplars/news_exemplar.rb +++ b/test/exemplars/news_exemplar.rb @@ -1,16 +1,5 @@ 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 diff --git a/test/exemplars/project_exemplar.rb b/test/exemplars/project_exemplar.rb index a28c33312..ceda2be29 100644 --- a/test/exemplars/project_exemplar.rb +++ b/test/exemplars/project_exemplar.rb @@ -1,21 +1,8 @@ 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| diff --git a/test/exemplars/query_exemplar.rb b/test/exemplars/query_exemplar.rb index db32e938a..2b0847c80 100644 --- a/test/exemplars/query_exemplar.rb +++ b/test/exemplars/query_exemplar.rb @@ -1,9 +1,4 @@ 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 diff --git a/test/exemplars/repository_exemplar.rb b/test/exemplars/repository_exemplar.rb index 42d11fca9..7b596ea36 100644 --- a/test/exemplars/repository_exemplar.rb +++ b/test/exemplars/repository_exemplar.rb @@ -1,11 +1,5 @@ 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 diff --git a/test/exemplars/role_exemplar.rb b/test/exemplars/role_exemplar.rb index 9f17e1382..00bad9212 100644 --- a/test/exemplars/role_exemplar.rb +++ b/test/exemplars/role_exemplar.rb @@ -1,8 +1,4 @@ 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 diff --git a/test/exemplars/subversion_repository_exemplar.rb b/test/exemplars/subversion_repository_exemplar.rb index 2d48cb2f3..93c9fd161 100644 --- a/test/exemplars/subversion_repository_exemplar.rb +++ b/test/exemplars/subversion_repository_exemplar.rb @@ -1,11 +1,5 @@ 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 diff --git a/test/exemplars/time_entry_activity.rb b/test/exemplars/time_entry_activity.rb index 8473c2f81..e5e318d74 100644 --- a/test/exemplars/time_entry_activity.rb +++ b/test/exemplars/time_entry_activity.rb @@ -1,10 +1,5 @@ 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 diff --git a/test/exemplars/time_entry_exemplar.rb b/test/exemplars/time_entry_exemplar.rb index b15b9562d..c8f2e203c 100644 --- a/test/exemplars/time_entry_exemplar.rb +++ b/test/exemplars/time_entry_exemplar.rb @@ -6,5 +6,4 @@ class TimeEntry < ActiveRecord::Base def self.generate_user User.generate_with_protected! end - end diff --git a/test/exemplars/tracker_exemplar.rb b/test/exemplars/tracker_exemplar.rb index 94523f79b..0aa0d3b94 100644 --- a/test/exemplars/tracker_exemplar.rb +++ b/test/exemplars/tracker_exemplar.rb @@ -1,9 +1,4 @@ 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 diff --git a/test/exemplars/user_exemplar.rb b/test/exemplars/user_exemplar.rb index def8dc423..7aee14531 100644 --- a/test/exemplars/user_exemplar.rb +++ b/test/exemplars/user_exemplar.rb @@ -1,30 +1,12 @@ 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 diff --git a/test/exemplars/version_exemplar.rb b/test/exemplars/version_exemplar.rb index 04335549f..ee421fea4 100644 --- a/test/exemplars/version_exemplar.rb +++ b/test/exemplars/version_exemplar.rb @@ -1,11 +1,5 @@ class Version < ActiveRecord::Base - generator_for :name, :method => :next_name + generator_for :name, :start => 'Version 1.0.0' generator_for :status => 'open' - - def self.next_name - @last_name ||= 'Version 1.0.0' - @last_name.succ! - @last_name - end end diff --git a/test/exemplars/wiki_page_exemplar.rb b/test/exemplars/wiki_page_exemplar.rb index d70cc2278..8db9a0e95 100644 --- a/test/exemplars/wiki_page_exemplar.rb +++ b/test/exemplars/wiki_page_exemplar.rb @@ -1,13 +1,7 @@ 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 diff --git a/test/exemplars/wiki_redirect_exemplar.rb b/test/exemplars/wiki_redirect_exemplar.rb index 0b380acc5..cedb5bd00 100644 --- a/test/exemplars/wiki_redirect_exemplar.rb +++ b/test/exemplars/wiki_redirect_exemplar.rb @@ -1,20 +1,8 @@ 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