jstp 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,10 @@ module JSTP
7
7
  # Discovers the server and sends the message
8
8
  # @param [Hash/Array] message
9
9
  def dispatch message
10
- client(message["resource"]).send_msg message.to_json
10
+ this_client = client(message["resource"])
11
+ this_client.callback do
12
+ this_client.send_msg message.to_json
13
+ end
11
14
  end
12
15
 
13
16
  # Access to the client pool
@@ -1,3 +1,3 @@
1
1
  module Jstp
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -32,16 +32,21 @@ describe JSTP::Connector do
32
32
  end
33
33
 
34
34
  it 'should open a websocket to the correct resource in the standard port 33333 and set the callback' do
35
+ pending "I'm unable to test this properly since providing a Proc will make me lose scope for the client"
35
36
  JSTP::Connector.instance.should_receive(:client)
36
37
  .with(@message["resource"])
37
38
  .and_return @web_socket_client
38
39
 
40
+ @web_socket_client.should_receive(:callback)
41
+
39
42
  @web_socket_client.should_receive(:send_msg)
40
43
  .with(@message_json)
41
44
  @message.should_receive(:to_json).and_return @message_json
42
45
 
43
46
  JSTP::Connector.instance.dispatch @message
44
47
  end
48
+
49
+ it 'should attach the callback to the client so the message is actually delivered!'
45
50
  end
46
51
 
47
52
  describe '#client' do
@@ -76,4 +81,4 @@ describe JSTP::Connector do
76
81
  pending "Warning, this isn't actually testing the JSTP::Server, I don't know why"
77
82
  end
78
83
  end
79
- end
84
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-05 00:00:00.000000000 Z
14
+ date: 2013-01-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: em-websocket