/
service_test.rb
47 lines (40 loc) · 1.1 KB
/
service_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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