pusher-fake 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pusher-fake.rb +1 -1
- data/lib/pusher-fake/configuration.rb +2 -1
- data/lib/pusher-fake/server/application.rb +1 -1
- data/spec/features/api/channels_spec.rb +82 -0
- data/spec/features/api/users_spec.rb +34 -0
- data/spec/features/client/connect_spec.rb +9 -0
- data/spec/features/client/event_spec.rb +45 -0
- data/spec/features/client/presence_spec.rb +56 -0
- data/spec/features/client/subscribe_spec.rb +61 -0
- data/spec/features/server/event_spec.rb +120 -0
- data/spec/features/server/webhooks_spec.rb +64 -0
- data/spec/lib/pusher-fake/channel/presence_spec.rb +36 -30
- data/spec/lib/pusher-fake/channel/private_spec.rb +29 -25
- data/spec/lib/pusher-fake/channel/public_spec.rb +18 -18
- data/spec/lib/pusher-fake/channel_spec.rb +14 -14
- data/spec/lib/pusher-fake/configuration_spec.rb +6 -0
- data/spec/lib/pusher-fake/connection_spec.rb +38 -36
- data/spec/lib/pusher-fake/server/application_spec.rb +70 -70
- data/spec/lib/pusher-fake/server_spec.rb +42 -41
- data/spec/lib/pusher-fake/webhook_spec.rb +9 -7
- data/spec/lib/pusher_fake_spec.rb +5 -4
- data/spec/spec_helper.rb +3 -1
- data/{features → spec}/support/application.rb +0 -0
- data/{features/support/application/public/javascripts/vendor/pusher-2.2.2.js → spec/support/application/public/javascripts/vendor/pusher-2.2.4.js} +26 -19
- data/spec/support/application/views/index.erb +83 -0
- data/spec/support/capybara.rb +10 -0
- data/spec/support/coveralls.rb +0 -1
- data/spec/support/helpers/connect.rb +21 -0
- data/spec/support/helpers/event.rb +9 -0
- data/spec/support/helpers/subscription.rb +29 -0
- data/spec/support/helpers/user.rb +11 -0
- data/spec/support/{have_configuration_option_matcher.rb → matchers/have_configuration_option.rb} +0 -0
- data/spec/support/pusher-fake.rb +15 -0
- data/{features → spec}/support/webhooks.rb +5 -1
- metadata +51 -101
- data/features/channel.feature +0 -109
- data/features/channel_presence.feature +0 -27
- data/features/channel_subscribe.feature +0 -33
- data/features/channel_trigger.feature +0 -91
- data/features/channel_webhooks.feature +0 -40
- data/features/client_connect.feature +0 -8
- data/features/step_definitions/api_steps.rb +0 -40
- data/features/step_definitions/channel_steps.rb +0 -86
- data/features/step_definitions/client_steps.rb +0 -23
- data/features/step_definitions/event_steps.rb +0 -56
- data/features/step_definitions/navigation_steps.rb +0 -3
- data/features/step_definitions/presence_steps.rb +0 -6
- data/features/step_definitions/webhook_steps.rb +0 -21
- data/features/support/application/views/index.erb +0 -35
- data/features/support/coveralls.rb +0 -1
- data/features/support/environment.rb +0 -13
- data/features/support/pusher-fake.rb +0 -11
- data/features/support/timing.rb +0 -15
- data/features/user.feature +0 -14
data/spec/support/coveralls.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module ConnectHelpers
|
2
|
+
def connect(options = {})
|
3
|
+
visit "/"
|
4
|
+
|
5
|
+
expect(page).to have_content("Client connected.")
|
6
|
+
|
7
|
+
if options[:channel]
|
8
|
+
subscribe_to(options[:channel])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def connect_as(name, options = {})
|
13
|
+
using_session(name) do
|
14
|
+
connect(options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.include(ConnectHelpers)
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SubscriptionHelpers
|
2
|
+
def subscribe_to(channel)
|
3
|
+
page.execute_script("Helpers.subscribe(#{MultiJson.dump(channel)})")
|
4
|
+
|
5
|
+
expect(page).to have_content("Subscribed to #{channel}.")
|
6
|
+
end
|
7
|
+
|
8
|
+
def subscribe_to_as(channel, name)
|
9
|
+
using_session(name) do
|
10
|
+
subscribe_to(channel)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def unsubscribe_from(channel)
|
15
|
+
page.execute_script("Helpers.unsubscribe(#{MultiJson.dump(channel)})")
|
16
|
+
|
17
|
+
expect(page).to have_content("Unsubscribed from #{channel}.")
|
18
|
+
end
|
19
|
+
|
20
|
+
def unsubscribe_from_as(channel, name)
|
21
|
+
using_session(name) do
|
22
|
+
unsubscribe_from(channel)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
config.include(SubscriptionHelpers)
|
29
|
+
end
|
data/spec/support/{have_configuration_option_matcher.rb → matchers/have_configuration_option.rb}
RENAMED
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:each, type: :feature) do
|
3
|
+
PusherFake.configuration.web_options.tap do |options|
|
4
|
+
Pusher.url = "http://PUSHER_API_KEY:PUSHER_API_SECRET@#{options[:host]}:#{options[:port]}/apps/PUSHER_APP_ID"
|
5
|
+
end
|
6
|
+
|
7
|
+
@thread = Thread.new { PusherFake::Server.start }
|
8
|
+
end
|
9
|
+
|
10
|
+
config.after(:each, type: :feature) do
|
11
|
+
@thread.exit
|
12
|
+
|
13
|
+
PusherFake::Channel.reset
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pusher-fake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Dunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|
@@ -66,104 +66,62 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.6'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: bourne
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.5.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.5.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: capybara-webkit
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - '='
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
75
|
+
version: 1.4.1
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - '='
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: cucumber
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.3.16
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 1.3.16
|
82
|
+
version: 1.4.1
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
84
|
name: pusher
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
87
|
- - '='
|
116
88
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.14.
|
89
|
+
version: 0.14.4
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
94
|
- - '='
|
123
95
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.14.
|
96
|
+
version: 0.14.4
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
98
|
name: rake
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
128
100
|
requirements:
|
129
101
|
- - '='
|
130
102
|
- !ruby/object:Gem::Version
|
131
|
-
version: 10.
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - '='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 10.3.2
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: redcarpet
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - '='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 3.1.2
|
103
|
+
version: 10.4.2
|
146
104
|
type: :development
|
147
105
|
prerelease: false
|
148
106
|
version_requirements: !ruby/object:Gem::Requirement
|
149
107
|
requirements:
|
150
108
|
- - '='
|
151
109
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
110
|
+
version: 10.4.2
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
112
|
name: rspec
|
155
113
|
requirement: !ruby/object:Gem::Requirement
|
156
114
|
requirements:
|
157
115
|
- - '='
|
158
116
|
- !ruby/object:Gem::Version
|
159
|
-
version: 3.
|
117
|
+
version: 3.1.0
|
160
118
|
type: :development
|
161
119
|
prerelease: false
|
162
120
|
version_requirements: !ruby/object:Gem::Requirement
|
163
121
|
requirements:
|
164
122
|
- - '='
|
165
123
|
- !ruby/object:Gem::Version
|
166
|
-
version: 3.
|
124
|
+
version: 3.1.0
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
126
|
name: sinatra
|
169
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,42 +142,20 @@ dependencies:
|
|
184
142
|
requirements:
|
185
143
|
- - '='
|
186
144
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.8.7.
|
145
|
+
version: 0.8.7.6
|
188
146
|
type: :development
|
189
147
|
prerelease: false
|
190
148
|
version_requirements: !ruby/object:Gem::Requirement
|
191
149
|
requirements:
|
192
150
|
- - '='
|
193
151
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.8.7.
|
152
|
+
version: 0.8.7.6
|
195
153
|
description: A fake Pusher server for development and testing.
|
196
154
|
email: hello@tristandunn.com
|
197
155
|
executables: []
|
198
156
|
extensions: []
|
199
157
|
extra_rdoc_files: []
|
200
158
|
files:
|
201
|
-
- features/channel.feature
|
202
|
-
- features/channel_presence.feature
|
203
|
-
- features/channel_subscribe.feature
|
204
|
-
- features/channel_trigger.feature
|
205
|
-
- features/channel_webhooks.feature
|
206
|
-
- features/client_connect.feature
|
207
|
-
- features/step_definitions/api_steps.rb
|
208
|
-
- features/step_definitions/channel_steps.rb
|
209
|
-
- features/step_definitions/client_steps.rb
|
210
|
-
- features/step_definitions/event_steps.rb
|
211
|
-
- features/step_definitions/navigation_steps.rb
|
212
|
-
- features/step_definitions/presence_steps.rb
|
213
|
-
- features/step_definitions/webhook_steps.rb
|
214
|
-
- features/support/application.rb
|
215
|
-
- features/support/application/public/javascripts/vendor/pusher-2.2.2.js
|
216
|
-
- features/support/application/views/index.erb
|
217
|
-
- features/support/coveralls.rb
|
218
|
-
- features/support/environment.rb
|
219
|
-
- features/support/pusher-fake.rb
|
220
|
-
- features/support/timing.rb
|
221
|
-
- features/support/webhooks.rb
|
222
|
-
- features/user.feature
|
223
159
|
- lib/pusher-fake.rb
|
224
160
|
- lib/pusher-fake/channel.rb
|
225
161
|
- lib/pusher-fake/channel/presence.rb
|
@@ -234,6 +170,14 @@ files:
|
|
234
170
|
- lib/pusher-fake/support/cucumber.rb
|
235
171
|
- lib/pusher-fake/support/rspec.rb
|
236
172
|
- lib/pusher-fake/webhook.rb
|
173
|
+
- spec/features/api/channels_spec.rb
|
174
|
+
- spec/features/api/users_spec.rb
|
175
|
+
- spec/features/client/connect_spec.rb
|
176
|
+
- spec/features/client/event_spec.rb
|
177
|
+
- spec/features/client/presence_spec.rb
|
178
|
+
- spec/features/client/subscribe_spec.rb
|
179
|
+
- spec/features/server/event_spec.rb
|
180
|
+
- spec/features/server/webhooks_spec.rb
|
237
181
|
- spec/lib/pusher-fake/channel/presence_spec.rb
|
238
182
|
- spec/lib/pusher-fake/channel/private_spec.rb
|
239
183
|
- spec/lib/pusher-fake/channel/public_spec.rb
|
@@ -245,8 +189,18 @@ files:
|
|
245
189
|
- spec/lib/pusher-fake/webhook_spec.rb
|
246
190
|
- spec/lib/pusher_fake_spec.rb
|
247
191
|
- spec/spec_helper.rb
|
192
|
+
- spec/support/application.rb
|
193
|
+
- spec/support/application/public/javascripts/vendor/pusher-2.2.4.js
|
194
|
+
- spec/support/application/views/index.erb
|
195
|
+
- spec/support/capybara.rb
|
248
196
|
- spec/support/coveralls.rb
|
249
|
-
- spec/support/
|
197
|
+
- spec/support/helpers/connect.rb
|
198
|
+
- spec/support/helpers/event.rb
|
199
|
+
- spec/support/helpers/subscription.rb
|
200
|
+
- spec/support/helpers/user.rb
|
201
|
+
- spec/support/matchers/have_configuration_option.rb
|
202
|
+
- spec/support/pusher-fake.rb
|
203
|
+
- spec/support/webhooks.rb
|
250
204
|
homepage: https://github.com/tristandunn/pusher-fake
|
251
205
|
licenses:
|
252
206
|
- MIT
|
@@ -267,33 +221,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
221
|
version: '0'
|
268
222
|
requirements: []
|
269
223
|
rubyforge_project:
|
270
|
-
rubygems_version: 2.
|
224
|
+
rubygems_version: 2.2.2
|
271
225
|
signing_key:
|
272
226
|
specification_version: 4
|
273
227
|
summary: A fake Pusher server for development and testing.
|
274
228
|
test_files:
|
275
|
-
- features/
|
276
|
-
- features/
|
277
|
-
- features/
|
278
|
-
- features/
|
279
|
-
- features/
|
280
|
-
- features/
|
281
|
-
- features/
|
282
|
-
- features/
|
283
|
-
- features/step_definitions/client_steps.rb
|
284
|
-
- features/step_definitions/event_steps.rb
|
285
|
-
- features/step_definitions/navigation_steps.rb
|
286
|
-
- features/step_definitions/presence_steps.rb
|
287
|
-
- features/step_definitions/webhook_steps.rb
|
288
|
-
- features/support/application/public/javascripts/vendor/pusher-2.2.2.js
|
289
|
-
- features/support/application/views/index.erb
|
290
|
-
- features/support/application.rb
|
291
|
-
- features/support/coveralls.rb
|
292
|
-
- features/support/environment.rb
|
293
|
-
- features/support/pusher-fake.rb
|
294
|
-
- features/support/timing.rb
|
295
|
-
- features/support/webhooks.rb
|
296
|
-
- features/user.feature
|
229
|
+
- spec/features/api/channels_spec.rb
|
230
|
+
- spec/features/api/users_spec.rb
|
231
|
+
- spec/features/client/connect_spec.rb
|
232
|
+
- spec/features/client/event_spec.rb
|
233
|
+
- spec/features/client/presence_spec.rb
|
234
|
+
- spec/features/client/subscribe_spec.rb
|
235
|
+
- spec/features/server/event_spec.rb
|
236
|
+
- spec/features/server/webhooks_spec.rb
|
297
237
|
- spec/lib/pusher-fake/channel/presence_spec.rb
|
298
238
|
- spec/lib/pusher-fake/channel/private_spec.rb
|
299
239
|
- spec/lib/pusher-fake/channel/public_spec.rb
|
@@ -305,6 +245,16 @@ test_files:
|
|
305
245
|
- spec/lib/pusher-fake/webhook_spec.rb
|
306
246
|
- spec/lib/pusher_fake_spec.rb
|
307
247
|
- spec/spec_helper.rb
|
248
|
+
- spec/support/application/public/javascripts/vendor/pusher-2.2.4.js
|
249
|
+
- spec/support/application/views/index.erb
|
250
|
+
- spec/support/application.rb
|
251
|
+
- spec/support/capybara.rb
|
308
252
|
- spec/support/coveralls.rb
|
309
|
-
- spec/support/
|
253
|
+
- spec/support/helpers/connect.rb
|
254
|
+
- spec/support/helpers/event.rb
|
255
|
+
- spec/support/helpers/subscription.rb
|
256
|
+
- spec/support/helpers/user.rb
|
257
|
+
- spec/support/matchers/have_configuration_option.rb
|
258
|
+
- spec/support/pusher-fake.rb
|
259
|
+
- spec/support/webhooks.rb
|
310
260
|
has_rdoc:
|
data/features/channel.feature
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
@javascript
|
2
|
-
Feature: Requesting channel information
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given I am connected
|
6
|
-
|
7
|
-
Scenario: Requesting all channels
|
8
|
-
When I request "/channels"
|
9
|
-
Then I should receive the following JSON:
|
10
|
-
"""
|
11
|
-
{ "channels" : {} }
|
12
|
-
"""
|
13
|
-
When I subscribe to the "chat-message" channel
|
14
|
-
And I request "/channels"
|
15
|
-
Then I should receive the following JSON:
|
16
|
-
"""
|
17
|
-
{ "channels" : {
|
18
|
-
"chat-message" : {}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
"""
|
22
|
-
When I subscribe to the "presence-game-1" channel with presence events
|
23
|
-
And I request "/channels"
|
24
|
-
Then I should receive the following JSON:
|
25
|
-
"""
|
26
|
-
{ "channels" : {
|
27
|
-
"chat-message" : {},
|
28
|
-
"presence-game-1" : {}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
"""
|
32
|
-
|
33
|
-
Scenario: Requesting all channels, with a filter
|
34
|
-
Given I subscribe to the "chat-message" channel
|
35
|
-
And I subscribe to the "presence-game-1" channel with presence events
|
36
|
-
When I request "/channels" with the following options:
|
37
|
-
| filter_by_prefix |
|
38
|
-
| chat |
|
39
|
-
Then I should receive the following JSON:
|
40
|
-
"""
|
41
|
-
{ "channels" : {
|
42
|
-
"chat-message" : {}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
"""
|
46
|
-
|
47
|
-
Scenario: Requesting all channels, with a valid filter and info attributes
|
48
|
-
Given I subscribe to the "chat-message" channel
|
49
|
-
And I subscribe to the "presence-game-1" channel with presence events
|
50
|
-
When I request "/channels" with the following options:
|
51
|
-
| filter_by_prefix | info |
|
52
|
-
| presence- | user_count |
|
53
|
-
Then I should receive the following JSON:
|
54
|
-
"""
|
55
|
-
{ "channels" : {
|
56
|
-
"presence-game-1" : {
|
57
|
-
"user_count" : 1
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
"""
|
62
|
-
|
63
|
-
Scenario: Requesting all channels, with an invalid filter and info attributes
|
64
|
-
Given I subscribe to the "chat-message" channel
|
65
|
-
And I subscribe to the "presence-game-1" channel with presence events
|
66
|
-
When I request "/channels" with the following options:
|
67
|
-
| filter_by_prefix | info |
|
68
|
-
| chat- | user_count |
|
69
|
-
Then I should receive the following error:
|
70
|
-
"""
|
71
|
-
user_count may only be requested for presence channels - please supply filter_by_prefix begining with presence-
|
72
|
-
"""
|
73
|
-
|
74
|
-
Scenario: Requesting a channel, with no occupants
|
75
|
-
When I request "/channels/empty"
|
76
|
-
Then I should receive the following JSON:
|
77
|
-
"""
|
78
|
-
{ "occupied" : false }
|
79
|
-
"""
|
80
|
-
|
81
|
-
Scenario: Requesting a channel, with an occupant
|
82
|
-
Given I subscribe to the "non-empty" channel
|
83
|
-
When I request "/channels/non-empty"
|
84
|
-
Then I should receive the following JSON:
|
85
|
-
"""
|
86
|
-
{ "occupied" : true }
|
87
|
-
"""
|
88
|
-
|
89
|
-
Scenario: Requesting a channel, with valid info attributes
|
90
|
-
Given I subscribe to the "presence-1" channel
|
91
|
-
And Bob is connected
|
92
|
-
And Bob is subscribed to the "presence-1" channel
|
93
|
-
When I request "/channels/presence-1" with the following options:
|
94
|
-
| info |
|
95
|
-
| user_count |
|
96
|
-
Then I should receive the following JSON:
|
97
|
-
"""
|
98
|
-
{ "occupied" : true,
|
99
|
-
"user_count" : 2 }
|
100
|
-
"""
|
101
|
-
|
102
|
-
Scenario: Requesting a channel, with invalid info attributes
|
103
|
-
When I request "/channels/public-1" with the following options:
|
104
|
-
| info |
|
105
|
-
| user_count |
|
106
|
-
Then I should receive the following error:
|
107
|
-
"""
|
108
|
-
Cannot retrieve the user count unless the channel is a presence channel
|
109
|
-
"""
|