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

Investigate whether Mocha::ClassMethods::AnyInstance should be overriding #respond_to? #713

Open
floehopper opened this issue Jan 1, 2025 · 0 comments
Labels

Comments

@floehopper
Copy link
Member

Maybe this class should define #respond_to_missing? instead...?

def respond_to?(symbol, include_all = false)
@stubba_object.allocate.respond_to?(symbol.to_sym, include_all)
end

floehopper added a commit that referenced this issue Jan 1, 2025
These core Ruby method signatures violate
the `Style/OptionalBooleanParameter` cop and a bunch of tests
legitimately override them.

The one exception is `Mocha::ClassMethods::AnyInstance#respond_to?`
which is in library code. I've opened an issue (#713) to investigate
whether that class should define `#respond_to_missing?` instead.

Ideally I would've configured the extra `AllowedMethods` to only apply
to the tests, but I couldn't find a simple way to do that with the
rubocop configuration. It might be worth extracting a separate rubocop
configuration for the tests...?
floehopper added a commit that referenced this issue Jan 1, 2025
These core Ruby method signatures violate
the `Style/OptionalBooleanParameter` cop and a bunch of tests
legitimately override them.

The one exception is `Mocha::ClassMethods::AnyInstance#respond_to?`
which is in library code. I've opened an issue (#713) to investigate
whether that class should define `#respond_to_missing?` instead.

Ideally I would've configured the extra `AllowedMethods` to only apply
to the tests, but I couldn't find a simple way to do that with the
rubocop configuration. It might be worth extracting a separate rubocop
configuration for the tests...?
floehopper added a commit that referenced this issue Jan 1, 2025
These core Ruby method signatures violate
the `Style/OptionalBooleanParameter` cop and a bunch of tests
legitimately override them.

The one exception is `Mocha::ClassMethods::AnyInstance#respond_to?`
which is in library code. I've opened an issue (#713) to investigate
whether that class should define `#respond_to_missing?` instead.

Ideally I would've configured the extra `AllowedMethods` to only apply
to the tests, but I couldn't find a simple way to do that with the
rubocop configuration. It might be worth extracting a separate rubocop
configuration for the tests...?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant