Sha256: cafb0d03035731a8ddb1109ff249437a7047d63d0fb6f5e43788103fcad1c355

Contents?: true

Size: 1.5 KB

Versions: 10

Compression:

Stored size: 1.5 KB

Contents

require File.join(File.dirname(__FILE__), "..", "lib", "mms2r")
require File.join(File.dirname(__FILE__), "test_helper")
require 'test/unit'
require 'rubygems'
require 'mocha'
gem 'tmail', '>= 1.2.1'
require 'tmail'

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

  def test_subject
    mail = TMail::Mail.parse(load_mail('mediamessaging_o2_co_uk-image-01.mail').join)
    mms = MMS2R::Media.new(mail)
    assert_equal "Office pic", mms.subject
    mms.purge
  end

  def test_image
    mail = TMail::Mail.parse(load_mail('mediamessaging_o2_co_uk-image-01.mail').join)
    mms = MMS2R::Media.new(mail)
  
    assert_equal 2, mms.media.size
    assert_not_nil mms.media['text/plain']
    assert_equal 1, mms.media['text/plain'].size
    assert_not_nil mms.media['image/jpeg']
    assert_equal 1, mms.media['image/jpeg'].size
    assert mms.media['image/jpeg'].detect{|f| File.size(f) == 337}
  
    mms.purge
  end

  def test_default_media_should_return_user_generated_content
    mail = TMail::Mail.parse(load_mail('mediamessaging_o2_co_uk-image-01.mail').join)
    mms = MMS2R::Media.new(mail)
    file = mms.default_media
    assert_equal 337, file.size
    
    mms.purge
  end 

  def test_default_text_should_return_user_generated_content
    mail = TMail::Mail.parse(load_mail('mediamessaging_o2_co_uk-image-01.mail').join)
    mms = MMS2R::Media.new(mail)
    file = mms.default_text
    assert_equal 10, file.size
    assert_equal "Office pic", file.read
    
    mms.purge
  end 
  
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
brendanlim-mms2r-2.2.0.1 test/test_mediamessaging_o2_co_uk.rb
brendanlim-mms2r-2.2.0 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.4.1 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.4.0 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.3.0 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.1.0 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.1.1 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.2.0 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.1.3 test/test_mediamessaging_o2_co_uk.rb
mms2r-2.1.2 test/test_mediamessaging_o2_co_uk.rb