Merge pull request #2372 from vikhyat/badge-system

Multiple grant badges
This commit is contained in:
Sam
2014-05-30 10:18:00 +10:00
25 changed files with 171 additions and 42 deletions

View File

@ -35,12 +35,12 @@ describe Admin::BadgesController do
context '.update' do
it 'returns success' do
xhr :put, :update, id: badge.id, name: "123456", badge_type_id: badge.badge_type_id, allow_title: false
xhr :put, :update, id: badge.id, name: "123456", badge_type_id: badge.badge_type_id, allow_title: false, multiple_grant: false
response.should be_success
end
it 'updates the badge' do
xhr :put, :update, id: badge.id, name: "123456", badge_type_id: badge.badge_type_id, allow_title: false
xhr :put, :update, id: badge.id, name: "123456", badge_type_id: badge.badge_type_id, allow_title: false, multiple_grant: true
badge.reload.name.should eq('123456')
end
end

View File

@ -26,6 +26,14 @@ describe UserBadgesController do
parsed = JSON.parse(response.body)
parsed["user_badges"].length.should == 1
end
it 'includes counts when passed the aggregate argument' do
xhr :get, :index, username: user.username, aggregated: true
response.status.should == 200
parsed = JSON.parse(response.body)
parsed["user_badges"].first.has_key?('count').should be_true
end
end
context 'create' do