Skip to content

Commit

Permalink
Add new spec classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Chen committed Mar 16, 2014
1 parent 463b515 commit 16d0953
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/models/update_comment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class UpdateComment
include Mongoid::Document
include Mongoid::MagicCounterCache

belongs_to :post

field :remark
field :is_published, type: Boolean, default: false

counter_cache :post, :if => Proc.new { |act| (act.is_published) }, :if_update => Proc.new { |act| act.changes['is_published'] }
end
10 changes: 10 additions & 0 deletions spec/models/update_review.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class UpdateReview
include Mongoid::Document
include Mongoid::MagicCounterCache

embedded_in :article
counter_cache :article, :if => Proc.new { |act| (act.is_published) }, :if_update => Proc.new { |act| act.changes['is_published'] }

field :comment
field :is_published, type: Boolean, default: false
end

0 comments on commit 16d0953

Please sign in to comment.