discourse/spec
Loïc Guitaut 719457e430 DEV: Add a try step to services
This patch adds a new step to services named `try`.

It’s useful to rescue exceptions that some steps could raise. That way,
if an exception is caught, the service will stop its execution and can
be inspected like with any other steps.

Just wrap the steps that can raise with a `try` block:
```ruby
try do
  step :step_that_can_raise
  step :another_step_that_can_raise
end
```
By default, `try` will catch any exception inheriting from
`StandardError`, but we can specify what exceptions to catch:
```ruby
try(ArgumentError, RuntimeError) do
  step :will_raise
end
```

An outcome matcher has been added: `on_exceptions`. By default it will
be executed for any exception caught by the `try` step.
Here also, we can specify what exceptions to catch:
```ruby
on_exceptions(ArgumentError, RuntimeError) do |exception|
  …
end
```

Finally, an RSpec matcher has been added:
```ruby
  it { is_expected.to fail_with_exception }
  # or
  it { is_expected.to fail_with_exception(ArgumentError) }
```
2024-11-19 12:01:07 +01:00
..
fabricators DEV: Create permanent version of moved_posts table from PostMover class (#29664) 2024-11-12 14:35:20 -06:00
fixtures DEV: Bump rubocop_discourse (#29608) 2024-11-06 06:27:49 +08:00
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers DEV: Call Discourse.redis.flushdb after the end of each test (#29117) 2024-10-09 07:19:31 +08:00
import_export DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
initializers DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
integration FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field (#29776) 2024-11-15 10:19:10 +08:00
integrity DEV: Add spec to ensure app works with multiple tagged loggers 2024-08-13 18:10:03 +02:00
jobs DEV: Fix linting in notify_category_change_spec (#29175) 2024-10-11 19:55:33 +02:00
lib DEV: Add a try step to services 2024-11-19 12:01:07 +01:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
migrations DEV: Remove invalid content_security_policy_script_src site setting values from DB (#27588) 2024-06-27 22:17:56 +08:00
models FIX: Admin backups erroring because of S3 dualstack (#29775) 2024-11-15 12:05:59 +10:00
multisite FEATURE: allow admins to enable announced experimental features (#29244) 2024-10-22 10:56:58 +11:00
requests FEATURE: Add skip notification option to group invite to topic (#29741) 2024-11-14 13:00:15 -03:00
script/import_scripts DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
serializers FIX: Don't include secret membership groups when serializing other users (#29799) 2024-11-18 19:25:42 +08:00
services DEV: Don’t replace Rails logger in specs (#29721) 2024-11-13 08:47:39 +08:00
support DEV: Add a try step to services 2024-11-19 12:01:07 +01:00
system UX: consistent flags page (#29798) 2024-11-19 14:46:08 +11:00
tasks DEV: Secure upload rake task improvements (#29484) 2024-10-31 13:33:11 +10:00
views FEATURE: Simplify crawler content for non-canonical post URLs (#26324) 2024-03-26 15:18:46 +00:00
rails_helper.rb FIX: Rescue ActiveRecord::ReadOnlyError when baking theme field (#29776) 2024-11-15 10:19:10 +08: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