summaryrefslogtreecommitdiffstats
path: root/test/exemplars/news_exemplar.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-01-27 18:29:03 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-01-27 18:29:03 +0000
commit9044305b9335bb74f607944ffb3d6dd483da8f0b (patch)
tree646cd39bba4dfd5b5b08469c9fa01d53627ef6b6 /test/exemplars/news_exemplar.rb
parentd1c90d9abfd54dfa815e3401ce60af1e288ab122 (diff)
downloadredmine-9044305b9335bb74f607944ffb3d6dd483da8f0b.tar.gz
redmine-9044305b9335bb74f607944ffb3d6dd483da8f0b.zip
Added some exemplars for object daddy to generate test data.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3340 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/exemplars/news_exemplar.rb')
-rw-r--r--test/exemplars/news_exemplar.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/exemplars/news_exemplar.rb b/test/exemplars/news_exemplar.rb
new file mode 100644
index 000000000..c7e22c5a7
--- /dev/null
+++ b/test/exemplars/news_exemplar.rb
@@ -0,0 +1,16 @@
+class News < ActiveRecord::Base
+ generator_for :title, :method => :next_title
+ generator_for :description, :method => :next_description
+
+ 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