2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 23:54:20 +08:00
discourse/spec/lib/service
Loïc Guitaut 08df9a7ebb
DEV: Fix the lock step when using contracts (#38019)
Recently, the `lock` step from our Ruby service framework has been
extended to be able to work with keys from the global context when the
key isn’t present in the `params`.

The implementation is flawed because we usually get a contract object in
the `params` key of the context, and currently we call
`public_send(key)` on it. This actually raises an error when the key
doesn’t exist on the contract.

The fix is rather simple, we just use `try` instead, that way if the
method doesn’t exist, it returns `nil`, allowing us to get the key from
the global context as expected.
2026-02-24 12:30:38 +01:00
..
contract_base_spec.rb DEV: Handle nested attributes in contracts (#36348) 2025-12-12 11:41:48 +01:00
nested_contract_type_spec.rb DEV: Handle nested attributes in contracts (#36348) 2025-12-12 11:41:48 +01:00
runner_spec.rb DEV: Fix the lock step when using contracts (#38019) 2026-02-24 12:30:38 +01:00
steps_inspector_spec.rb DEV: fix a large amount of typos (#37428) 2026-02-02 16:31:58 +11:00