Sha256: 12df99f6d2e163a04d946795ef134f1af07947eae04ae8a2793cdef5d4da1b67

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

$LOAD_PATH.unshift File.expand_path('../..', File.dirname(__FILE__))
require 'roby/test/common'
require 'flexmock'

class TC_EnsuredEvent < Test::Unit::TestCase
    include Roby::Test

    def test_ensure
	setup = lambda do |mock|
	    e1, e2 = EventGenerator.new(true), Roby::EventGenerator.new(true)
	    plan.discover [e1, e2]
	    e1.ensure e2
	    e1.on { mock.e1 }
	    e2.on { mock.e2 }
	    [e1, e2]
	end
	FlexMock.use do |mock|
	    e1, e2 = setup[mock]
	    mock.should_receive(:e2).ordered.once
	    mock.should_receive(:e1).ordered.once
	    e1.call(nil)
	end
	FlexMock.use do |mock|
	    e1, e2 = setup[mock]
	    mock.should_receive(:e1).never
	    mock.should_receive(:e2).once
	    e2.call(nil)
	end
	FlexMock.use do |mock|
	    e1, e2 = setup[mock]
	    mock.should_receive(:e2).ordered.once
	    mock.should_receive(:e1).ordered.once
	    e2.call(nil)
	    e1.call(nil)
	end
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roby-0.7.2 test/relations/test_ensured.rb
roby-0.7.1 test/relations/test_ensured.rb
roby-0.7.3 test/relations/test_ensured.rb
roby-0.7 test/relations/test_ensured.rb