combi 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/combi/buses/web_socket.rb +2 -1
- data/lib/combi/version.rb +1 -1
- data/spec/lib/combi/buses/web_socket_spec.rb +50 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78dd33f20d852c8572943aea313669a3c7a1feba
|
4
|
+
data.tar.gz: b73d9394c1e1b803c4d2debfba1a6decb6a6f7e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36f8f1ba1217c342b91d4ce98c4f6f9b7bbcd37e1dd24ebd9bd0050f2e582456ba97aa9dcc489abda2c6fc420c1829c0a6855486262fc2a8f3836f464474209a
|
7
|
+
data.tar.gz: f125020cd1b2162e9b04279e4416b56a960737cba790b2c912feff907c8b272411e72b6d30591bd9487eb1c638b0306c2782514d8ec8b6f02c3582f3a91fbcf2
|
@@ -67,7 +67,7 @@ module Combi
|
|
67
67
|
ws.on :open do |event|
|
68
68
|
@bus.log "OPEN"
|
69
69
|
@bus.log "HANDLER #{@handler.inspect}"
|
70
|
-
@handler.on_open
|
70
|
+
@handler.on_open if @handler.respond_to?(:on_open)
|
71
71
|
@bus.ready.succeed
|
72
72
|
end
|
73
73
|
|
@@ -79,6 +79,7 @@ module Combi
|
|
79
79
|
|
80
80
|
ws.on :close do |event|
|
81
81
|
@bus.log "close #{event.code}: #{event.reason}"
|
82
|
+
@handler.on_close if @handler.respond_to?(:on_close)
|
82
83
|
@ws = ws = nil
|
83
84
|
end
|
84
85
|
|
data/lib/combi/version.rb
CHANGED
@@ -12,7 +12,13 @@ describe 'Combi::WebSocket' do
|
|
12
12
|
end
|
13
13
|
Given(:handler) do
|
14
14
|
Class.new do
|
15
|
-
|
15
|
+
attr_reader :status
|
16
|
+
def on_open
|
17
|
+
@status = 'open'
|
18
|
+
end
|
19
|
+
def on_close
|
20
|
+
@status = 'close'
|
21
|
+
end
|
16
22
|
end.new
|
17
23
|
end
|
18
24
|
|
@@ -31,4 +37,47 @@ describe 'Combi::WebSocket' do
|
|
31
37
|
|
32
38
|
it_behaves_like 'standard_bus'
|
33
39
|
|
40
|
+
Given(:null_service) do
|
41
|
+
Module.new do
|
42
|
+
def actions; [:null]; end
|
43
|
+
def do_it(params)
|
44
|
+
"null"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
context 'it notify when the connection is opened' do
|
51
|
+
Then do
|
52
|
+
em do
|
53
|
+
provider.start!
|
54
|
+
start_em_websocket_server provider, server_port
|
55
|
+
consumer.start!
|
56
|
+
EM::add_timer(0.1) do
|
57
|
+
handler.status.should eq 'open'
|
58
|
+
done
|
59
|
+
provider.stop!
|
60
|
+
consumer.stop!
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'it notify when the connection is closed' do
|
67
|
+
Then do
|
68
|
+
em do
|
69
|
+
provider.start!
|
70
|
+
start_em_websocket_server provider, server_port
|
71
|
+
consumer.start!
|
72
|
+
EM::add_timer(0.1) do
|
73
|
+
provider.stop!
|
74
|
+
consumer.stop!
|
75
|
+
end
|
76
|
+
EM::add_timer(0.3) do
|
77
|
+
handler.status.should eq 'close'
|
78
|
+
done
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
34
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: combi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- German Del Zotto
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
@@ -196,8 +196,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.2.
|
199
|
+
rubygems_version: 2.2.0
|
200
200
|
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Mini Bus for microservices
|
203
203
|
test_files: []
|
204
|
+
has_rdoc:
|