thoughtbot / griddler

Simplify receiving email in Rails (deprecated)
http://griddler.io/
MIT License
1.38k stars 199 forks source link

Body parse fails when there is no content before -----Original Message----- #70

Closed vahtel closed 11 years ago

vahtel commented 11 years ago

NoMethodError: undefined method `gsub' for nil:NilClass

vendor/bundle/ruby/1.9.1/bundler/gems/griddler-a9a4458c87ae/lib/griddler/email_parser.rb:29

This should be a failing test case:

  it 'handles "-----Original Message-----" format' do
    body = <<-EOF
      -----Original Message-----
      From: bob@example.com
      Sent: Today
      Subject: Awesome report.

      Check out this report!
    EOF

    body_from_email(:text, body).should eq ''
  end

Failures:

  1) Griddler::Email body formatting handles "-----Original Message-----" format
     Failure/Error: email = Griddler::Email.new(params).process
     NoMethodError:
       undefined method `gsub' for nil:NilClass
     # ./lib/griddler/email_parser.rb:29:in `extract_reply_body'
     # ./lib/griddler/email.rb:55:in `extract_body'
     # ./lib/griddler/email.rb:16:in `initialize'
     # ./spec/griddler/email_spec.rb:233:in `new'
     # ./spec/griddler/email_spec.rb:233:in `body_from_email'
     # ./spec/griddler/email_spec.rb:97:in `block (2 levels) in <top (required)>'
calebhearth commented 11 years ago

I believe this is the same issue as https://github.com/thoughtbot/griddler/pull/64, which is not in the latest release version 0.5.0. I or @jayroh can cut a new release as soon as we have a few minutes.

vahtel commented 11 years ago

I tested with master, #64 is merged, looks like something else.

calebhearth commented 11 years ago

Awesome. Will you start a PR with only the failing test, so that we can just check that out and make it pass? You're welcome to take a crack at it as well, if you have the time.

theycallmeswift commented 11 years ago

This was closed by 6a11938