markburns / markburns/interactify

support defining `expects` and `promises` in a `.chain` call

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

chains
Dominant language
Ruby
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

```ruby
organize \
DoFoo,
DoBar = self.if(
:success,
then: DoBaz = chain('DoBaz', A, B, C),
else: Qux
)
```

Here we have to use `chain` when assigning to a testable constant `DoBaz`

but if A expects something, then the interactor wiring specs will fail. Meaning you have to fully extract a class.

```ruby
class DoBaz
include Interactify
expect :a
organize A, B, C
end
```

```ruby
organize \
DoFoo,
DoBar = self.if(
:success,
then: DoBaz,
else: Qux
)
```

OR we can do

```ruby
organize \
DoFoo,
DoBar = self.if(
:success,
then: DoBaz = chain('DoBaz', A, B, C).expect(:a),
else: Qux
)
```

but here the `expect` can come visually far away from the start of the `chain`.

May be nice to have to do

```ruby
organize \
DoFoo,
DoBar = self.if(
:success,
then: DoBaz = chain('DoBaz', A, B, C, expect: :a),
else: Qux
)
```

```ruby
organize \
DoFoo,
DoBar = self.if(
:success,
then: DoBaz = chain('DoBaz', expect: :a, A, B, C),
else: Qux
)
```

Also to investigate why wiring specs are not passing in previous contract info into `if` and `chain` calls

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the `chain` and `if` entry points and the wiring specs mentioned in the issue. Compare how `expect` and `promises` should be handled for nested calls with contract information passed through. Done means the chosen `.chain` API preserves these contracts and the wiring specs pass for the nested example.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.