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

Don't modify input string in place #2

Merged
merged 1 commit into from Sep 5, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/email_reply_parser.rb
Expand Up @@ -62,7 +62,7 @@ def initialize
def read(text)
# The text is reversed initially due to the way we check for hidden
# fragments.
text.reverse!
text = text.reverse

# This determines if any 'visible' Fragment has been found. Once any
# visible Fragment is found, stop looking for hidden ones.
Expand Down
6 changes: 6 additions & 0 deletions test/email_reply_parser_test.rb
Expand Up @@ -71,6 +71,12 @@ def test_recognizes_date_string_above_quote
assert_match /Loader/, reply.fragments[1].to_s
end

def test_does_not_modify_input_string
original = "The Quick Brown Fox Jumps Over The Lazy Dog"
EmailReplyParser.read original
assert_equal "The Quick Brown Fox Jumps Over The Lazy Dog", original
end

def email(name)
body = IO.read EMAIL_FIXTURE_PATH.join("#{name}.txt").to_s
EmailReplyParser.read body
Expand Down