Sha256: 5cbd4da42a3975ea5c3eacc2a0d471a559142a6e56c0e7087ee774fbcabc93d8

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require File.dirname(__FILE__) + "/test_helper"
require 'test/unit'
require 'rubygems'
require 'mms2r'
require 'mms2r/media'
require 'tmail/mail'
require 'logger'


class MMS2RCingularTest < Test::Unit::TestCase
  include MMS2R::TestHelper

  def setup
    @log = Logger.new(STDOUT)
    @log.level = Logger::DEBUG
    @log.datetime_format = "%H:%M:%S"
  end

  def teardown; end

  def test_clean_text_ad
    mail = TMail::Mail.parse(load_mail('cingularme-text-01.mail').join)
    mms = MMS2R::Media.create(mail)
    assert_equal(MMS2R::CingularMedia, mms.class, "expected a #{MMS2R::CingularMedia} and received a #{mms.class}")
    mms.process
    assert_not_nil(mms.media['text/plain'])   
    file = mms.media['text/plain'][0]
    assert_not_nil(file)
    assert(File::exist?(file), "file #{file} does not exist")
    text = IO.readlines("#{file}").join
    ad = "\n--\n===============================================\nBrought to you by, Cingular Wireless Messaging\nhttp://www.CingularMe.COM/"
    assert_no_match(/#{ad}/m, text)
    assert_no_match(/Brought to you by, Cingular Wireless Messaging/, text)
    good_text = "hello world\n\n"
    assert_match(/#{good_text}/m, text)
    mms.purge
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mms2r-1.0.6 test/test_mms2r_cingular.rb