initial create user job

This commit is contained in:
Rimian Perkins 2017-05-04 17:23:41 +10:00
parent 1b3a104445
commit bafa91f255
4 changed files with 23 additions and 2 deletions

4
app/jobs/jobs.rb Normal file
View File

@ -0,0 +1,4 @@
load File.expand_path('../award_group.rb', __FILE__)
load File.expand_path('../grant_badge.rb', __FILE__)
load File.expand_path('../regular/donation_user.rb', __FILE__)

View File

@ -0,0 +1,8 @@
module Jobs
class DonationUser < ::Jobs::Base
def execute(args)
User.create(args)
end
end
end

View File

@ -11,8 +11,7 @@ load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
enabled_site_setting :discourse_donations_enabled
after_initialize do
load File.expand_path('../app/jobs/award_group.rb', __FILE__)
load File.expand_path('../app/jobs/grant_badge.rb', __FILE__)
load File.expand_path('../app/jobs/jobs.rb', __FILE__)
# Must be placed on every page for fraud protection.
header_script = '<script src="https://js.stripe.com/v3/"></script>'

View File

@ -0,0 +1,10 @@
RSpec.describe Jobs::DonationUser, type: :job do
it { should respond_to(:execute).with(1).arguments }
it 'creates a new user' do
args = { email: 'foo@example.com', username: 'something' }
User.expects(:create).with(args)
subject.execute(args)
end
end