-
Notifications
You must be signed in to change notification settings - Fork 23
Introduce config.deprecation_warnings
#161
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
base: main
Are you sure you want to change the base?
Conversation
0249e92
to
c5b0fd8
Compare
Hum, CI fails because of the 100% coverage target, but I don't know how I can satisfy this given some code path are only ever entered by some specific Ruby versions. I'll try to do some static define instead but I don't think it will work. |
f6cd89e
to
c5b0fd8
Compare
Alright, I tried a few workarounds but they're all awful and don't pass the coverage check anyway, so I'll wait for instruction from the maintainers. |
1a11009
to
5d61ea4
Compare
Alright, I believe the remaining errors are unrelated to my changes? |
# Set Ruby deprecation warnings on or off. | ||
def deprecation_warnings=(value) | ||
@deprecation_warnings_set = true | ||
::Warning[:deprecated] = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'd rather we overload warnings=
here to be one of: false
:deprecations_only
:all
or true
where true has the same effect as :all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that make sense, one downside I can think of however if that since regular warnings are quite verbose, it's likely that a bunch of projects have warnings = false
and won't ever know about deprecation warnings.
So while I agree making it a difference config is a bit less clean, it give every RSpec user the opportunity to know about it.
But that's your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that risk is low as false was the default, but I propose that the setting be :none
, :deprecations_only
and :all
with true
/false
synonyms for :all
/:none
that in turn issue an RSpec deprecation warning asking people to update to the specifics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. Ok, I'll try to implement that then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I think I implemented what you suggested. I'm not really familiar with RSpec codebase though, so hopefully it's implemented the proper way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last change, can we wrap this up into the above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I don't think I understand what you mean by that.
5d61ea4
to
d13009c
Compare
Hello Jean I see two failures in feature specs.
It happens in the CI after the simplecove coverage tests... The issue seems related to how we try to report caller lines when using Quick and dirty. --- a/rspec-support/lib/rspec/support/caller_filter.rb
+++ b/rspec-support/lib/rspec/support/caller_filter.rb
@@ -65,7 +65,7 @@ module RSpec
loop do
stack = caller_locations(skip_frames, increment)
- raise "No non-lib lines in stack" unless stack
+ break unless stack Snippet to reproduce. require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem 'rspec', path: '../rspec'
end
require 'rspec/autorun'
RSpec.describe 'Joyeux Noël' do
it do
expect({ :a => 1, :b => 2 }).not_to include(:a, :b)
end
end |
e835fa6
to
1e1fd1d
Compare
I fixed the typos in the message. For the remaining failures, I don't know what to do, so I'll await further instructions. |
1e1fd1d
to
f654aaa
Compare
c836b7c
to
5aec383
Compare
5aec383
to
fc98e40
Compare
The remaining failures are what @benoittgt pointed out. Both failing scenarios are related to
It fails because it's emitting a warning about |
Thanks for the fix, I was a bit stuck because of my limited knowledge of rspec. One of the spec I added now complains but I can fix that. |
9615fb1
to
94f50cf
Compare
I don't mind reverting my last commit and merging this PR as is, as this failure seems largely unrelated to this PR. @JonRowe WDYT? My apologies for the inconvenience, we've just changed the repo structure dramatically, and it may have some rough edges |
bad2075
to
496c493
Compare
💚 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks !
Apologies for the delay in getting back to this some build failures and work have sucked up all my free time, its on my list to get this in this week. |
Can we also back out the unrelated changes for the other specs, @pirj if you'd like to work on another PR for those I'm happy to review that. |
94f50cf
to
6d351b1
Compare
@JonRowe Done |
Fix: rspec#37 Since Ruby 2.7.2, Ruby expect test frameworks to enable deprecation warnings so users get advance notice of future breaking changes.
6d351b1
to
cf7298c
Compare
Sorry for the silence on this, I'm going to merge this manually when I get the time to split it into 3.x and 4.x capable patches, but no input is needed beyond that. |
Fix: #37
Since Ruby 2.7.2, Ruby expect test frameworks to enable deprecation warnings so users get advance notice of future breaking changes.
I implemented it as specified in #37 (comment)