-
-
Notifications
You must be signed in to change notification settings - Fork 753
Skip output check if output not defined on formatter #2916
Skip output check if output not defined on formatter #2916
Conversation
lib/rspec/core/formatters.rb
Outdated
@@ -194,7 +194,9 @@ def register(formatter, notifications) | |||
|
|||
def duplicate_formatter_exists?(new_formatter) | |||
@formatters.any? do |formatter| | |||
formatter.class == new_formatter.class && formatter.output == new_formatter.output | |||
formatter.class == new_formatter.class && | |||
formatter.respond_to?(:output) == new_formatter.respond_to?(:output) && |
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.
Not sure if this line is overkill 🤔
Can you add a spec for this? |
47eb66c
to
c9cefaf
Compare
Heyo just a bump on this, I added a commit but didn't add a comment so perhaps you didn't see it!! I have no idea what the etiquette is here 🙈 |
Uhhhhh so I see there's a failing spec on JRuby 1.7....unclear whether this is related to my changes or not? The failing test seems unrelated but it is also inspecting the output so I guess it might be related to my changes 🤷♀️ Anyways I attempted to install JRuby 1.7.0 to run the cuces locally and got this fun message:
And also installation didn't succeed because my version of openjdk (17.0.1) is also too new... At which point I gave up! Not sure how to proceed here? There also doesn't seem to be error message for why the test is failing? Perhaps there is no output string outputted? 🤷♀️ |
No worries on the JRuby 1.7 build, it's known to periodically fail on the bisect scenario, e.g https://github.com/rspec/rspec-core/actions/runs/1416457643 |
Ok... so does this PR need anything else? |
Merging despite build failure as its unrelated, thanks @niceking and sorry it took so long to finalise this. |
…t-undefined Skip output check if output not defined on formatter
…t-undefined Skip output check if output not defined on formatter
If a custom formatter doesn't subclass the
BaseTextFormatter
it doesn't have theoutput
method, then the duplicate formatter check throws a "undefined method output" error, just PR just skips that part of the check if theoutput
method isn't defined.Also I've noticed in the documentation for custom formatters that the text recommends subclassing from
BaseTextFormatter
but the example doesn't show that? I totally just read the code and skimmed the text 😛