Sha256: 1b03fe2ceb35788670ad0d7c6547eab89622a9d260a992ae249dec48f888e3f5

Contents?: true

Size: 890 Bytes

Versions: 3

Compression:

Stored size: 890 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class ServiceTest < ActiveSupport::TestCase
  fixtures :requests

  # A service that does nothing!
  class DummyService < Service
    def handle(request)
      return request.dispatched(self, true)
    end
  end

  # A preempted by service that does nothing!
  class PreemptedByDummyService < Service
    def initialize(config)
      @preempted_by = ["existing_service" => "DummyService"]
      super(config)
    end

    def handle(request)
      return request.dispatched(self, true)
    end
  end

  def setup
    @dummy_config =  {"priority" => 1, "service_id" => "DummyService"}
    @umlaut_request = requests(:simple_request)
  end

  test "preempted by wildcard other type" do
    DummyService.new(@dummy_config).handle(@umlaut_request)
    assert(PreemptedByDummyService.new(@dummy_config).preempted_by(@umlaut_request))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
umlaut-3.1.0 ./test/unit/service_test.rb
umlaut-3.1.0.pre2 ./test/unit/service_test.rb
umlaut-3.1.0.pre1 ./test/unit/service_test.rb