These are chat archives for dry-rb/chat

Mar 2018
Spencer Goh
Mar 27 2018 06:31

How are we supposed to mock operations?

class MyOp
  def call(inputs)
    // lightweight do something do |m|
      m.success do |v|
         // do something
    // clean up and return stuff

This however doesn't work because my_wrapped_op should call the block with a Dry::Matcher::Evaluator - my test however shouldn't get into the internals of dry operations.

expect MyOp.to_receive(:call) {|&block| Success('something') }

Am I approaching this wrong?

Gustavo Caso
Mar 27 2018 07:45
Are we talking about dry-transaction? @dymaxionuk
Gustavo Caso
Mar 27 2018 08:03
Nico Ritschel
Mar 27 2018 22:11
Has anyone nested transactions with dry-transaction? I'm thinking this might provide a sane way to organize a moderately complex flow with lots of branching & provide more encapsulation/reusability. I.e. a single step in a parent transaction calls a child transaction
Nico Ritschel
Mar 27 2018 22:27
I am not using operations containers, but rather local operations and anything common I have just been extracting into behvaior-centric modules, so perhaps I'm missing critical info here.
Tim Riley
Mar 27 2018 23:27
@nicosuave I don’t see why you couldn’t use a transaction object as a step for another transaction