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

Support passing blocks to strategy methods #3

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

AhmedAttyah
Copy link

If we pass a block while calling a strategy method. We always get LocalJumpError: no block given (yield). That is because we are only passing args and kwargs when we call strategy methods. Here is a fix to pass &block as well.

Here is an example to re-produce this issue:

module Strategy
  class Database
    def find(id:)
      yield(id)
    end
  end
end
Repo.find(id: 1) { |a| puts(a) }

spec/receptacle_spec.rb Outdated Show resolved Hide resolved
@AhmedAttyah AhmedAttyah force-pushed the support-strategy-methods-blocks branch 3 times, most recently from 2faf1ea to 84e5904 Compare June 27, 2023 06:42
@AhmedAttyah AhmedAttyah merged commit 4fae8cf into master Jun 27, 2023
12 checks passed
@AhmedAttyah AhmedAttyah deleted the support-strategy-methods-blocks branch June 27, 2023 06:43
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

Successfully merging this pull request may close these issues.

2 participants