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

Fix checking of method defined or not #2427

Merged

Conversation

y-yagi
Copy link
Contributor

@y-yagi y-yagi commented Dec 16, 2021

The Module#method_defined? works for an instance method. But with_unbundled_env defines as a class method. Therefore, the current check doesn't work as expected.

require "bundler"

puts Bundler.method_defined?(:with_unbundled_env) # => false
puts Bundler.respond_to?(:with_unbundled_env)     # => true

This fixes the following message that shows when running a test.

[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /home/y-yagi/src/github.com/rails-api/active_model_serializers/Rakefile:68)

The `Module#method_defined?` works for an instance method. But
`with_unbundled_env` defines as a class method. Therefore, the
current check doesn't work as expected.

```ruby
require "bundler"

puts Bundler.method_defined?(:with_unbundled_env) # => false
puts Bundler.respond_to?(:with_unbundled_env)     # => true
```

This fixes the following message that shows when running a test.

```
[DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /home/y-yagi/src/github.com/rails-api/active_model_serializers/Rakefile:68)
```
@wasifhossain wasifhossain force-pushed the fix-bundler-deprecated-method branch from e082bba to d40140b Compare March 3, 2022 18:47
@wasifhossain wasifhossain merged commit 0fbe0fa into rails-api:0-10-stable Mar 3, 2022
@y-yagi y-yagi deleted the fix-bundler-deprecated-method branch March 3, 2022 20:00
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.

4 participants