-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
55 lines (46 loc) · 1.3 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# frozen_string_literal: true
if RUBY_VERSION <= '3.1'
puts 'This example requires Ruby 3.1 or higher.'
exit! 1
end
# Usage:
#
# rake DISABLE_EVENT_LOGS=t
# rake DISABLE_LISTENER=t
#
# rake HIDE_GIVEN_AND_CONTINUE=t
#
# rake BREAK_ACCOUNT_CREATION=t
# rake BREAK_USER_CREATION=t
# rake BREAK_USER_TOKEN_CREATION=t
#
# rake BREAK_ACCOUNT_CREATION=t HIDE_GIVEN_AND_CONTINUE=t
task default: %i[solid_result_event_logs]
desc 'creates an account and an owner user through Solid::Result'
task :solid_result_event_logs do
require_relative 'config'
Solid::Result.configuration do |config|
config.feature.disable!(:event_logs) if ENV['DISABLE_EVENT_LOGS']
unless ENV['DISABLE_LISTENER']
config.event_logs.listener = Solid::Result::EventLogs::Listeners[
EventLogsListener::Stdout,
Solid::Result::EventLogsRecord::Listener
]
end
end
result = nil
bench = Benchmark.measure do
result = Account::OwnerCreation.new.call(
owner: {
name: "\tJohn Doe \n",
email: ' [email protected]',
password: '123123123',
password_confirmation: '123123123'
}
)
rescue RuntimeBreaker::Interruption => e
nil
end
puts "\nSolid::Result::EventLogsRecord.count: #{Solid::Result::EventLogsRecord.count}"
puts "\nBenchmark: #{bench}"
end