Sha256: 0895e8b5c015a8e075eb7ed8dc0acc5071ddc3aa10bb91e9182d5652d7ed2e84

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

#
# testing ruote
#
# Thu Dec 24 18:05:39 JST 2009
#

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


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

  class MyService

    attr_reader :context, :options

    def initialize(context, options={})

      @context = context
      @options = options
    end
  end

  def test_as_path_class

    @engine.add_service('toto', 'ruote', 'FtAddServiceTest::MyService')

    assert_equal MyService, @engine.context.toto.class
  end

  def test_as_instance

    @engine.add_service('toto', MyService.new(nil))

    assert_equal MyService, @engine.context.toto.class
  end

  def test_as_path_class_options

    @engine.add_service(
      'toto', 'ruote', 'FtAddServiceTest::MyService', 'colour' => 'blue')

    assert_equal MyService, @engine.context.toto.class
    assert_equal 'blue', @engine.context.toto.options['colour']
  end

  def test_add_service_returns_service

    toto = @engine.add_service(
      'toto', 'ruote', 'FtAddServiceTest::MyService', 'colour' => 'blue')

    assert_equal MyService, toto.class
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

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