Sha256: eb38d34b74dd0544f6a5d842ed1e41a2f8d07fc3b0a6c4a6be0473e7175ea56a
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'rubygems' require 'mms2r' require 'mms2r/media' require 'tmail/mail' require 'logger' class MMS2RCingularTest < Test::Unit::TestCase def setup @log = Logger.new(STDOUT) @log.level = Logger::DEBUG @log.datetime_format = "%H:%M:%S" end def teadown; 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 private def load_mail(file) IO.readlines("#{File.dirname(__FILE__)}/files/#{file}") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mms2r-1.0.2 | test/test_mms2r_cingular.rb |
mms2r-1.0.3 | test/test_mms2r_cingular.rb |
mms2r-1.0.4 | test/test_mms2r_cingular.rb |