-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Extracted silence_stream method to new module in activesupport/testing #18526
Conversation
@@ -55,6 +56,7 @@ def test_order | |||
include ActiveSupport::Testing::Assertions | |||
include ActiveSupport::Testing::Deprecation | |||
include ActiveSupport::Testing::TimeHelpers | |||
include ActiveSupport::Testing::SilenceStream |
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 don't think we want to make it publicly available for people to use outside of the framework, that's why it was deprecated and moved to the places it's currently in use. The best thing we can do is to find a way to share code between those places, without making it available through AS::TestCase
I think.
I agree with @carlosantoniodasilva . My #18381 (comment) was probably not descriptive enough. I think we need to find a new place to share code for our test suites without exposing them through |
d0c0eec
to
8a5b0ba
Compare
I removed the inclusion in |
module ActiveSupport | ||
module Testing | ||
module SilenceStream | ||
def silence_stream(stream) |
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.
You can make the method private here, no need to do that from the callers.
8a5b0ba
to
d6b3ff4
Compare
Done. Can't move in |
Is it being mixed from as/test_case or in some other abstract unit? I don't think it should be in our test case which would make it available for everyone. |
Actually its spread even more- railties abstract unit, railties test isolation, deprecation test, |
I see.. it was probably mixed in those base classes to make it easier to share, but I think they should never be publicly available (this was the original intent, right?). Lets move them out as well, people know these are deprecated and being removed anyway. |
Generators tests doesn't work without these methods. They are internal of these test cases, are not public available, just private methods of a public interface. |
Right, so we are good keeping them there. But they should be moved from elsewhere in our suite. |
d6b3ff4
to
b0b9f5f
Compare
Ok, extracted |
It would be also good to focus on those PRs in the recent past where the warnings have been ignored to due non existence of certain instance variables and like. Using this module, we can reduce the unnecessary checks for those variables. |
Can you show some examples @aditya-kapoor ? In any case I think it's an unrelated discussion. |
|
||
module ActiveRecord | ||
# = Active Record Test Case | ||
# | ||
# Defines some test assertions to test against SQL queries. | ||
class TestCase < ActiveSupport::TestCase #:nodoc: | ||
include ActiveSupport::Testing::Stream |
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.
Can you add a blank line after the inclusion here?
…ing. - Added include for the same in ActiveSupport::Test. - Removed occurrences of silence_stream being used elsewhere. - Reordered activesupport testcase requires alphabetically. - Removed require of silence stream from test_case - Moved quietly method to stream helper - Moved capture output to stream helper module and setup requires for the same elsewhere
b0b9f5f
to
166ce95
Compare
@carlosantoniodasilva updated. |
Extracted silence_stream method to new module in activesupport/testing
cc @senny