Sha256: 2f71dc6e06485bd8224d31e3c7c5509af87180e0b398f4d17df2f2b902ff9514

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'

class ServiceTest < Test::Unit::TestCase
  context "A Service" do
    should "be creatable with host and port" do
      svc = BERTRPC::Service.new('localhost', 9941)
      assert svc.is_a?(BERTRPC::Service)
    end

    should "be creatable with host, port, and timeout" do
      svc = BERTRPC::Service.new('localhost', 9941, 5)
      assert svc.is_a?(BERTRPC::Service)
    end
  end

  context "A Service Instance's" do
    setup do
      @svc = BERTRPC::Service.new('localhost', 9941)
    end

    context "accessors" do
      should "return it's host" do
        assert_equal 'localhost', @svc.host
      end

      should "return it's port" do
        assert_equal 9941, @svc.port
      end
    end

    context "call method" do
      should "return a call type Request" do
        req = @svc.call
        assert req.is_a?(BERTRPC::Request)
        assert_equal :call, req.kind
      end
    end

    context "cast method" do
      should "return a cast type Request" do
        req = @svc.cast
        assert req.is_a?(BERTRPC::Request)
        assert_equal :cast, req.kind
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
bertrpc-1.3.1 test/service_test.rb
fd-bertrpc-1.3.1 test/service_test.rb
fd-bertrpc-1.3.0 test/service_test.rb
bertrpc-1.3.0 test/service_test.rb
bertrpc-1.2.1 test/service_test.rb
bertrpc-1.2.0 test/service_test.rb
bertrpc-0.4.2 test/service_test.rb
bertrpc-1.1.2 test/service_test.rb
bertrpc-0.4.1 test/service_test.rb
bertrpc-1.1.1 test/service_test.rb
bertrpc-1.1.0 test/service_test.rb