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

Zero-width space doesn't result in nil after stripping #46

Closed

Conversation

aried3r
Copy link
Contributor

@aried3r aried3r commented Feb 13, 2020

This is more a question instead of a PR. While using this gem in our codebase we discovered that while strings like "\n\t\ " result in nil, "\u200B" results in the empty string. Is this intended behavior?

You can see the failing test in this PR.

@@ -124,6 128,8 @@ def test_should_strip_all_fields
assert_equal "fiz \n fiz", record.fiz
assert_nil record.baz
assert_nil record.bang
assert_nil record.qax
assert_nil record.qux
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Failure:
StripAttributesTest#test_should_strip_all_fields [/home/travis/build/rmm5t/strip_attributes/test/strip_attributes_test.rb:132]
Minitest::Assertion: Expected "" to be nil.

@rmm5t
Copy link
Owner

rmm5t commented Feb 14, 2020

Good catch. I'd agree that the existing behavior is a problem and your desired test is the correct behavior. I'll try to fix this shortly.

@rmm5t
Copy link
Owner

rmm5t commented Feb 14, 2020

@aried3r Thank you for this. v1.9.1 is now released with this fix.
https://rubygems.org/gems/strip_attributes

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.

2 participants