Sha256: b08fcfd2b16fa9499539b2b4e7347f7dca46329b5b3cf8888b960a785b9f06dc

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

#
# testing ruote
#
# Sun Mar 14 21:25:52 JST 2010
#

require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')

require 'ruote'
require 'ruote/storage/composite_storage'


class UtCompositeStorageTest < Test::Unit::TestCase

  def setup

    @msgs = Ruote::HashStorage.new({})
    @default = Ruote::HashStorage.new({})
    @cs = Ruote::CompositeStorage.new(@default, 'msgs' => @msgs)
  end

  def test_initial

    @cs.put('action' => 'terminate', 'type' => 'msgs', '_id' => 'xxx')
    @cs.put_msg('terminate', 'type' => 'msgs')
    @cs.put_schedule('at', {}, Time.now + 10, 'action' => 'reply')

    assert_equal 0, @default.h['msgs'].size
    assert_equal 1, @default.h['schedules'].size
    assert_equal 2, @cs.get_msgs.size
    assert_equal 2, @msgs.get_msgs.size
    assert_equal 0, @msgs.h['schedules'].size
  end

  def test_delete

    @cs.put('action' => 'terminate', 'type' => 'msgs', '_id' => 'xxx')

    msg = @cs.get_many('msgs').first

    r = @cs.delete(msg)

    assert_nil r
    assert_equal 0, @default.h['msgs'].size
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-2.2.0 test/unit/ut_20_composite_storage.rb