Renamed object_daddy_helper and removed exemplars.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9470 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-04-22 11:58:05 +00:00
parent b960470d78
commit 95f9246a46
39 changed files with 3 additions and 286 deletions

View File

@ -1,17 +0,0 @@
class Attachment < ActiveRecord::Base
generator_for :container, :method => :generate_project
generator_for :file, :method => :generate_file
generator_for :author, :method => :generate_author
def self.generate_project
Project.generate!
end
def self.generate_author
User.generate_with_protected!
end
def self.generate_file
@file = ActiveSupport::TestCase.mock_file
end
end

View File

@ -1,4 +0,0 @@
class AuthSource < ActiveRecord::Base
generator_for :name, :start => 'Auth0'
end

View File

@ -1,9 +0,0 @@
class Board < ActiveRecord::Base
generator_for :name, :start => 'A Forum'
generator_for :description, :start => 'Some description here'
generator_for :project, :method => :generate_project
def self.generate_project
Project.generate!
end
end

View File

@ -1,9 +0,0 @@
class Change < ActiveRecord::Base
generator_for :action => 'A'
generator_for :path, :start => 'test/dir/aaa0001'
generator_for :changeset, :method => :generate_changeset
def self.generate_changeset
Changeset.generate!
end
end

View File

@ -1,9 +0,0 @@
class Changeset < ActiveRecord::Base
generator_for :revision, :start => '1'
generator_for :committed_on => Date.today
generator_for :repository, :method => :generate_repository
def self.generate_repository
Repository::Subversion.generate!
end
end

View File

@ -1,13 +0,0 @@
class Comment < ActiveRecord::Base
generator_for :commented, :method => :generate_news
generator_for :author, :method => :generate_author
generator_for :comments => 'What great news this is.'
def self.generate_news
News.generate!
end
def self.generate_author
User.generate_with_protected!
end
end

View File

@ -1,5 +0,0 @@
class CustomField < ActiveRecord::Base
generator_for :name, :start => 'CustomField0'
generator_for :field_format => 'string'
end

View File

@ -1,7 +0,0 @@
class CustomValue < ActiveRecord::Base
generator_for :custom_field, :method => :generate_custom_field
def self.generate_custom_field
CustomField.generate!
end
end

View File

@ -1,5 +0,0 @@
class DocumentCategory < Enumeration
generator_for :name, :start => 'DocumentCategory0'
generator_for :type => 'DocumentCategory'
end

View File

@ -1,4 +0,0 @@
class Document < ActiveRecord::Base
generator_for :title, :start => 'Document001'
end

View File

@ -1,4 +0,0 @@
class EnabledModule < ActiveRecord::Base
generator_for :name, :start => 'module_001'
end

View File

@ -1,5 +0,0 @@
class Enumeration < ActiveRecord::Base
generator_for :name, :start => 'Enumeration0'
generator_for :type => 'TimeEntryActivity'
end

View File

@ -1,4 +0,0 @@
class Group < Principal
generator_for :lastname, :start => 'Group'
end

View File

@ -1,4 +0,0 @@
class IssueCategory < ActiveRecord::Base
generator_for :name, :start => 'Category 0001'
end

View File

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

View File

@ -1,5 +0,0 @@
class IssuePriority < Enumeration
generator_for :name, :start => 'IssuePriority0'
generator_for :type => 'IssuePriority'
end

View File

@ -1,4 +0,0 @@
class IssueStatus < ActiveRecord::Base
generator_for :name, :start => 'Status 0'
end

View File

@ -1,13 +0,0 @@
class Journal < ActiveRecord::Base
generator_for :journalized, :method => :generate_issue
generator_for :user, :method => :generate_user
def self.generate_issue
project = Project.generate!
Issue.generate_for_project!(project)
end
def self.generate_user
User.generate_with_protected!
end
end

View File

@ -1,12 +0,0 @@
class Member < ActiveRecord::Base
generator_for :roles, :method => :generate_roles
generator_for :principal, :method => :generate_user
def self.generate_roles
[Role.generate!]
end
def self.generate_user
User.generate_with_protected!
end
end

View File

@ -1,12 +0,0 @@
class MemberRole < ActiveRecord::Base
generator_for :member, :method => :generate_member
generator_for :role, :method => :generate_role
def self.generate_role
Role.generate!
end
def self.generate_member
Member.generate!
end
end

View File

@ -1,9 +0,0 @@
class Message < ActiveRecord::Base
generator_for :subject, :start => 'A Message'
generator_for :content, :start => 'Some content here'
generator_for :board, :method => :generate_board
def self.generate_board
Board.generate!
end
end

View File

@ -1,5 +0,0 @@
class News < ActiveRecord::Base
generator_for :title, :start => 'A New Item'
generator_for :description, :start => 'Some content here'
end

View File

@ -1,18 +0,0 @@
class Project < ActiveRecord::Base
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.all_modules
[].tap do |modules|
Redmine::AccessControl.available_project_modules.each do |name|
modules << EnabledModule.new(:name => name.to_s)
end
end
end
def self.next_tracker
[Tracker.generate!]
end
end

View File

@ -1,4 +0,0 @@
class Query < ActiveRecord::Base
generator_for :name, :start => 'Query 0'
end

View File

@ -1,5 +0,0 @@
class Repository < ActiveRecord::Base
generator_for :type => 'Subversion'
generator_for :url, :start => 'file:///test/svn'
generator_for :identifier, :start => 'repo1'
end

View File

@ -1,4 +0,0 @@
class Role < ActiveRecord::Base
generator_for :name, :start => 'Role0'
end

View File

@ -1,5 +0,0 @@
class Repository::Subversion < Repository
generator_for :type, :method => 'Subversion'
generator_for :url, :start => 'file:///test/svn'
end

View File

@ -1,5 +0,0 @@
class TimeEntryActivity < Enumeration
generator_for :name, :start => 'TimeEntryActivity0'
generator_for :type => 'TimeEntryActivity'
end

View File

@ -1,9 +0,0 @@
class TimeEntry < ActiveRecord::Base
generator_for(:spent_on) { Date.today }
generator_for(:hours) { (rand * 10).round(2) } # 0.01 to 9.99
generator_for :user, :method => :generate_user
def self.generate_user
User.generate_with_protected!
end
end

View File

@ -1,4 +0,0 @@
class Tracker < ActiveRecord::Base
generator_for :name, :start => 'Tracker 0'
end

View File

@ -1,12 +0,0 @@
class User < Principal
generator_for :login, :start => 'user1'
generator_for :mail, :method => :next_email
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
end

View File

@ -1,5 +0,0 @@
class Version < ActiveRecord::Base
generator_for :name, :start => 'Version 1.0.0'
generator_for :status => 'open'
end

View File

@ -1,7 +0,0 @@
class Watcher < ActiveRecord::Base
generator_for :user, :method => :generate_user
def self.generate_user
User.generate_with_protected!
end
end

View File

@ -1,8 +0,0 @@
class WikiContent < ActiveRecord::Base
generator_for :text => 'Some content'
generator_for :page, :method => :generate_page
def self.generate_page
WikiPage.generate!
end
end

View File

@ -1,8 +0,0 @@
class Wiki < ActiveRecord::Base
generator_for :start_page => 'Start'
generator_for :project, :method => :generate_project
def self.generate_project
Project.generate!
end
end

View File

@ -1,8 +0,0 @@
class WikiPage < ActiveRecord::Base
generator_for :title, :start => 'AWikiPage'
generator_for :wiki, :method => :generate_wiki
def self.generate_wiki
Wiki.generate!
end
end

View File

@ -1,9 +0,0 @@
class WikiRedirect < ActiveRecord::Base
generator_for :title, :start => 'AWikiPage'
generator_for :redirects_to, :start => '/a/path/000001'
generator_for :wiki, :method => :generate_wiki
def self.generate_wiki
Wiki.generate!
end
end

View File

@ -1,4 +1,4 @@
module ObjectDaddyHelpers
module ObjectHelpers
# 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={})

View File

@ -20,8 +20,8 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require Rails.root.join('test', 'mocks', 'open_id_authentication_mock.rb').to_s
require File.expand_path(File.dirname(__FILE__) + '/object_daddy_helpers')
include ObjectDaddyHelpers
require File.expand_path(File.dirname(__FILE__) + '/object_helpers')
include ObjectHelpers
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method