Skip to content

Add spec for Warning.categories #1272

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

herwinw
Copy link
Member

@herwinw herwinw commented May 29, 2025

References #1265

describe "Warning.categories" do
it "returns the list of possible warning categories" do
Warning.categories.sort.should == [:deprecated, :experimental, :performance, :strict_unused_block]
end
Copy link
Member

@andrykonchin andrykonchin May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the list should be hardcoded this way. For instance the last category (:strict_unused_block) isn't documented in https://ruby-doc.org/3.4.1/Warning.html. And I can imagine that some alternative Ruby implementation may provide some additional non-standard categories.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think it's best to check the first 3 are included like .should.include? :deprecated, and not test :strict_unused_block or prohibit other somewhat-implementation-specific categories.

Copy link
Member

@eregon eregon May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. if a Ruby implementation doesn't implement the unused block warning it shouldn't list :strict_unused_block and it should still be able to pass this spec as this list is useful to let gems/users know what kind of warnings are available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants