Commit 624926b0d2789cde06c035dc1356861ae2cd9382

Authored by Victor Costa
1 parent 9cb5a092

Set default point weights

lib/merit/point_rules.rb
... ... @@ -9,7 +9,7 @@ module Merit
9 9 :to => :author,
10 10 :value => 1,
11 11 :description => _('Point weight for comment author'),
12   - :default_weight => 10
  12 + :default_weight => 150
13 13 },
14 14 :comment_article_author => {
15 15 :action => 'comment#create',
... ... @@ -17,7 +17,7 @@ module Merit
17 17 :to => lambda {|comment| comment.source.author},
18 18 :value => 1,
19 19 :description => _('Point weight for article author of a comment'),
20   - :default_weight => 10
  20 + :default_weight => 50
21 21 },
22 22 :article_author => {
23 23 :action => 'article#create',
... ... @@ -33,7 +33,7 @@ module Merit
33 33 :to => :profile,
34 34 :value => 1,
35 35 :description => _('Point weight for article community'),
36   - :default_weight => 500,
  36 + :default_weight => 600,
37 37 :condition => lambda {|target| target.profile.community? }
38 38 },
39 39 :vote_voteable_author => {
... ... @@ -43,7 +43,7 @@ module Merit
43 43 :profile => lambda {|vote| vote.voteable.profile},
44 44 :value => lambda {|vote| vote.vote},
45 45 :description => _('Point weight for the author of a voted content'),
46   - :default_weight => 5
  46 + :default_weight => 50
47 47 },
48 48 :vote_voteable => {
49 49 :action => 'vote#create',
... ... @@ -52,7 +52,7 @@ module Merit
52 52 :profile => lambda {|vote| vote.voteable.profile},
53 53 :value => lambda {|vote| vote.vote},
54 54 :description => _('Point weight for a voted content'),
55   - :default_weight => 5
  55 + :default_weight => 50
56 56 },
57 57 # TODO comment_voter and article_voter
58 58 }
... ...
test/unit/article_test.rb
... ... @@ -45,7 +45,7 @@ class ArticleTest < ActiveSupport::TestCase
45 45 should 'add merit points to article owner when an user like it' do
46 46 article = create(Article, :name => 'Test', :profile => person, :author => person)
47 47  
48   - assert_difference 'article.author.points(:category => :vote_voteable_author)', 5 do
  48 + assert_difference 'article.author.points(:category => :vote_voteable_author)', 50 do
49 49 Vote.create!(:voter => person, :voteable => article, :vote => 1)
50 50 end
51 51 end
... ... @@ -54,7 +54,7 @@ class ArticleTest < ActiveSupport::TestCase
54 54 article = create(Article, :name => 'Test', :profile => person, :author => person)
55 55 article = article.reload
56 56  
57   - assert_difference 'article.points(:category => :vote_voteable)', 5 do
  57 + assert_difference 'article.points(:category => :vote_voteable)', 50 do
58 58 Vote.create!(:voter => person, :voteable => article, :vote => 1)
59 59 end
60 60 end
... ...
test/unit/comment_test.rb
... ... @@ -46,7 +46,7 @@ class CommentTest < ActiveSupport::TestCase
46 46 should 'add merit points to comment owner when an user like his comment' do
47 47 comment = create(Comment, :source => article, :author_id => person.id)
48 48  
49   - assert_difference 'comment.author.points(:category => :vote_voteable_author)', 5 do
  49 + assert_difference 'comment.author.points(:category => :vote_voteable_author)', 50 do
50 50 Vote.create!(:voter => person, :voteable => comment, :vote => 1)
51 51 end
52 52 end
... ... @@ -55,7 +55,7 @@ class CommentTest < ActiveSupport::TestCase
55 55 comment = create(Comment, :source => article, :author_id => person.id)
56 56 Vote.create!(:voter => person, :voteable => comment, :vote => 1)
57 57  
58   - assert_difference 'comment.author.points', -5 do
  58 + assert_difference 'comment.author.points', -50 do
59 59 Vote.where(:voteable_id => comment.id).destroy_all
60 60 end
61 61 end
... ... @@ -63,7 +63,7 @@ class CommentTest < ActiveSupport::TestCase
63 63 should 'subtract merit points from comment owner when an user dislike his comment' do
64 64 comment = create(Comment, :source => article, :author_id => person.id)
65 65  
66   - assert_difference 'comment.author.points(:category => :vote_voteable_author)', -5 do
  66 + assert_difference 'comment.author.points(:category => :vote_voteable_author)', -50 do
67 67 Vote.create!(:voter => person, :voteable => comment, :vote => -1)
68 68 end
69 69 end
... ... @@ -72,7 +72,7 @@ class CommentTest < ActiveSupport::TestCase
72 72 comment = create(Comment, :source => article, :author_id => person.id)
73 73 Vote.create!(:voter => person, :voteable => comment, :vote => -1)
74 74  
75   - assert_difference 'comment.author.points', 5 do
  75 + assert_difference 'comment.author.points', 50 do
76 76 Vote.where(:voteable_id => comment.id).destroy_all
77 77 end
78 78 end
... ...