Add better specs to IMAP Gmail extension, and fix parsing labels with spaces #179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This functionality doesn't seem to be getting much use in the wild, because this has been broken for a while and no one's stepped up, but I need it for https://github.com/yn/gmail-splitter, so here goes:
This worked when this file looked like the original version mentioned in the comment (https://github.com/oxos/gmail-oauth-thread-stats/blob/master/gmail_imap_extensions_compatibility.rb) but that version didn't parse spaces in labels correctly.
The version of imap_extensions.rb prior to this PR claimed to parse spaces correctly, but it had no specs and a gnarly off-by-one error that caused parsing errors and extraneous parens in parsed label names.
This PR fixed parsing errors and extraneous parens, and adds tests. The server_response lines in the spec have been copied directly from the wire.
The original version referenced in (1) would do the following: If GMail sent down "\Inbox" or "\Important" in a label, it would convert it to a symbol like :Inbox or :Important
This PR also restores that functionality.