Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested transactions with step arguments fail with ArgumentError #124

Open
wintersolutions opened this issue May 3, 2019 · 0 comments
Open

Comments

@wintersolutions
Copy link

wintersolutions commented May 3, 2019

When calling a transaction from another transaction the call fails if step_args are provided.

Error message:

ArgumentError:
       wrong number of arguments (given 2, expected 0..1)
     # ./lib/dry/transaction/instance_methods.rb:25:in `call'

pseudocode:

nested = Class.new do
 include Dry::Transaction
 step :process
 def process(input, *args); Success; end
end.new

# register nested in container C

root = Class.new do
  include Dry::Transaction(container: C)
  step :root, with: nested
end.new

root.call # ok
root.with_step_args(root: 'foo').call # error

The issue seems to be that the arguments can't be passed down to the nested transaction but the lib tries to.

I've prepared a test case that demonstrates this:

#125

Short discussion on discourse:

https://discourse.dry-rb.org/t/nested-transactions-with-step-arguments-buggy/757

@wintersolutions wintersolutions changed the title Nested transactions with step arguments Nested transactions with step arguments fail with ArgumentError May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant