Commit 4a73eb904639b7302da3d5d1e6b138128bd20843

Authored by Hugo Melo
1 parent 13dd8ab6

Add simple test for points endpoint

Showing 1 changed file with 8 additions and 0 deletions   Show diff stats
test/unit/api_test.rb
... ... @@ -26,6 +26,14 @@ class APITest < ActiveSupport::TestCase
26 26 assert_not_nil json['percent']
27 27 end
28 28  
  29 + should 'get my total pontuation' do
  30 + badge = GamificationPlugin::Badge.create!(:owner => environment, :name => 'test_badge')
  31 + person.add_badge(badge.id)
  32 + get "/api/v1/gamification_plugin/my/points?#{params.to_query}"
  33 + json = JSON.parse(last_response.body)
  34 + assert_not_nil json['points']
  35 + end
  36 +
29 37 should 'get badges of the public person' do
30 38 badge = GamificationPlugin::Badge.create!(:owner => environment, :name => 'test_badge')
31 39 another_person = create(User, :environment => environment).person
... ...