Sha256: 35272c2585688fb92de2bdf98cd8c9fac1646062e2ec629fcaa02fcc706ed4c7

Contents?: true

Size: 1.8 KB

Versions: 17

Compression:

Stored size: 1.8 KB

Contents

require "test_helper"

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

  def test_only_valid_content_should_be_retained_for_mms_with_image_and_text
    mail = mail('virgin-mobile-image-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal "vmpix.com", mms.carrier
    assert_equal 1, mms.media.size
    assert_equal 1, mms.media['image/jpeg'].size
    assert_file_size(mms.media['image/jpeg'].first, 337)
    assert_match(/pic100508_3.jpg$/, mms.media['image/jpeg'].first)
    mms.purge
  end

  def test_number_should_return_correct_number
    mail = mail('virgin-mobile-image-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal "vmpix.com", mms.carrier
    mms.purge
  end

  def test_subject_should_return_correct_subject
    mail = mail('virgin-mobile-image-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal "vmpix.com", mms.carrier
    assert_equal "Jani sleepy", mms.subject
    mms.purge
  end

  def test_attachment_should_return_jpeg
    mail = mail('virgin-mobile-image-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal "vmpix.com", mms.carrier
    image = mms.default_media
    assert_equal 337, image.size
    assert_equal "pic100508_3.jpg", image.original_filename
    mms.purge
  end

  def test_only_valid_content_should_be_retained_for_virgin_canada_text
    mail = mail('virgin.ca-text-01.mail')
    mms = MMS2R::Media.new(mail)
    assert_equal "2068675309", mms.number
    assert_equal 'vmobile.ca', mms.carrier
    assert_equal 1, mms.media.size
    assert_equal 1, mms.media['text/plain'].size
    assert_equal "Hello World", IO.read(mms.media['text/plain'][0]).strip
    mms.purge
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mms2r-3.9.2 test/test_vmpix_com.rb
mms2r-3.9.1 test/test_vmpix_com.rb
mms2r-3.9.0 test/test_vmpix_com.rb
mms2r-3.8.2 test/test_vmpix_com.rb
mms2r-3.8.1 test/test_vmpix_com.rb
mms2r-3.8.0 test/test_vmpix_com.rb
mms2r-3.7.1 test/test_vmpix_com.rb
mms2r-3.7.0 test/test_vmpix_com.rb
mms2r-3.6.4 test/test_vmpix_com.rb
mms2r-3.6.3 test/test_vmpix_com.rb
mms2r-3.6.2 test/test_vmpix_com.rb
mms2r-3.6.1 test/test_vmpix_com.rb
mms2r-3.6.0 test/test_vmpix_com.rb
mms2r-3.5.1 test/test_vmpix_com.rb
mms2r-3.5.0 test/test_vmpix_com.rb
mms2r-3.4.1 test/test_vmpix_com.rb
mms2r-3.4.0 test/test_vmpix_com.rb