diff --git a/lib/merit/point_rules.rb b/lib/merit/point_rules.rb index 780d0b5..5bb4221 100644 --- a/lib/merit/point_rules.rb +++ b/lib/merit/point_rules.rb @@ -19,6 +19,14 @@ module Merit :description => _('Point weight for article author of a comment'), :default_weight => 50 }, + :comment_article => { + :action => 'comment#create', + :undo_action => 'comment#destroy', + :to => lambda {|comment| comment.source}, + :value => 1, + :description => _('Point weight for source article of a comment'), + :default_weight => 50 + }, :article_author => { :action => 'article#create', :undo_action => 'article#destroy', diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 1517877..c9e553d 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -100,4 +100,10 @@ class CommentTest < ActiveSupport::TestCase end end + should 'add merit points to source article when create a comment' do + assert_difference 'article.points(:category => :comment_article)', 50 do + create(Comment, :source => article, :author_id => person.id) + end + end + end -- libgit2 0.21.2