diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-01-28 19:05:21 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-01-28 19:05:21 +0000 |
commit | 8420f251099ad855bd347e3f687471f18ee40df4 (patch) | |
tree | f2afb7f16b265e8219dfa17f4c7d6dbfe81166fd /test/exemplars | |
parent | 675f28f89562445a56ea530fda762b8cbc03222f (diff) | |
download | redmine-8420f251099ad855bd347e3f687471f18ee40df4.tar.gz redmine-8420f251099ad855bd347e3f687471f18ee40df4.zip |
Added and updated some more object daddy exemplars.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3342 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/exemplars')
-rw-r--r-- | test/exemplars/attachment_exemplar.rb | 21 | ||||
-rw-r--r-- | test/exemplars/auth_source_exemplar.rb (renamed from test/exemplars/auth_soruce_exemplar.rb) | 0 | ||||
-rw-r--r-- | test/exemplars/comment_exemplar.rb | 13 | ||||
-rw-r--r-- | test/exemplars/custom_value_exemplar.rb | 5 | ||||
-rw-r--r-- | test/exemplars/group_exemplar.rb | 10 | ||||
-rw-r--r-- | test/exemplars/journal_exemplar.rb | 13 | ||||
-rw-r--r-- | test/exemplars/member_exemplar.rb | 10 |
7 files changed, 72 insertions, 0 deletions
diff --git a/test/exemplars/attachment_exemplar.rb b/test/exemplars/attachment_exemplar.rb new file mode 100644 index 000000000..e86c4d32b --- /dev/null +++ b/test/exemplars/attachment_exemplar.rb @@ -0,0 +1,21 @@ +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 = 'a_file.png' + @file.stubs(:original_filename).returns('a_file.png') + @file.stubs(:content_type).returns('image/png') + @file.stubs(:read).returns(false) + @file + end +end diff --git a/test/exemplars/auth_soruce_exemplar.rb b/test/exemplars/auth_source_exemplar.rb index da277e2ad..da277e2ad 100644 --- a/test/exemplars/auth_soruce_exemplar.rb +++ b/test/exemplars/auth_source_exemplar.rb diff --git a/test/exemplars/comment_exemplar.rb b/test/exemplars/comment_exemplar.rb new file mode 100644 index 000000000..036e82756 --- /dev/null +++ b/test/exemplars/comment_exemplar.rb @@ -0,0 +1,13 @@ +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 diff --git a/test/exemplars/custom_value_exemplar.rb b/test/exemplars/custom_value_exemplar.rb index 4e982614e..aeb5412e1 100644 --- a/test/exemplars/custom_value_exemplar.rb +++ b/test/exemplars/custom_value_exemplar.rb @@ -1,2 +1,7 @@ class CustomValue < ActiveRecord::Base + generator_for :custom_field, :method => :generate_custom_field + + def self.generate_custom_field + CustomField.generate! + end end diff --git a/test/exemplars/group_exemplar.rb b/test/exemplars/group_exemplar.rb new file mode 100644 index 000000000..5d2cd747b --- /dev/null +++ b/test/exemplars/group_exemplar.rb @@ -0,0 +1,10 @@ +class Group < Principal + generator_for :lastname, :method => :next_lastname + + def self.next_lastname + @last_lastname ||= 'Group' + @last_lastname.succ! + @last_lastname + end + +end diff --git a/test/exemplars/journal_exemplar.rb b/test/exemplars/journal_exemplar.rb new file mode 100644 index 000000000..dbb66f203 --- /dev/null +++ b/test/exemplars/journal_exemplar.rb @@ -0,0 +1,13 @@ +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 diff --git a/test/exemplars/member_exemplar.rb b/test/exemplars/member_exemplar.rb index 999bd4487..ecb09bb91 100644 --- a/test/exemplars/member_exemplar.rb +++ b/test/exemplars/member_exemplar.rb @@ -1,2 +1,12 @@ 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 |