Sha256: 1280bbe746aaa6ae9a7e8357b2c33843b7ce7ee955bcdb7b36161f406114f347

Contents?: true

Size: 993 Bytes

Versions: 13

Compression:

Stored size: 993 Bytes

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 MMS2R::MModeMediaTest < 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_simple
    mail = TMail::Mail.parse(load_mail('mmode-image-01.mail').join)
    mms = MMS2R::Media.create(mail)
    assert_equal(MMS2R::MModeMedia, mms.class, "expected a #{MMS2R::MModeMedia} and received a #{mms.class}")
    mms.process

    assert(mms.media.size == 1)
    assert_nil(mms.media['text/plain'])
    assert_nil(mms.media['text/html'])
    assert_not_nil(mms.media['image/jpeg'][0])
    assert_match(/picture\(3\).jpg$/, mms.media['image/jpeg'][0])

    assert_file_size(mms.media['image/jpeg'][0], 337)
    mms.purge
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mms2r-1.1.0 test/test_mms2r_m_mode_media.rb
mms2r-1.1.1 test/test_mms2r_m_mode_media.rb
mms2r-1.1.10 test/test_mms2r_m_mode_media.rb
mms2r-1.1.2 test/test_mms2r_m_mode_media.rb
mms2r-1.1.3 test/test_mms2r_m_mode_media.rb
mms2r-1.1.4 test/test_mms2r_m_mode_media.rb
mms2r-1.1.5 test/test_mms2r_m_mode_media.rb
mms2r-1.1.6 test/test_mms2r_m_mode_media.rb
mms2r-1.1.11 test/test_mms2r_m_mode_media.rb
mms2r-1.1.12 test/test_mms2r_m_mode_media.rb
mms2r-1.1.7 test/test_mms2r_m_mode_media.rb
mms2r-1.1.8 test/test_mms2r_m_mode_media.rb
mms2r-1.1.9 test/test_mms2r_m_mode_media.rb