diff --git a/test/unit/api_test.rb b/test/unit/api_test.rb index b753c05..d9097ff 100644 --- a/test/unit/api_test.rb +++ b/test/unit/api_test.rb @@ -7,6 +7,8 @@ class APITest < ActiveSupport::TestCase login_api environment = Environment.default environment.enable_plugin(GamificationPlugin) + @community = create_merit_categorization + GamificationPlugin.gamification_set_rules(@environment) end should 'get my own badges' do @@ -14,7 +16,7 @@ class APITest < ActiveSupport::TestCase person.add_badge(badge.id) get "/api/v1/gamification_plugin/my/badges?#{params.to_query}" json = JSON.parse(last_response.body) - assert_equal 'test_badge', json.first['name'] + assert_equal 'test_badge', json['badges'].first['name'] end should 'get my level' do @@ -71,7 +73,7 @@ class APITest < ActiveSupport::TestCase another_person.visible=false another_person.save get "/api/v1/gamification_plugin/people/#{another_person.id}/level?#{params.to_query}" - json = JSON.parse(last_response.body) + JSON.parse(last_response.body) assert_equal 404, last_response.status end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 3d68a19..90fea3b 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -78,7 +78,7 @@ class CommentTest < ActiveSupport::TestCase comment = create(Comment, :source => article, :author_id => author.id) Vote.create!(:voter => person, :voteable => comment, :vote => 1) - assert_difference 'comment.author.points', -50 do + assert_difference 'comment.author.points', -20 do Vote.where(:voteable_id => comment.id).destroy_all end end @@ -96,7 +96,7 @@ class CommentTest < ActiveSupport::TestCase comment = create(Comment, :source => article, :author_id => author.id) Vote.create!(:voter => person, :voteable => comment, :vote => -1) - assert_difference 'comment.author.points', 50 do + assert_difference 'comment.author.points', 20 do Vote.where(:voteable_id => comment.id).destroy_all end end -- libgit2 0.21.2