Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4628

Ruby Rspec Mock Same instance to behave different in the first and second call

$
0
0

I have a code that looks like this:

def call(some_id:)          verify_before = @verify.call(some_id)          return verify_before if verify_before.sucess?          did_something = @processor.call(some_id)          return did_something unless did_something.sucess?          @verify.call(some_id)end

I would like to mock @verify so in the first time it will return sucess? = false and on the second call it will return true

What is the best approach?


Viewing all articles
Browse latest Browse all 4628

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>