Sha256: 5bc5773fbe5afea6103086b5ddd5e6f6927e20e1aa33d715c1b29dd8822ab3f8

Contents?: true

Size: 1.71 KB

Versions: 14

Compression:

Stored size: 1.71 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe MList::Util::EmailHelpers do
  include MList::Util::EmailHelpers
  
  %w(nothing_special ascii_art reply_quoting reply_quoting_deeper bullets bullets_leading_space).each do |text_source_name|
    specify "text_to_html should convert #{text_source_name}" do
      source_text = text_fixture(text_source_name)
      expected_text = text_fixture("#{text_source_name}.html")
      text_to_html(source_text).should == expected_text
    end
  end
  
  specify 'text_to_quoted should prepend >' do
    text_to_quoted(text_fixture('nothing_special')).should == text_fixture('nothing_special_quoted')
  end
  
  describe 'remove_regard' do
    it 'should remove regardless of case' do
      remove_regard('Re: [Label] Subject').should == '[Label] Subject'
      remove_regard('RE: [Label] Subject').should == '[Label] Subject'
    end
    
    it 'should not bother [] labels when multiple re:' do
      remove_regard('Re: [Label] Re: Subject').should == '[Label] Subject'
    end
    
    it 'should remove multiple re:' do
      remove_regard('Re: Re: Test').should == 'Test'
      remove_regard('Re:  Re: Subject').should == 'Subject'
    end
  end
  
  describe 'html_to_text' do
    it 'should handle real life example' do
      html_to_text(html_fixture('real_life')).should == html_fixture('real_life.txt')
    end
    
    it 'should handle lists' do
      html_to_text('<p>Fruits</p>  <ul><li>Apples</li><li>Oranges</li><li>Bananas</li></ul>').should == %{Fruits\n\n * Apples\n\n * Oranges\n\n * Bananas}
    end
    
    it 'should handle lots of non-breaking space' do
      html_to_text(html_fixture('nbsp')).should == html_fixture('nbsp.txt')
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mlist-0.1.23 spec/models/util/email_helpers_spec.rb
mlist-0.1.22 spec/models/util/email_helpers_spec.rb
mlist-0.1.21 spec/models/util/email_helpers_spec.rb
mlist-0.1.20 spec/models/util/email_helpers_spec.rb
mlist-0.1.19 spec/models/util/email_helpers_spec.rb
mlist-0.1.18 spec/models/util/email_helpers_spec.rb
mlist-0.1.17 spec/models/util/email_helpers_spec.rb
mlist-0.1.16 spec/models/util/email_helpers_spec.rb
mlist-0.1.14 spec/models/util/email_helpers_spec.rb
mlist-0.1.13 spec/models/util/email_helpers_spec.rb
mlist-0.1.12 spec/models/util/email_helpers_spec.rb
mlist-0.1.11 spec/models/util/email_helpers_spec.rb
mlist-0.1.10 spec/models/util/email_helpers_spec.rb
mlist-0.1.9 spec/models/util/email_helpers_spec.rb