pusher-fake 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e7459cf521ab87d3bd4c57ce0c11a2db1976ba0
|
4
|
+
data.tar.gz: '0543389734f7086e9c639c03c46b8b46e7907744'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee723d426db471698d5b0f897a2d0808cbbee1d0cab916c72f3595eaa09ace15c78683ab15217c429f59efa50dec5361fb1b9545b77e697a8a5840f99502a820
|
7
|
+
data.tar.gz: 935b22b74f151af851c63b1f9e030a36748c8ca3a85449be1a5fcd026aab5d82f90846e45adf9c757f99a993f915a570b3c1683977710e08e0080984de86f461
|
data/bin/pusher-fake
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# rubocop:disable Metrics/BlockLength, Metrics/LineLength
|
4
|
+
|
5
|
+
require "optparse"
|
6
|
+
require "pusher"
|
7
|
+
require "pusher-fake"
|
8
|
+
|
9
|
+
PusherFake.configure do |configuration|
|
10
|
+
OptionParser.new do |options|
|
11
|
+
options.on("-iID", "--id ID", String, "Use ID as the application ID for Pusher") do |application_id|
|
12
|
+
Pusher.app_id = application_id
|
13
|
+
configuration.app_id = application_id
|
14
|
+
end
|
15
|
+
|
16
|
+
options.on("-kKEY", "--key KEY", String, "Use KEY as the key for Pusher") do |key|
|
17
|
+
Pusher.key = key
|
18
|
+
configuration.key = key
|
19
|
+
end
|
20
|
+
|
21
|
+
options.on("-sSECRET", "--secret SECRET", String, "Use SECRET as the secret token for Pusher") do |secret|
|
22
|
+
Pusher.secret = secret
|
23
|
+
configuration.secret = secret
|
24
|
+
end
|
25
|
+
|
26
|
+
options.on("--socket-host HOST", String, "Use HOST for the web socket server") do |host|
|
27
|
+
configuration.socket_options[:host] = host
|
28
|
+
end
|
29
|
+
|
30
|
+
options.on("--socket-port PORT", Integer, "Use PORT for the web socket server") do |port|
|
31
|
+
configuration.socket_options[:port] = port
|
32
|
+
end
|
33
|
+
|
34
|
+
options.on("-v", "--[no-]verbose", "Run verbosely") do |verbose|
|
35
|
+
configuration.verbose = verbose
|
36
|
+
end
|
37
|
+
|
38
|
+
options.on("--web-host HOST", String, "Use HOST for the web server") do |host|
|
39
|
+
configuration.web_options[:host] = host
|
40
|
+
end
|
41
|
+
|
42
|
+
options.on("--web-port PORT", Integer, "Use PORT for the web server") do |port|
|
43
|
+
configuration.web_options[:port] = port
|
44
|
+
end
|
45
|
+
end.parse!
|
46
|
+
end
|
47
|
+
|
48
|
+
raise OptionParser::MissingArgument.new("--id") if Pusher.app_id.nil?
|
49
|
+
raise OptionParser::MissingArgument.new("--key") if Pusher.key.nil?
|
50
|
+
raise OptionParser::MissingArgument.new("--secret") if Pusher.secret.nil?
|
51
|
+
|
52
|
+
PusherFake::Server.start
|
data/lib/pusher-fake.rb
CHANGED
@@ -9,7 +9,7 @@ require "thin"
|
|
9
9
|
# A Pusher fake.
|
10
10
|
module PusherFake
|
11
11
|
# The current version string.
|
12
|
-
VERSION = "1.
|
12
|
+
VERSION = "1.8.0".freeze
|
13
13
|
|
14
14
|
autoload :Channel, "pusher-fake/channel"
|
15
15
|
autoload :Configuration, "pusher-fake/configuration"
|
@@ -48,8 +48,6 @@ module PusherFake
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.log(message)
|
51
|
-
if configuration.verbose
|
52
|
-
configuration.logger << "#{message}\n"
|
53
|
-
end
|
51
|
+
configuration.logger << "#{message}\n" if configuration.verbose
|
54
52
|
end
|
55
53
|
end
|
@@ -1,17 +1,34 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe PusherFake::Configuration do
|
4
|
-
it
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
it do
|
5
|
+
is_expected.to have_configuration_option(:key)
|
6
|
+
.with_default("PUSHER_API_KEY")
|
7
|
+
end
|
8
|
+
|
9
|
+
it do
|
10
|
+
is_expected.to have_configuration_option(:logger)
|
11
|
+
.with_default(STDOUT.to_io)
|
12
|
+
end
|
13
|
+
|
14
|
+
it do
|
15
|
+
is_expected.to have_configuration_option(:verbose)
|
16
|
+
.with_default(false)
|
17
|
+
end
|
18
|
+
|
19
|
+
it do
|
20
|
+
is_expected.to have_configuration_option(:webhooks)
|
21
|
+
.with_default([])
|
22
|
+
end
|
8
23
|
|
9
24
|
it do
|
10
|
-
|
25
|
+
is_expected.to have_configuration_option(:app_id)
|
26
|
+
.with_default("PUSHER_APP_ID")
|
11
27
|
end
|
12
28
|
|
13
29
|
it do
|
14
|
-
|
30
|
+
is_expected.to have_configuration_option(:secret)
|
31
|
+
.with_default("PUSHER_API_SECRET")
|
15
32
|
end
|
16
33
|
|
17
34
|
it "has configuration option :socket_options" do
|
@@ -104,7 +104,7 @@ describe PusherFake::Connection, "#id" do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
describe PusherFake::Connection, "#process, with a subscribe event" do
|
107
|
-
|
107
|
+
it_behaves_like "#process" do
|
108
108
|
let(:data) { { channel: name, auth: "auth" } }
|
109
109
|
let(:name) { "channel" }
|
110
110
|
let(:message) { { event: "pusher:subscribe", data: data } }
|
@@ -132,7 +132,7 @@ describe PusherFake::Connection, "#process, with a subscribe event" do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
describe PusherFake::Connection, "#process, with an unsubscribe event" do
|
135
|
-
|
135
|
+
it_behaves_like "#process" do
|
136
136
|
let(:name) { "channel" }
|
137
137
|
let(:message) { { event: "pusher:unsubscribe", channel: name } }
|
138
138
|
|
@@ -159,7 +159,7 @@ describe PusherFake::Connection, "#process, with an unsubscribe event" do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
describe PusherFake::Connection, "#process, with a ping event" do
|
162
|
-
|
162
|
+
it_behaves_like "#process" do
|
163
163
|
let(:message) { { event: "pusher:ping", data: {} } }
|
164
164
|
|
165
165
|
before do
|
@@ -182,7 +182,7 @@ describe PusherFake::Connection, "#process, with a ping event" do
|
|
182
182
|
end
|
183
183
|
|
184
184
|
describe PusherFake::Connection, "#process, with a client event" do
|
185
|
-
|
185
|
+
it_behaves_like "#process" do
|
186
186
|
let(:data) { {} }
|
187
187
|
let(:name) { "channel" }
|
188
188
|
let(:event) { "client-hello-world" }
|
@@ -247,7 +247,7 @@ end
|
|
247
247
|
|
248
248
|
describe PusherFake::Connection,
|
249
249
|
"#process, with a client event trigger a webhook" do
|
250
|
-
|
250
|
+
it_behaves_like "#process" do
|
251
251
|
let(:data) { { example: "data" } }
|
252
252
|
let(:name) { "channel" }
|
253
253
|
let(:event) { "client-hello-world" }
|
@@ -304,7 +304,7 @@ describe PusherFake::Connection,
|
|
304
304
|
end
|
305
305
|
|
306
306
|
describe PusherFake::Connection, "#process, with an unknown event" do
|
307
|
-
|
307
|
+
it_behaves_like "#process" do
|
308
308
|
let(:data) { {} }
|
309
309
|
let(:name) { "channel" }
|
310
310
|
let(:event) { "hello-world" }
|
@@ -49,7 +49,7 @@ shared_examples_for "an API request" do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe PusherFake::Server::Application, ".call, for triggering events" do
|
52
|
-
|
52
|
+
it_behaves_like "an API request" do
|
53
53
|
let(:id) { PusherFake.configuration.app_id }
|
54
54
|
let(:path) { "/apps/#{id}/events" }
|
55
55
|
|
@@ -67,7 +67,7 @@ end
|
|
67
67
|
|
68
68
|
describe PusherFake::Server::Application,
|
69
69
|
".call, for triggering batch events" do
|
70
|
-
|
70
|
+
it_behaves_like "an API request" do
|
71
71
|
let(:id) { PusherFake.configuration.app_id }
|
72
72
|
let(:path) { "/apps/#{id}/batch_events" }
|
73
73
|
|
@@ -85,7 +85,7 @@ end
|
|
85
85
|
|
86
86
|
describe PusherFake::Server::Application,
|
87
87
|
".call, retrieving occupied channels" do
|
88
|
-
|
88
|
+
it_behaves_like "an API request" do
|
89
89
|
let(:id) { PusherFake.configuration.app_id }
|
90
90
|
let(:path) { "/apps/#{id}/channels" }
|
91
91
|
|
data/spec/support/capybara.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
require "capybara/poltergeist"
|
1
2
|
require "capybara/rspec"
|
2
3
|
|
3
|
-
Capybara.
|
4
|
-
Capybara.
|
4
|
+
Capybara.register_driver :poltergeist do |app|
|
5
|
+
Capybara::Poltergeist::Driver.new(app, url_whitelist: [])
|
6
|
+
end
|
5
7
|
|
6
|
-
Capybara::
|
8
|
+
Capybara.app = Sinatra::Application
|
9
|
+
Capybara.default_driver = :poltergeist
|
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.8.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: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: poltergeist
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.13.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.13.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pusher
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 12.0.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 12.0.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,62 +128,64 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.47.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.47.1
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rubocop-rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.13.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.13.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: sinatra
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.4.
|
159
|
+
version: 1.4.8
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.4.
|
166
|
+
version: 1.4.8
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: yard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.9.
|
173
|
+
version: 0.9.8
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.9.
|
180
|
+
version: 0.9.8
|
181
181
|
description: A fake Pusher server for development and testing.
|
182
182
|
email: hello@tristandunn.com
|
183
|
-
executables:
|
183
|
+
executables:
|
184
|
+
- pusher-fake
|
184
185
|
extensions: []
|
185
186
|
extra_rdoc_files: []
|
186
187
|
files:
|
188
|
+
- bin/pusher-fake
|
187
189
|
- lib/pusher-fake.rb
|
188
190
|
- lib/pusher-fake/channel.rb
|
189
191
|
- lib/pusher-fake/channel/presence.rb
|
@@ -249,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
251
|
version: '0'
|
250
252
|
requirements: []
|
251
253
|
rubyforge_project:
|
252
|
-
rubygems_version: 2.
|
254
|
+
rubygems_version: 2.6.9
|
253
255
|
signing_key:
|
254
256
|
specification_version: 4
|
255
257
|
summary: A fake Pusher server for development and testing.
|