You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-These examples are valid to all kinds of mixins (`BCDD::Result.mixin`, `BCDD::Result::Context.mixin`, `BCDD::Result::Expectations.mixin`, `BCDD::Result::Context::Expectations.mixin`)
This mode also defines an `Expected` constant to be used inside and outside the module.
950
+
This mode also defines an `Result` constant to be used inside and outside the module.
951
951
952
952
> **PROTIP:**
953
-
> You can use the `Expected` constant to mock the result's type and value in your tests. As they will have the exact expectations, your tests will check if the result clients are handling the result correctly.
953
+
> You can use the `Result` constant to mock the result's type and value in your tests. As they will have the exact expectations, your tests will check if the result clients are handling the result correctly.
954
954
955
955
Now that you know the two modes, let's understand how expectations can be beneficial and powerful for defining contracts.
956
956
@@ -1274,12 +1274,12 @@ The `BCDD::Result::Expectations.mixin` also accepts the `with:` argument. It is
1274
1274
1275
1275
**Continue**
1276
1276
1277
-
It is similar to `BCDD::Result.mixin(config: :continue)`, the key difference is that the `Continue(value)` will be ignored by the expectations. This is extremely useful when you want to use `Continue(value)` to chain operations, but you don't want to declare N success types in the expectations.
1277
+
It is similar to `BCDD::Result.mixin(config: { addon: { continue: true } })`, the key difference is that the `Continue(value)` will be ignored by the expectations. This is extremely useful when you want to use `Continue(value)` to chain operations, but you don't want to declare N success types in the expectations.
1278
1278
1279
1279
```ruby
1280
1280
classDivide
1281
1281
includeBCDD::Result::Expectations.mixin(
1282
-
config::continue,
1282
+
config:{ addon: { continue:true } },
1283
1283
success::division_completed,
1284
1284
failure:%i[invalid_arg division_by_zero]
1285
1285
)
@@ -1581,7 +1581,7 @@ The `BCDD::Result::Context.mixin` and `BCDD::Result::Context::Expectations.mixin
1581
1581
1582
1582
**Continue**
1583
1583
1584
-
The `BCDD::Result::Context.mixin(config: :continue)` or `BCDD::Result::Context::Expectations.mixin(config: :continue)` adds a `Continue(**input)` that will be ignored by the expectations. This is extremely useful when you want to use `Continue()` to chain operations, but you don't want to declare N success types in the expectations.
1584
+
The `BCDD::Result::Context.mixin(config: { addon: { continue: true } })` or `BCDD::Result::Context::Expectations.mixin(config: { addon: { continue: true } })` adds a `Continue(**input)` that will be ignored by the expectations. This is extremely useful when you want to use `Continue()` to chain operations, but you don't want to declare N success types in the expectations.
1585
1585
1586
1586
Let's use a mix of `BCDD::Result::Context` features to see in action with this add-on:
0 commit comments