public
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/thoughtbot/shoulda.git
showaltb (author)
Tue Jul 29 07:35:14 -0700 2008
rmm5t (committer)
Fri Aug 01 10:41:17 -0700 2008
shoulda / test / rails_root / app / models / post.rb
100644 13 lines (11 sloc) 0.418 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
class Post < ActiveRecord::Base
  belongs_to :user
  belongs_to :owner, :foreign_key => :user_id, :class_name => 'User'
  has_many :taggings
  has_many :tags, :through => :taggings
  has_many :through_tags, :through => :taggings, :source => :tags
  
  validates_uniqueness_of :title
  validates_presence_of :title
  validates_presence_of :body, :message => 'Seriously... wtf'
  validates_numericality_of :user_id
end