Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15 tester la creation dutilisateurs #9

Merged
merged 13 commits into from
Nov 26, 2019
Prev Previous commit
Next Next commit
Rename method and argument names.
  • Loading branch information
sherpanat committed Nov 25, 2019
commit 666422f377165a7cc5e4f5ee0f089f507f9ff9a3
2 changes: 1 addition & 1 deletion app/transactions/base_transaction.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class BaseTransaction
include Dry::Transaction

def self.execute(*args, &block)
def self.call(*args, &block)
new.call(*args, &block)
end
end
6 changes: 3 additions & 3 deletions app/transactions/users/create_transaction.rb
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@ class CreateTransaction < ::BaseTransaction
step :create_user
step :send_welcome_email

def create_user(input)
@user = User.create(input)
def create_user(attributes)
@user = User.create(attributes)
return Failure(error: @user.errors.full_messages.join(' | ')) if @user.errors.any?
Success(@user.attributes)
end

def send_welcome_email(input)
def send_welcome_email(attributes)
UserMailer.with(user: @user).welcome_email.deliver_now

Success(@user.attributes)