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 for allow_nil option to delegate_method matcher. #749

Closed
alejandrodevs opened this issue Jul 3, 2015 · 3 comments
Closed

Support for allow_nil option to delegate_method matcher. #749

alejandrodevs opened this issue Jul 3, 2015 · 3 comments

Comments

@alejandrodevs
Copy link
Contributor

Hi everyone! I would like to add support for allow_nil option to delegate_method matcher.

it { should delegate_method(:deliver).to(:post_office).allow_nil(true) }

What do you think?

@maurogeorge
Copy link
Contributor

Hi @AlejandroGutierrez I like the idea 👍

Just a note, I think it is better to not pass a param to allow_nil, but something like:

it { should delegate_method(:deliver).to(:post_office).allow_nil }

Take a look here where this was discussed.

I guess I never worked on this matcher code, but as you can see here the matcher works with different kinds of delegation(Fowardable, delegate and methods) so I think we will need to handle this across all delegation and not only on the delegate from Rails. Makes sense to you?

Could you please send a PR?

@alejandrodevs
Copy link
Contributor Author

Yes, it makes sense!
I will work on this and will send a PR as soon as possible.
Thanks!

@mcmire
Copy link
Collaborator

mcmire commented Jul 7, 2015

Closing in favor of #751.

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

No branches or pull requests

3 participants