thoughtbot/shoulda-context

Proc#bind deprecation warnings flood my test output

Closed this issue · 5 comments

jbgo commented

Here is an example of my test output after upgrading from rails 4.0.0 to 4.0.1:
https://gist.github.com/jbgo/7271665

With the latest update to rails 4.0.1, Proc#bind is deprecated and it is removed completely in the master branch with no replacement:
rails/rails@f62fb98

I've traced the warnings to Shoulda::Context::Context, which appears to make have use of Proc#bind.

I'm wondering which solution is most likely to be accepted as pull request before going off and doing it.

  1. Reimplement Proc#bind in the shoulda-context gem
  2. Rewrite the parts of lib/shoulda/context/context.rb that use Proc#bind to accomplish the same functionality through some other means.
  3. Something else entirely.

Thanks!

Proc#bind has been deprecated since 4.0.0. 4.0.1 now comes with a new default deprecation behavior:

ActiveSupport::Deprecation.behavior = :raise

https://github.com/rails/rails/blob/v4.0.1/activesupport/CHANGELOG.md#rails-401-november-01-2013

Edit: Maybe it's not the default. But, something has changed with the default behavior.

You can silence the deprecation warning using:

ActiveSupport::Deprecation.behaviour = :silence

I added it after the requires in test_helper.rb

ActiveSupport::Deprecation.behavior = :silence

jbgo commented

Hmm... I'm not typically a big fan of silencing deprecation warnings. I found this instead, which doesn't give me problems: https://github.com/metaskills/minitest-spec-rails#mini_shoulda

Yep, agreed, I wasn't advocating closing just suggesting a temporary workaround. Thanks for the mini_shoulda recommendation.