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

Global definition of 'with' function in Kernel module breaks rspec functionality #290

Open
PhilippOtto89 opened this issue Feb 12, 2020 · 0 comments

Comments

@PhilippOtto89
Copy link

PhilippOtto89 commented Feb 12, 2020

Hey developers,

in our project we use facets and RSpec. Rspec has an awesome feature to check if a function was called with parameters like

expect(dbl).to receive(:foo).with(1, anything, /bar/)

Unfortunately this breaks because there seems to be a global override of this function in facets. We receive the error

ArgumentError:
wrong number of arguments (given 3, expected 0..1)
/Users/philip.otto/.rvm/gems/ruby-2.6.0/gems/facets-3.1.0/lib/core/facets/kernel/with.rb:15:in `with'

And this file indeed contains a definition of this function

module Kernel
  def with(obj=self, &block)
    obj.instance_eval(&block)
  end
end

Is this global definition really necessary since it seems to interfere with other implementations?

Thanks for reading my question and have a nice day guys!

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

1 participant