initial create user job
This commit is contained in:
parent
1b3a104445
commit
bafa91f255
|
@ -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__)
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
module Jobs
|
||||||
|
class DonationUser < ::Jobs::Base
|
||||||
|
def execute(args)
|
||||||
|
User.create(args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,8 +11,7 @@ load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
|
||||||
enabled_site_setting :discourse_donations_enabled
|
enabled_site_setting :discourse_donations_enabled
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
load File.expand_path('../app/jobs/award_group.rb', __FILE__)
|
load File.expand_path('../app/jobs/jobs.rb', __FILE__)
|
||||||
load File.expand_path('../app/jobs/grant_badge.rb', __FILE__)
|
|
||||||
|
|
||||||
# Must be placed on every page for fraud protection.
|
# Must be placed on every page for fraud protection.
|
||||||
header_script = '<script src="https://js.stripe.com/v3/"></script>'
|
header_script = '<script src="https://js.stripe.com/v3/"></script>'
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue