discourse/spec
Loïc Guitaut a39785f3dd
DEV: Add only_if step to DRSF (#35247)
This patch introduces a new step to the Ruby Service Framework.

`only_if` will execute its block (other steps) only if the provided
condition evaluates to `true`. As for the other steps, the name provided
is the name of the method that will be executed.

```ruby
only_if(:can_update) do
  model :user
  step :update_user
  step :notify
end

private

def can_update(guardian:)
  …
end
```

This step cannot fail and the whole block will be skipped if the method
evaluates to a falsy value.

This is rendered by the steps inspector:

```
[ 1/13] [options] default 
[ 2/13] [model] model 
[ 3/13] [policy] policy 
[ 4/13] [params] default 
[ 5/13] [lock] parameter:other_param 
[ 6/13]   [transaction]
[ 7/13]     [step] in_transaction_step_1 
[ 8/13]     [step] in_transaction_step_2 
[ 9/13] [try]
[10/13]   [step] might_raise 
[11/13] [only_if] condition ⏭️ (condition was not met)
[12/13]   [step] optional_step
[13/13] [step] final_step 
```

The inspector also renders text with colors now.

<img width="419" height="336" alt="Copie d'écran_20251008_162920"
src="https://github.com/user-attachments/assets/add4fd16-076e-4f30-ae1a-3e933494967e"
/>
2025-10-08 17:20:22 +02:00
..
db/migrate DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
fabricators FIX: Remove error section when viewing details for received emails (#35228) 2025-10-07 16:25:11 +08:00
fixtures SECURITY: Use nonce-based restrictions during restore 2025-09-30 10:09:46 +08:00
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers FEATURE: Allow editing theme-owned palettes (#34722) 2025-10-06 09:02:39 +03:00
import_export DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
initializers DEV: Patch ActiveRecord's postgresql adapter .new_client (#33820) 2025-09-18 11:34:37 +08:00
integration FEATURE: Allow editing theme-owned palettes (#34722) 2025-10-06 09:02:39 +03:00
integrity Build(deps): Bump propshaft from 1.2.1 to 1.3.1 (#34967) 2025-09-28 15:13:35 +02:00
jobs DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
lib DEV: Add only_if step to DRSF (#35247) 2025-10-08 17:20:22 +02:00
mailers DEV: Remove ability to use users' names in group mention notifications and mentions shown in emails and added :user_notification_email_options plugin modifier to allow plugins reintroduce this or other modifications to emails (#33449) 2025-07-14 15:20:08 -05:00
models DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
multisite FEATURE: Themeable site settings (#32233) 2025-07-16 11:00:21 +10:00
queries/reports UX: Add admin report for associated accounts by login provider (#34187) 2025-08-14 09:24:14 -04:00
requests FEATURE: Introduce 'google_site_verification_token' site setting (#35229) 2025-10-08 11:08:33 +01:00
script/import_scripts DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
serializers FIX: Remove error section when viewing details for received emails (#35228) 2025-10-07 16:25:11 +08:00
services DEV: Add more logging to mediaconvert check_status (#35255) 2025-10-07 14:15:49 -06:00
support DEV: Improvements to DiscourseConnect spec helpers (#35173) 2025-10-03 14:53:56 +01:00
system DEV: Fix system tests not relying on capybara matchers (#35281) 2025-10-08 21:30:04 +08:00
tasks DEV: Change pre-release suffix from -dev to -latest (#35007) 2025-09-29 13:10:03 +01:00
views FIX: Use correct subcategory subfolder path in crawler (#34250) 2025-08-12 16:14:50 +08:00
rails_helper.rb DEV: Improvements to DiscourseConnect spec helpers (#35173) 2025-10-03 14:53:56 +01:00
regenerate_swagger_docs
swagger_helper.rb DEV: Bump rswag-specs from 2.11.0 to 2.13.0 (#24654) 2023-12-07 08:16:47 +08:00