Module: SpreeCmCommissioner::LoadTestAccountManagement

Extended by:
ActiveSupport::Concern
Includes:
LoadTestAccountScope
Included in:
Spree::Admin::System::LoadTestAccountsController
Defined in:
app/controllers/concerns/spree_cm_commissioner/load_test_account_management.rb

Instance Method Summary collapse

Instance Method Details

#bulk_destroyObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/concerns/spree_cm_commissioner/load_test_account_management.rb', line 27

def bulk_destroy
  result = SpreeCmCommissioner::LoadTest::DestroyAccounts.call(**pool_params)

  if result.success?
    flash[:success] = "#{result.value[:destroyed]} destroyed, #{result.value[:not_found]} not found (already removed)."
  else
    flash[:error] = result.error.value
  end

  redirect_to manage_accounts_redirect_path
rescue StandardError => e
  flash[:error] = e.message
  redirect_to manage_accounts_redirect_path
end

#createObject

Ensures N load-test accounts exist (idempotent) for load_test_tenant (nil = platform).



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/concerns/spree_cm_commissioner/load_test_account_management.rb', line 12

def create
  result = SpreeCmCommissioner::LoadTest::CreateAccounts.call(**pool_params)

  if result.success?
    flash[:success] = "#{result.value[:created]} load-test accounts created."
  else
    flash[:error] = result.error.value
  end

  redirect_to manage_accounts_redirect_path
rescue StandardError => e
  flash[:error] = e.message
  redirect_to manage_accounts_redirect_path
end