Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Skip output check if output not defined on formatter #2916

Merged

Conversation

niceking
Copy link
Contributor

If a custom formatter doesn't subclass the BaseTextFormatter it doesn't have the output method, then the duplicate formatter check throws a "undefined method output" error, just PR just skips that part of the check if the output 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 😛

@@ -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) &&
Copy link
Contributor Author

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 🤔

@JonRowe
Copy link
Member

JonRowe commented Oct 30, 2021

Can you add a spec for this?

@niceking niceking force-pushed the bypass-output-check-when-output-undefined branch from 47eb66c to c9cefaf Compare November 4, 2021 22:17
@niceking
Copy link
Contributor Author

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 🙈

@niceking
Copy link
Contributor Author

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:

WARNING: jruby-1.7.0 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

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? 🤷‍♀️

@pirj
Copy link
Member

pirj commented Nov 19, 2021

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

@niceking
Copy link
Contributor Author

Ok... so does this PR need anything else?

@JonRowe
Copy link
Member

JonRowe commented Dec 10, 2021

Merging despite build failure as its unrelated, thanks @niceking and sorry it took so long to finalise this.

@JonRowe JonRowe merged commit fd8aaea into rspec:main Dec 10, 2021
JonRowe added a commit that referenced this pull request Dec 10, 2021
…t-undefined

Skip output check if output not defined on formatter
JonRowe added a commit that referenced this pull request Dec 10, 2021
JonRowe added a commit that referenced this pull request Dec 10, 2021
…t-undefined

Skip output check if output not defined on formatter
JonRowe added a commit that referenced this pull request Dec 10, 2021
JonRowe added a commit that referenced this pull request Dec 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants