Sha256: 97251fba7fd84199ae2637227b2ff74b5bbb7ea6af04d8d4ceb7028856f59311

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require 'helper'

class TestLifecycle < Test::Unit::TestCase

	include Journeta
	
	@TEST_PORT = 44422

	should "start and stop correctly" do
		begin
			journeta = Engine.new(:peer_port => @TEST_PORT)
			journeta.start
			journeta.stop
			journeta.stop # Double stop is ok!
			assert true
		rescue Exception => e
			flunk "wonkiness in engine lifecycle #{e}"
		end
	end
	
	should "allow stop from stop state" do
		begin
			journeta = Engine.new(:peer_port => @TEST_PORT)
			journeta.stop
			assert true
		rescue Exception => e
			flunk "wonkiness in engine lifecycle #{e}"	
		end
	end
	
	should "not show peers in stopped state" do
		journeta = Engine.new(:peer_port => @TEST_PORT)
		assert_equal 0, journeta.known_peers.size
	end

	should "not show groups in stopped state" do
		journeta = Engine.new
		assert_equal 0, journeta.known_groups.size
	end
	
	should "report address already used upon double-start" do
		begin
			journeta = Engine.new(:peer_port => @TEST_PORT)
			journeta.start
			journeta.start
			flunk "engine should not have started twice"
		rescue Exception => e
			# assert journeta.stop
			assert true
		end
	end
	


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
journeta-1.1.0 test/test_lifecycle.rb
journeta-1.0.1 test/test_lifecycle.rb
journeta-1.0.0 test/test_lifecycle.rb
journeta-0.2.2 test/test_lifecycle.rb
journeta-0.2.1 test/test_lifecycle.rb
journeta-0.2.0 test/test_lifecycle.rb