Sha256: c8b480588a7350e3ebc74e9117f0c115104a0f848b8a13ecfe1e4408b1bc0417

Contents?: true

Size: 1.57 KB

Versions: 6

Compression:

Stored size: 1.57 KB

Contents

require File.join(File.dirname(__FILE__), "test_helper")

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

  def test_subject_number_image
    mail = mail('alltel-mms-01.mail')
    mms = MMS2R::Media.new(mail)

    assert_equal "", mms.subject
    assert_equal "1234567890", mms.number
    assert_equal "mms.alltel.com", mms.carrier

    assert_equal 1, mms.media.size
    assert_equal 2, mms.media['image/jpeg'].size

    first = mms.media['image/jpeg'].detect{|f| /02-19-08_1709\.jpg/ =~ f}
    second = mms.media['image/jpeg'].detect{|f| /02-19-08_1710\.jpg/ =~ f}
    assert_equal 337, File.size(first)
    assert_equal 337, File.size(second)

    mms.purge
  end

  def test_alltel_image
    mail = mail('alltel-image-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal "message.alltel.com", mms.carrier

    assert_equal 1, mms.media.size
    assert_not_nil mms.media['image/jpeg']
    assert_equal 2, mms.media['image/jpeg'].size
    assert_match(/eastern sky.jpg$/, mms.media['image/jpeg'][0])
    assert_match(/eastern sky.jpg$/, mms.media['image/jpeg'][1])
    assert_file_size mms.media['image/jpeg'][0], 337
    assert_file_size mms.media['image/jpeg'][1], 337

    mms.purge
  end

  def test_default_media_should_return_user_generated_content
    mail = mail('alltel-image-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal "message.alltel.com", mms.carrier
    file = mms.default_media
    assert_equal 'eastern sky.jpg', file.original_filename
    mms.purge
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mms2r-3.3.1 test/test_mms_alltel_com.rb
mms2r-3.3.0 test/test_mms_alltel_com.rb
mms2r-3.2.0 test/test_mms_alltel_com.rb
mms2r-3.1.0 test/test_mms_alltel_com.rb
mms2r-3.0.1 test/test_mms_alltel_com.rb
mms2r-3.0.0 test/test_mms_alltel_com.rb