faye 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of faye might be problematic. Click here for more details.
- data/History.txt +16 -10
- data/README.rdoc +1 -1
- data/lib/faye-browser-min.js +1 -1
- data/lib/faye-browser-min.js.map +2 -2
- data/lib/faye-browser.js +302 -287
- data/lib/faye.rb +21 -21
- data/lib/faye/adapters/rack_adapter.rb +50 -48
- data/lib/faye/adapters/static_server.rb +22 -22
- data/lib/faye/engines/connection.rb +13 -13
- data/lib/faye/engines/memory.rb +21 -21
- data/lib/faye/engines/proxy.rb +23 -23
- data/lib/faye/error.rb +6 -6
- data/lib/faye/mixins/logging.rb +12 -12
- data/lib/faye/mixins/publisher.rb +6 -6
- data/lib/faye/mixins/timeouts.rb +1 -1
- data/lib/faye/protocol/channel.rb +24 -24
- data/lib/faye/protocol/client.rb +71 -73
- data/lib/faye/protocol/extensible.rb +7 -7
- data/lib/faye/protocol/grammar.rb +13 -13
- data/lib/faye/protocol/server.rb +57 -57
- data/lib/faye/protocol/socket.rb +4 -4
- data/lib/faye/protocol/subscription.rb +4 -4
- data/lib/faye/transport/http.rb +13 -13
- data/lib/faye/transport/local.rb +5 -5
- data/lib/faye/transport/transport.rb +25 -25
- data/lib/faye/transport/web_socket.rb +34 -30
- data/lib/faye/util/namespace.rb +4 -4
- data/spec/browser.html +5 -5
- data/spec/javascript/channel_spec.js +3 -3
- data/spec/javascript/client_spec.js +104 -98
- data/spec/javascript/engine/memory_spec.js +1 -1
- data/spec/javascript/engine_spec.js +70 -70
- data/spec/javascript/faye_spec.js +6 -6
- data/spec/javascript/grammar_spec.js +12 -12
- data/spec/javascript/node_adapter_spec.js +46 -46
- data/spec/javascript/publisher_spec.js +4 -4
- data/spec/javascript/server/connect_spec.js +21 -21
- data/spec/javascript/server/disconnect_spec.js +15 -15
- data/spec/javascript/server/extensions_spec.js +6 -6
- data/spec/javascript/server/handshake_spec.js +18 -18
- data/spec/javascript/server/integration_spec.js +23 -23
- data/spec/javascript/server/publish_spec.js +9 -9
- data/spec/javascript/server/subscribe_spec.js +30 -30
- data/spec/javascript/server/unsubscribe_spec.js +30 -30
- data/spec/javascript/server_spec.js +15 -15
- data/spec/javascript/transport_spec.js +32 -27
- data/spec/node.js +2 -2
- data/spec/ruby/channel_spec.rb +2 -2
- data/spec/ruby/client_spec.rb +100 -92
- data/spec/ruby/engine_examples.rb +51 -51
- data/spec/ruby/faye_spec.rb +5 -5
- data/spec/ruby/grammar_spec.rb +12 -12
- data/spec/ruby/publisher_spec.rb +4 -4
- data/spec/ruby/rack_adapter_spec.rb +34 -34
- data/spec/ruby/server/connect_spec.rb +22 -22
- data/spec/ruby/server/disconnect_spec.rb +16 -16
- data/spec/ruby/server/extensions_spec.rb +8 -8
- data/spec/ruby/server/handshake_spec.rb +20 -20
- data/spec/ruby/server/integration_spec.rb +22 -24
- data/spec/ruby/server/publish_spec.rb +9 -9
- data/spec/ruby/server/subscribe_spec.rb +31 -31
- data/spec/ruby/server/unsubscribe_spec.rb +31 -31
- data/spec/ruby/server_spec.rb +17 -17
- data/spec/ruby/transport_spec.rb +23 -23
- data/spec/testswarm +23 -10
- data/spec/thin_proxy.rb +5 -5
- metadata +90 -59
@@ -3,16 +3,16 @@ JS.ENV.Server.PublishSpec = JS.Test.describe("Server publish", function() { with
|
|
3
3
|
this.engine = {}
|
4
4
|
stub(Faye.Engine, "get").returns(engine)
|
5
5
|
this.server = new Faye.Server()
|
6
|
-
|
6
|
+
|
7
7
|
this.message = {channel: "/some/channel", data: "publish"}
|
8
8
|
}})
|
9
|
-
|
9
|
+
|
10
10
|
describe("publishing a message", function() { with(this) {
|
11
11
|
it("tells the engine to publish the message", function() { with(this) {
|
12
12
|
expect(engine, "publish").given(message)
|
13
13
|
server.process(message, false, function() {})
|
14
14
|
}})
|
15
|
-
|
15
|
+
|
16
16
|
it("returns a successful response", function() { with(this) {
|
17
17
|
stub(engine, "publish")
|
18
18
|
server.process(message, false, function(response) {
|
@@ -23,17 +23,17 @@ JS.ENV.Server.PublishSpec = JS.Test.describe("Server publish", function() { with
|
|
23
23
|
], response)
|
24
24
|
})
|
25
25
|
}})
|
26
|
-
|
26
|
+
|
27
27
|
describe("with an invalid channel", function() { with(this) {
|
28
28
|
before(function() { with(this) {
|
29
29
|
message.channel = "channel"
|
30
30
|
}})
|
31
|
-
|
31
|
+
|
32
32
|
it("does not tell the engine to publish the message", function() { with(this) {
|
33
33
|
expect(engine, "publish").exactly(0)
|
34
34
|
server.process(message, false, function() {})
|
35
35
|
}})
|
36
|
-
|
36
|
+
|
37
37
|
it("returns an unsuccessful response", function() { with(this) {
|
38
38
|
stub(engine, "publish")
|
39
39
|
server.process(message, false, function(response) {
|
@@ -46,17 +46,17 @@ JS.ENV.Server.PublishSpec = JS.Test.describe("Server publish", function() { with
|
|
46
46
|
})
|
47
47
|
}})
|
48
48
|
}})
|
49
|
-
|
49
|
+
|
50
50
|
describe("with an error", function() { with(this) {
|
51
51
|
before(function() { with(this) {
|
52
52
|
message.error = "invalid"
|
53
53
|
}})
|
54
|
-
|
54
|
+
|
55
55
|
it("does not tell the engine to publish the message", function() { with(this) {
|
56
56
|
expect(engine, "publish").exactly(0)
|
57
57
|
server.process(message, false, function() {})
|
58
58
|
}})
|
59
|
-
|
59
|
+
|
60
60
|
it("returns an unsuccessful response", function() { with(this) {
|
61
61
|
stub(engine, "publish")
|
62
62
|
server.process(message, false, function(response) {
|
@@ -4,7 +4,7 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
4
4
|
stub(Faye.Engine, "get").returns(engine)
|
5
5
|
this.server = new Faye.Server()
|
6
6
|
}})
|
7
|
-
|
7
|
+
|
8
8
|
describe("#subscribe", function() { with(this) {
|
9
9
|
before(function() { with(this) {
|
10
10
|
this.clientId = "fakeclientid"
|
@@ -12,17 +12,17 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
12
12
|
clientId: "fakeclientid",
|
13
13
|
subscription: "/foo"}
|
14
14
|
}})
|
15
|
-
|
15
|
+
|
16
16
|
describe("with valid parameters", function() { with(this) {
|
17
17
|
before(function() { with(this) {
|
18
18
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
19
19
|
}})
|
20
|
-
|
20
|
+
|
21
21
|
it("subscribes the client to the channel", function() { with(this) {
|
22
22
|
expect(engine, "subscribe").given(clientId, "/foo")
|
23
23
|
server.subscribe(message, false, function() {})
|
24
24
|
}})
|
25
|
-
|
25
|
+
|
26
26
|
it("returns a successful response", function() { with(this) {
|
27
27
|
stub(engine, "subscribe")
|
28
28
|
server.subscribe(message, false, function(response) {
|
@@ -34,18 +34,18 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
34
34
|
}, response)
|
35
35
|
})
|
36
36
|
}})
|
37
|
-
|
37
|
+
|
38
38
|
describe("with a list of subscriptions", function() { with(this) {
|
39
39
|
before(function() { with(this) {
|
40
40
|
message.subscription = ["/foo", "/bar"]
|
41
41
|
}})
|
42
|
-
|
42
|
+
|
43
43
|
it("creates multiple subscriptions", function() { with(this) {
|
44
44
|
expect(engine, "subscribe").given(clientId, "/foo")
|
45
45
|
expect(engine, "subscribe").given(clientId, "/bar")
|
46
46
|
server.subscribe(message, false, function() {})
|
47
47
|
}})
|
48
|
-
|
48
|
+
|
49
49
|
it("returns a successful response", function() { with(this) {
|
50
50
|
stub(engine, "subscribe")
|
51
51
|
server.subscribe(message, false, function(response) {
|
@@ -58,17 +58,17 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
58
58
|
})
|
59
59
|
}})
|
60
60
|
}})
|
61
|
-
|
61
|
+
|
62
62
|
describe("with a subscription pattern", function() { with(this) {
|
63
63
|
before(function() { with(this) {
|
64
64
|
message.subscription = "/foo/**"
|
65
65
|
}})
|
66
|
-
|
66
|
+
|
67
67
|
it("subscribes the client to the channel pattern", function() { with(this) {
|
68
68
|
expect(engine, "subscribe").given(clientId, "/foo/**")
|
69
69
|
server.subscribe(message, false, function() {})
|
70
70
|
}})
|
71
|
-
|
71
|
+
|
72
72
|
it("returns a successful response", function() { with(this) {
|
73
73
|
stub(engine, "subscribe")
|
74
74
|
server.subscribe(message, false, function(response) {
|
@@ -82,17 +82,17 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
82
82
|
}})
|
83
83
|
}})
|
84
84
|
}})
|
85
|
-
|
85
|
+
|
86
86
|
describe("with an unknown client", function() { with(this) {
|
87
87
|
before(function() { with(this) {
|
88
88
|
expect(engine, "clientExists").given(clientId).yielding([false])
|
89
89
|
}})
|
90
|
-
|
90
|
+
|
91
91
|
it("does not subscribe the client to the channel", function() { with(this) {
|
92
92
|
expect(engine, "subscribe").exactly(0)
|
93
93
|
server.subscribe(message, false, function() {})
|
94
94
|
}})
|
95
|
-
|
95
|
+
|
96
96
|
it("returns an unsuccessful response", function() { with(this) {
|
97
97
|
server.subscribe(message, false, function(response) {
|
98
98
|
assertEqual({
|
@@ -105,18 +105,18 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
105
105
|
})
|
106
106
|
}})
|
107
107
|
}})
|
108
|
-
|
108
|
+
|
109
109
|
describe("missing clientId", function() { with(this) {
|
110
110
|
before(function() { with(this) {
|
111
111
|
delete message.clientId
|
112
112
|
expect(engine, "clientExists").given(undefined).yielding([false])
|
113
113
|
}})
|
114
|
-
|
114
|
+
|
115
115
|
it("does not subscribe the client to the channel", function() { with(this) {
|
116
116
|
expect(engine, "subscribe").exactly(0)
|
117
117
|
server.subscribe(message, false, function() {})
|
118
118
|
}})
|
119
|
-
|
119
|
+
|
120
120
|
it("returns an unsuccessful response", function() { with(this) {
|
121
121
|
server.subscribe(message, false, function(response) {
|
122
122
|
assertEqual({
|
@@ -128,18 +128,18 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
128
128
|
})
|
129
129
|
}})
|
130
130
|
}})
|
131
|
-
|
131
|
+
|
132
132
|
describe("missing subscription", function() { with(this) {
|
133
133
|
before(function() { with(this) {
|
134
134
|
delete message.subscription
|
135
135
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
136
136
|
}})
|
137
|
-
|
137
|
+
|
138
138
|
it("does not subscribe the client to the channel", function() { with(this) {
|
139
139
|
expect(engine, "subscribe").exactly(0)
|
140
140
|
server.subscribe(message, false, function() {})
|
141
141
|
}})
|
142
|
-
|
142
|
+
|
143
143
|
it("returns an unsuccessful response", function() { with(this) {
|
144
144
|
server.subscribe(message, false, function(response) {
|
145
145
|
assertEqual({
|
@@ -152,18 +152,18 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
152
152
|
})
|
153
153
|
}})
|
154
154
|
}})
|
155
|
-
|
155
|
+
|
156
156
|
describe("with an invalid channel", function() { with(this) {
|
157
157
|
before(function() { with(this) {
|
158
158
|
message.subscription = "foo"
|
159
159
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
160
160
|
}})
|
161
|
-
|
161
|
+
|
162
162
|
it("does not subscribe the client to the channel", function() { with(this) {
|
163
163
|
expect(engine, "subscribe").exactly(0)
|
164
164
|
server.subscribe(message, false, function() {})
|
165
165
|
}})
|
166
|
-
|
166
|
+
|
167
167
|
it("returns an unsuccessful response", function() { with(this) {
|
168
168
|
server.subscribe(message, false, function(response) {
|
169
169
|
assertEqual({
|
@@ -176,18 +176,18 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
176
176
|
})
|
177
177
|
}})
|
178
178
|
}})
|
179
|
-
|
179
|
+
|
180
180
|
describe("with a /meta/* channel", function() { with(this) {
|
181
181
|
before(function() { with(this) {
|
182
182
|
message.subscription = "/meta/foo"
|
183
183
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
184
184
|
}})
|
185
|
-
|
185
|
+
|
186
186
|
it("does not subscribe the client to the channel", function() { with(this) {
|
187
187
|
expect(engine, "subscribe").exactly(0)
|
188
188
|
server.subscribe(message, false, function() {})
|
189
189
|
}})
|
190
|
-
|
190
|
+
|
191
191
|
it("returns an unsuccessful response", function() { with(this) {
|
192
192
|
server.subscribe(message, false, function(response) {
|
193
193
|
assertEqual({
|
@@ -199,12 +199,12 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
199
199
|
}, response)
|
200
200
|
})
|
201
201
|
}})
|
202
|
-
|
202
|
+
|
203
203
|
it("subscribes local clients to the channel", function() { with(this) {
|
204
204
|
expect(engine, "subscribe").given(clientId, "/meta/foo")
|
205
205
|
server.subscribe(message, true, function() {})
|
206
206
|
}})
|
207
|
-
|
207
|
+
|
208
208
|
it("returns a successful response for local clients", function() { with(this) {
|
209
209
|
stub(engine, "subscribe")
|
210
210
|
server.subscribe(message, true, function(response) {
|
@@ -217,18 +217,18 @@ JS.ENV.Server.SubscribeSpec = JS.Test.describe("Server subscribe", function() {
|
|
217
217
|
})
|
218
218
|
}})
|
219
219
|
}})
|
220
|
-
|
220
|
+
|
221
221
|
describe("with an error", function() { with(this) {
|
222
222
|
before(function() { with(this) {
|
223
223
|
message.error = "invalid"
|
224
224
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
225
225
|
}})
|
226
|
-
|
226
|
+
|
227
227
|
it("does not subscribe the client to the channel", function() { with(this) {
|
228
228
|
expect(engine, "subscribe").exactly(0)
|
229
229
|
server.subscribe(message, false, function() {})
|
230
230
|
}})
|
231
|
-
|
231
|
+
|
232
232
|
it("returns an unsuccessful response", function(resume) { with(this) {
|
233
233
|
server.subscribe(message, false, function(response) {
|
234
234
|
resume(function() {
|
@@ -4,7 +4,7 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
4
4
|
stub(Faye.Engine, "get").returns(engine)
|
5
5
|
this.server = new Faye.Server()
|
6
6
|
}})
|
7
|
-
|
7
|
+
|
8
8
|
describe("#unsubscribe", function() { with(this) {
|
9
9
|
before(function() { with(this) {
|
10
10
|
this.clientId = "fakeclientid"
|
@@ -12,17 +12,17 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
12
12
|
clientId: "fakeclientid",
|
13
13
|
subscription: "/foo"}
|
14
14
|
}})
|
15
|
-
|
15
|
+
|
16
16
|
describe("with valid parameters", function() { with(this) {
|
17
17
|
before(function() { with(this) {
|
18
18
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
19
19
|
}})
|
20
|
-
|
20
|
+
|
21
21
|
it("unsubscribes the client from the channel", function() { with(this) {
|
22
22
|
expect(engine, "unsubscribe").given(clientId, "/foo")
|
23
23
|
server.unsubscribe(message, false, function() {})
|
24
24
|
}})
|
25
|
-
|
25
|
+
|
26
26
|
it("returns a successful response", function() { with(this) {
|
27
27
|
stub(engine, "unsubscribe")
|
28
28
|
server.unsubscribe(message, false, function(response) {
|
@@ -34,18 +34,18 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
34
34
|
}, response)
|
35
35
|
})
|
36
36
|
}})
|
37
|
-
|
37
|
+
|
38
38
|
describe("with a list of subscriptions", function() { with(this) {
|
39
39
|
before(function() { with(this) {
|
40
40
|
message.subscription = ["/foo", "/bar"]
|
41
41
|
}})
|
42
|
-
|
42
|
+
|
43
43
|
it("destroys multiple subscriptions", function() { with(this) {
|
44
44
|
expect(engine, "unsubscribe").given(clientId, "/foo")
|
45
45
|
expect(engine, "unsubscribe").given(clientId, "/bar")
|
46
46
|
server.unsubscribe(message, false, function() {})
|
47
47
|
}})
|
48
|
-
|
48
|
+
|
49
49
|
it("returns a successful response", function() { with(this) {
|
50
50
|
stub(engine, "unsubscribe")
|
51
51
|
server.unsubscribe(message, false, function(response) {
|
@@ -58,17 +58,17 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
58
58
|
})
|
59
59
|
}})
|
60
60
|
}})
|
61
|
-
|
61
|
+
|
62
62
|
describe("with a subscription pattern", function() { with(this) {
|
63
63
|
before(function() { with(this) {
|
64
64
|
message.subscription = "/foo/**"
|
65
65
|
}})
|
66
|
-
|
66
|
+
|
67
67
|
it("destroys the subscription to the channel pattern", function() { with(this) {
|
68
68
|
expect(engine, "unsubscribe").given(clientId, "/foo/**")
|
69
69
|
server.unsubscribe(message, false, function() {})
|
70
70
|
}})
|
71
|
-
|
71
|
+
|
72
72
|
it("returns a successful response", function() { with(this) {
|
73
73
|
stub(engine, "unsubscribe")
|
74
74
|
server.unsubscribe(message, false, function(response) {
|
@@ -82,17 +82,17 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
82
82
|
}})
|
83
83
|
}})
|
84
84
|
}})
|
85
|
-
|
85
|
+
|
86
86
|
describe("with an unknown client", function() { with(this) {
|
87
87
|
before(function() { with(this) {
|
88
88
|
expect(engine, "clientExists").given(clientId).yielding([false])
|
89
89
|
}})
|
90
|
-
|
90
|
+
|
91
91
|
it("does not unsubscribe the client from the channel", function() { with(this) {
|
92
92
|
expect(engine, "unsubscribe").exactly(0)
|
93
93
|
server.unsubscribe(message, false, function() {})
|
94
94
|
}})
|
95
|
-
|
95
|
+
|
96
96
|
it("returns an unsuccessful response", function() { with(this) {
|
97
97
|
server.unsubscribe(message, false, function(response) {
|
98
98
|
assertEqual({
|
@@ -105,18 +105,18 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
105
105
|
})
|
106
106
|
}})
|
107
107
|
}})
|
108
|
-
|
108
|
+
|
109
109
|
describe("missing clientId", function() { with(this) {
|
110
110
|
before(function() { with(this) {
|
111
111
|
delete message.clientId
|
112
112
|
expect(engine, "clientExists").given(undefined).yielding([false])
|
113
113
|
}})
|
114
|
-
|
114
|
+
|
115
115
|
it("does not unsubscribe the client from the channel", function() { with(this) {
|
116
116
|
expect(engine, "unsubscribe").exactly(0)
|
117
117
|
server.unsubscribe(message, false, function() {})
|
118
118
|
}})
|
119
|
-
|
119
|
+
|
120
120
|
it("returns an unsuccessful response", function() { with(this) {
|
121
121
|
server.unsubscribe(message, false, function(response) {
|
122
122
|
assertEqual({
|
@@ -128,18 +128,18 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
128
128
|
})
|
129
129
|
}})
|
130
130
|
}})
|
131
|
-
|
131
|
+
|
132
132
|
describe("missing subscription", function() { with(this) {
|
133
133
|
before(function() { with(this) {
|
134
134
|
delete message.subscription
|
135
135
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
136
136
|
}})
|
137
|
-
|
137
|
+
|
138
138
|
it("does not unsubscribe the client from the channel", function() { with(this) {
|
139
139
|
expect(engine, "unsubscribe").exactly(0)
|
140
140
|
server.unsubscribe(message, false, function() {})
|
141
141
|
}})
|
142
|
-
|
142
|
+
|
143
143
|
it("returns an unsuccessful response", function() { with(this) {
|
144
144
|
server.unsubscribe(message, false, function(response) {
|
145
145
|
assertEqual({
|
@@ -152,18 +152,18 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
152
152
|
})
|
153
153
|
}})
|
154
154
|
}})
|
155
|
-
|
155
|
+
|
156
156
|
describe("with an invalid channel", function() { with(this) {
|
157
157
|
before(function() { with(this) {
|
158
158
|
message.subscription = "foo"
|
159
159
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
160
160
|
}})
|
161
|
-
|
161
|
+
|
162
162
|
it("does not unsubscribe the client from the channel", function() { with(this) {
|
163
163
|
expect(engine, "unsubscribe").exactly(0)
|
164
164
|
server.unsubscribe(message, false, function() {})
|
165
165
|
}})
|
166
|
-
|
166
|
+
|
167
167
|
it("returns an unsuccessful response", function() { with(this) {
|
168
168
|
server.unsubscribe(message, false, function(response) {
|
169
169
|
assertEqual({
|
@@ -176,18 +176,18 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
176
176
|
})
|
177
177
|
}})
|
178
178
|
}})
|
179
|
-
|
179
|
+
|
180
180
|
describe("with a /meta/* channel", function() { with(this) {
|
181
181
|
before(function() { with(this) {
|
182
182
|
message.subscription = "/meta/foo"
|
183
183
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
184
184
|
}})
|
185
|
-
|
185
|
+
|
186
186
|
it("does not unsubscribe the client from the channel", function() { with(this) {
|
187
187
|
expect(engine, "unsubscribe").exactly(0)
|
188
188
|
server.unsubscribe(message, false, function() {})
|
189
189
|
}})
|
190
|
-
|
190
|
+
|
191
191
|
it("returns an unsuccessful response", function() { with(this) {
|
192
192
|
server.unsubscribe(message, false, function(response) {
|
193
193
|
assertEqual({
|
@@ -199,12 +199,12 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
199
199
|
}, response)
|
200
200
|
})
|
201
201
|
}})
|
202
|
-
|
202
|
+
|
203
203
|
it("unsubscribes local clients from the channel", function() { with(this) {
|
204
204
|
expect(engine, "unsubscribe").given(clientId, "/meta/foo")
|
205
205
|
server.unsubscribe(message, true, function() {})
|
206
206
|
}})
|
207
|
-
|
207
|
+
|
208
208
|
it("returns a successful response for local clients", function() { with(this) {
|
209
209
|
stub(engine, "unsubscribe")
|
210
210
|
server.unsubscribe(message, true, function(response) {
|
@@ -217,18 +217,18 @@ JS.ENV.Server.UnsubscribeSpec = JS.Test.describe("Server unsubscribe", function(
|
|
217
217
|
})
|
218
218
|
}})
|
219
219
|
}})
|
220
|
-
|
220
|
+
|
221
221
|
describe("with an error", function() { with(this) {
|
222
222
|
before(function() { with(this) {
|
223
223
|
message.error = "invalid"
|
224
224
|
expect(engine, "clientExists").given(clientId).yielding([true])
|
225
225
|
}})
|
226
|
-
|
226
|
+
|
227
227
|
it("does not unsubscribe the client from the channel", function() { with(this) {
|
228
228
|
expect(engine, "unsubscribe").exactly(0)
|
229
229
|
server.unsubscribe(message, false, function() {})
|
230
230
|
}})
|
231
|
-
|
231
|
+
|
232
232
|
it("returns an unsuccessful response", function() { with(this) {
|
233
233
|
server.unsubscribe(message, false, function(response) {
|
234
234
|
assertEqual({
|