LocalJumpError: no block given (yield) in github actions

Hi all,
I created a service object using Dry Monads using this syntax:
class MyClass
class << self
include Dry::Monads[:result]
include Dry::Monads::Do.for(:call)
def call
p = yield myFunction

My class works fine and when run rspec in local the tests pass.
So when I use CI on Github actions, the tests fails and I see this Fail: LocalJumpError: no block given (yield)

To replicate in local Just change include Dry::Monads::Do.for(:call) in include Dry::Monads::do
Can I help me to undestard to solve the problem in CI?


It seems you have mixed matcher and monads here.

You can check out my recent Hanami Mastery episode where I exactly showcased this stuff.

You basically need to use:

        include Dry::Monads[:do, :result]
        include Dry::Matcher.for(:call, with: Dry::Matcher::ResultMatcher)

Do and Result are Methods here. Not classes.

Maybe I have not explained myself well, so I try to write better: The procedure with which I use the monads should be correct and when I run the tests locally everything works fine. When I am on the CI github action the test fails because the ‘yield’ statement is not recognized. I believe it all depends on how I have to configure rspec on my CI. The error has already been discussed here Do notation doesn't work for children classes · Issue #68 · dry-rb/dry-monads · GitHub. Anyone have the same problem in CI mode?

1 Like

Solved: the issue was only on ubuntu S.O.
I’m using mac OS for develop and I try to execute the test on a Ubuntu machine and I replicate the issue. To solve a revert Dry Monads Library from 1.4 to 1.3.5. and now the CI on github works fine.

Oh, that’s interesting. Thanks for explanation. Probably a bug. Cc: @solnic

Unless I see a script reproducing the issue it’s not a bug but misconfiguration of a sort :slight_smile: