Hi,
I’ve got transactions that call other transactions/operations. If I try to pass them step arguments they fail with the following error:
ArgumentError:
wrong number of arguments (given 2, expected 0..1)
# ./lib/dry/transaction/instance_methods.rb:25:in `call'
I’ve got a spec running (in spec/integration/passing_step_arguments_spec.rb
) that shows the behaviour:
context "with nested transactions" do
let(:transaction) {
Class.new do
include Dry::Transaction(container: Test::Container)
step :root, with: :nested
end.new
}
before do
module Test
nested_transaction = Class.new do
include Dry::Transaction
step :process
def process(input, *args)
Success input
end
end.new
Container = {
nested: nested_transaction,
}
end
end
context "arguments provided" do
let(:step_options) { { root: ["doe.com"] } }
it "passes the arguments and calls the operations successfully" do
expect(call_transaction).to be_a Dry::Monads::Result::Success
end
end
context "arguments not provided" do
let(:step_options) { {} }
it "calls the operation successfully" do
expect(call_transaction).to be_a Dry::Monads::Result::Success
end
end
end
The spec with step arguments fails, the other one succeeds.
Is there something wrong with my approach or is this a bug in dry-transaction
?
Thanks!