grant the users badges

This commit is contained in:
Rimian Perkins 2017-04-27 19:31:11 +10:00
parent 14dd31b027
commit 1549a47088
2 changed files with 7 additions and 3 deletions

View File

@ -30,6 +30,10 @@ module DiscourseDonations
store = PluginStore.get('discourse-donations', 'group:add') || []
PluginStore.set('discourse-donations', 'group:add', store << email)
end
if badge_name.present?
store = PluginStore.get('discourse-donations', 'badge:grant') || []
PluginStore.set('discourse-donations', 'badge:grant', store << email)
end
end
end

View File

@ -49,13 +49,13 @@ module DiscourseDonations
expect(response_rewards).to be_empty
end
it 'stores the email in group:add' do
it 'stores the email in group:add and badge:grant' do
PluginStore.expects(:get).with('discourse-donations', 'group:add').returns([])
PluginStore.expects(:set).with('discourse-donations', 'group:add', [params[:email]])
PluginStore.expects(:get).with('discourse-donations', 'badge:grant').returns([])
PluginStore.expects(:set).with('discourse-donations', 'badge:grant', [params[:email]])
post :create, params
end
it 'enqueues awarding a badge'
end
describe 'logged in user' do