Sha256: ebd09989071fb6b03694884f4adafb5b4b4bd4ee02f5b863a115347876a4db76

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

#
# testing ruote
#
# Sat Oct 23 14:22:15 JST 2010
#

require File.join(File.dirname(__FILE__), 'base')


class FtWfidGeneratorTest < Test::Unit::TestCase
  include FunctionalBase

  # an old test, brought back
  #
  def test_generate_unique_ids

    n = 147

    wfids = []
    n.times { wfids << @engine.context.wfidgen.generate }

    assert_equal n, wfids.uniq.size
  end

  # making a purge! doesn't incapacitate wfid generation
  # (had a false alert when working with @hassox)
  #
  def test_generate_even_after_a_purge

    assert_not_nil @engine.context.wfidgen.generate

    @engine.storage.purge!
    #@engine.context.wfidgen.instance_eval { @last = nil }

    assert_not_nil @engine.context.wfidgen.generate
  end

  def test_generate_after_a_put_failed

    assert_not_nil @engine.context.wfidgen.generate

    @engine.context.wfidgen.instance_eval do
      if @last['_rev'].is_a?(String)
        @last['_rev'] = '1-cc9bc774f00b65ee28a6c0e4f26474de'
      else # integer
        @last['_rev'] = 123456789
      end
    end

    assert_not_nil @engine.context.wfidgen.generate
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ruote-maestrodev-2.2.1 test/functional/ft_47_wfid_generator.rb
ruote-2.2.0 test/functional/ft_47_wfid_generator.rb