Skip to content
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

Fix MIME spec examples to not collide with actual registry #8795

Merged

Conversation

straight-shoota
Copy link
Member

Fixes #8793

Prefixing the file extensions should make sure they don't match any existing values in the system's MIME registry.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking labels Feb 12, 2020
Copy link

@DanielDavis5 DanielDavis5 left a comment

Choose a reason for hiding this comment

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

Granted that name will probably never conflict, wouldn't it just be better to reset and reinit with the loaddefaults set to false?

@straight-shoota
Copy link
Member Author

I'm sure there was a reason why I didn't do that in the first place. But I don't recall. It looks you might be right.

@straight-shoota
Copy link
Member Author

Updated the specs to call MIME.reset and MIME.init(load_defaults: false). Also added that to all other specs.

@Blacksmoke16
Copy link
Member

Might be a good usecase for before_each hook now that those exist?

@RX14
Copy link
Member

RX14 commented Feb 14, 2020

around_each would abstract the whole thing with no changes to specs, I think.

@RX14
Copy link
Member

RX14 commented Feb 19, 2020

@straight-shoota want to work on this or should this be merged without any changes to get the specs suite fixed?

@straight-shoota
Copy link
Member Author

Rebased on master and changed to use spec hooks.

Comment on lines +18 to +24
before_each do
MIME.reset!
end

after_each do
MIME.reset!
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use around_each instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does it make a difference? around_each is for when you need to share state between setup and teardown steps. There's no locally shared state here, so can just use before and after hooks.

@straight-shoota straight-shoota merged commit b72404a into crystal-lang:master Feb 20, 2020
@straight-shoota straight-shoota deleted the fix/mime-type-example branch February 20, 2020 23:30
@straight-shoota straight-shoota added this to the 0.34.0 milestone Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std_spec fails when 'bar' is a valid MIME type extension
5 participants