Sha256: 975b7415d6edb6779eff4c48dfba16022ac4c29578f8ef6e6ceb565e085a0658

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

describe 'MailExtract::Line' do
  def line(str)
    MailExtract::Line.new(str)
  end
  
  it 'detects quote start by date' do
    line('On Tue, 2011-03-01 at 18:02 +0530, somebody wrote:').type.should == :quote
    line('On 2011-03-01 at 18:02 somebody wrote').type.should == :quote
    line('On some day somebody wrote').type.should == :text
  end
  
  it 'detects quote' do
    line('> this is a quote').type.should == :quote
    line('> >> this is a quote').type.should == :quote
  end
  
  it 'detects signature' do
    lines = [
     "--\nUsername",
     "-- \nUsername",
     "_______\nSome text"
    ]
    
    lines.each do |l|
      line(l).type.should == :signature
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mail_extract-0.1.2 spec/line_spec.rb
mail_extract-0.1.1 spec/line_spec.rb
mail_extract-0.1.0 spec/line_spec.rb