test/websocket/api_channel_test.rb in bixby-common-0.4.5 vs test/websocket/api_channel_test.rb in bixby-common-0.4.6
- old
+ new
@@ -20,11 +20,11 @@
attr_reader :api_chan, :ws
def setup
@em_thread = Thread.new { EM.run{} }
@ws = mock()
- @api_chan = Bixby::WebSocket::APIChannel.new(ws, TestHandler)
+ @api_chan = Bixby::WebSocket::APIChannel.new(ws, SampleHandler)
end
def test_open
refute api_chan.connected?
api_chan.open(nil)
@@ -48,11 +48,11 @@
cr = CommandResponse.new(:status => 0, :stdout => "foobar", :stderr => "")
json_res = JsonResponse.new("success", nil, cr.to_hash)
event = mock()
event.expects(:data).once.returns(req.to_wire)
- TestHandler.any_instance.expects(:handle).with{ |r| r == json_req }.returns(json_res)
+ SampleHandler.any_instance.expects(:handle).with{ |r| r == json_req }.returns(json_res)
ws.expects(:send).once.with { |str|
res = Bixby::WebSocket::Message.from_wire(str)
!res.nil? && res.json_response.to_wire == json_res.to_wire
}
api_chan.message(event)
@@ -80,17 +80,17 @@
signed_json_req = SignedJsonRequest.new(json_req, "foo", "bar")
req = Bixby::WebSocket::Request.new(signed_json_req, nil, "connect")
event = mock()
event.expects(:data).once.returns(req.to_wire)
- TestHandler.any_instance.expects(:connect).with(json_req, api_chan)
+ SampleHandler.any_instance.expects(:connect).with(json_req, api_chan)
api_chan.message(event)
end
def test_close
# close
api_chan.open(nil)
- TestHandler.any_instance.expects(:disconnect).with(api_chan).once()
+ SampleHandler.any_instance.expects(:disconnect).with(api_chan).once()
api_chan.close(nil)
end
end