Sha256: 76f51f5830c3bbc77ab47b00b01df03c7c7c771ce619e16985846ec7bc1a7656

Contents?: true

Size: 1.51 KB

Versions: 4

Compression:

Stored size: 1.51 KB

Contents

#
# testing ruote
#
# Fri Jul 31 10:21:51 JST 2009
#

require 'socket' # just for SocketError

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


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

  def test_sequence

    pdef = %{
<process-definition name="test">
  <sequence>
    <echo>a</echo>
    <echo>b</echo>
  </sequence>
</process-definition>
    }

    #noisy

    assert_trace(pdef, %w[ a b ])
  end

  def test_remote_definitions_not_allowed

    assert_raise ArgumentError do
      @engine.launch('http://defs.example.com/def0.rb')
    end
  end

  def test_remote_definitions_allowed

    @engine.context['remote_definition_allowed'] = true

    e = assert_raise SocketError, OpenURI::HTTPError, ArgumentError do
      @engine.launch('http://defs.example.com/def0.rb')
    end

    assert_not_equal 'remote process definitions are not allowed', e.message
  end

  def test_json_definition

    prev = Rufus::Json.backend

    require 'json'
    Rufus::Json.backend = :json

    #pdef = Ruote.process_definition :name => 'test' do
    #  sequence do
    #    echo 'a'
    #    echo 'b'
    #  end
    #end
    #p pdef.to_json

    assert_trace(
      "[\"define\",{\"name\":\"test\"},[[\"sequence\",{},[[\"echo\",{\"a\":null},[]],[\"echo\",{\"b\":null},[]]]]]]",
      %w[ a b ])

    Rufus::Json.backend = prev
      # back to initial state
  end

  def test_local_definition

    path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'pdef.xml'))

    assert_trace(path, %w[ a b ])
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruote-2.1.7 test/functional/ft_22_process_definitions.rb
ruote-2.1.6 test/functional/ft_22_process_definitions.rb
ruote-2.1.5 test/functional/ft_22_process_definitions.rb
ruote-2.1.4 test/functional/ft_22_process_definitions.rb