examples/service_objects/Rakefile
# frozen_string_literal: true
if RUBY_VERSION <= '3.1'
puts 'This example requires Ruby 3.1 or higher.'
exit! 1
end
task default: %i[solid_result_event_logs]
task :config do
require_relative 'config'
end
desc 'creates an account and an owner user through Solid::Result'
task solid_result_event_logs: %i[config] do
result1 = Account::OwnerCreation.call(
owner: {
name: "\tJohn Doe \n",
email: ' JOHN.doe@email.com',
password: '123123123',
password_confirmation: '123123123'
}
)
puts result1.inspect
puts
result2 = Account::OwnerCreation.call(
uuid: "",
owner: {}
).on_failure(:invalid_input) do |output|
output[:input].errors.full_messages.each do |message|
puts message
end
end
end