discourse/spec
Loïc Guitaut fc1c5f6a8d DEV: Have contract take a block in services
Currently in services, the `contract` step is only used to define where
the contract will be called in the execution flow. Then, a `Contract`
class has to be defined with validations in it.

This patch allows the `contract` step to take a block containing
validations, attributes, etc. directly. No need to then open a
`Contract` class later in the service.

It also has a nice side effect, as it’s now easy to define multiples
contracts inside the same service. Before, we had the `class_name:`
option, but it wasn’t really useful as you had to redefine a complete
new contract class.
Now, when using a name for the contract other than `default`, a new
contract will be created automatically using the provided name.

Example:
```ruby
contract(:user) do
  attribute :user_id, :integer

  validates :user_id, presence: true
end
```
This will create a `UserContract` class and use it, also putting the
resulting contract in `context[:user_contract]`.
2024-10-02 17:00:01 +09:00
..
fabricators FIX: Fix broken client-side review actions (#29025) 2024-09-30 13:27:25 +08:00
fixtures FEATURE: Allow oneboxing private GitHub repo URLs and add private indicator to HTML (#27947) 2024-07-19 12:21:45 +10:00
generator
helpers
import_export
initializers
integration DEV: Enable Rails 7.1 defaults 2024-08-12 10:41:13 +02:00
integrity DEV: Add spec to ensure app works with multiple tagged loggers 2024-08-13 18:10:03 +02:00
jobs FIX: Appropriately handle uninstalled problem checks (#28771) 2024-09-18 10:11:52 +08:00
lib DEV: Have contract take a block in services 2024-10-02 17:00:01 +09:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
migrations
models FIX: Appropriately handle uninstalled problem checks (#28771) 2024-09-18 10:11:52 +08:00
multisite FIX: serialize Flags instead of PostActionType (#28362) 2024-08-14 12:13:46 +10:00
requests FEAT: Allow admin delete user's associated accounts (#29018) 2024-09-27 20:08:05 +08:00
script/import_scripts
serializers FEATURE: Support designating multiple groups as mods on category (#28655) 2024-09-04 04:38:46 +03:00
services FIX: custom flag name should be unique (#28869) 2024-09-30 09:17:19 +10:00
support DEV: Track SQL queries from MiniSql (#28824) 2024-09-11 10:14:53 +03:00
system FIX: Fix broken client-side review actions (#29025) 2024-09-30 13:27:25 +08:00
tasks DEV: Stop storing theme-transpiler on filesystem in development (#28198) 2024-08-01 17:59:34 +01:00
views
rails_helper.rb DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
regenerate_swagger_docs
swagger_helper.rb