Sha256: 57c8302ad9b19545f498dd721c9d4cd452ee2a6239847221e832bbe89624955e

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class ObjectOffWorldTest < Test::Unit::TestCase
  fixtures :objects_off_world

  def test_empty
    oow = ObjectOffWorld.new
    assert !oow.valid?
    assert oow.errors.invalid?(:object_key)
    assert oow.errors.invalid?(:name)
    assert oow.errors.invalid?(:otype)
    assert oow.errors.invalid?(:content)
  end
  
  def test_valid
    oow = ObjectOffWorld.new(:name => "test", :otype => ObjectOffWorld::TYPES[0][1], :content => "http://www.secondlife.com")
    assert oow.valid?
    assert_equal "d54360f1-d526-37dc-37ac-29157f27e575", oow.object_key
  end

  def test_invalid
    oow = ObjectOffWorld.new(:name => "test", :otype => "glop", :content => "http://www.secondlife.com")
    assert !oow.valid?
    assert_equal "is an invalid object type", oow.errors.on(:otype)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
advertnet-1.0.0 test/unit/object_off_world_test.rb
advertnet-1.0.1 test/unit/object_off_world_test.rb