Sha256: 35cb5c7d0d996e35fb7d269eed1e4312ade03daf0d91c1e3df1b0405579e3f08

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

# 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[bcdd_result_event_logs]

desc 'creates an account and an owner user through BCDD::Result'
task :bcdd_result_event_logs do
  require_relative 'config'

  BCDD::Result.configuration do |config|
    config.feature.disable!(:event_logs) if ENV['DISABLE_EVENT_LOGS']

    unless ENV['DISABLE_LISTENER']
      config.event_logs.listener = BCDD::Result::EventLogs::Listeners[
        EventLogsListener::Stdout,
        BCDD::Result::EventLogsRecord::Listener
      ]
    end
  end

  result = nil

  bench = Benchmark.measure do
    result = Account::OwnerCreation.new.call(
      owner: {
        name: "\tJohn     Doe \n",
        email: '   JOHN.doe@email.com',
        password: '123123123',
        password_confirmation: '123123123'
      }
    )
  rescue RuntimeBreaker::Interruption => e
    nil
  end

  puts "\nBCDD::Result::EventLogsRecord.count: #{BCDD::Result::EventLogsRecord.count}"

  puts "\nBenchmark: #{bench}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bcdd-result-1.1.0 examples/multiple_listeners/Rakefile
bcdd-result-1.0.0 examples/multiple_listeners/Rakefile