pusher-fake 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/support/pusher-fake.rb +3 -1
- data/lib/pusher-fake.rb +1 -1
- data/lib/pusher-fake/configuration.rb +12 -2
- data/spec/lib/pusher-fake/configuration_spec.rb +16 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3f79253d72f830d37f4a25a95b9bde1d58cdb19
|
4
|
+
data.tar.gz: fa1401d5a24e2d49f2ed0b89cd02b663e5dd0361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b629399e6094408686c54492d02e40a19a5331f85057a97146fe879e88d6f3f44812e0d334dd759bd33051a0495c55cecae80ae150710ffe0d30516f0e56425
|
7
|
+
data.tar.gz: e9a65e650f03408fe170c9d88fac0cfa05b8061ade712812304ddabe270c9853fedf63a3a960ac879e2cae5dd41f530a8487ca6c828147fc09dc49fe0696de1c
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
PusherFake.configuration.web_options.tap do |options|
|
2
|
+
Pusher.url = "http://PUSHER_API_KEY:PUSHER_API_SECRET@#{options[:host]}:#{options[:port]}/apps/PUSHER_APP_ID"
|
3
|
+
end
|
2
4
|
|
3
5
|
Thread.new { PusherFake::Server.start }.tap do |thread|
|
4
6
|
at_exit { thread.exit }
|
data/lib/pusher-fake.rb
CHANGED
@@ -37,8 +37,8 @@ module PusherFake
|
|
37
37
|
self.verbose = false
|
38
38
|
self.webhooks = []
|
39
39
|
|
40
|
-
self.socket_options = { host: "127.0.0.1", port:
|
41
|
-
self.web_options = { host: "127.0.0.1", port:
|
40
|
+
self.socket_options = { host: "127.0.0.1", port: available_port }
|
41
|
+
self.web_options = { host: "127.0.0.1", port: available_port }
|
42
42
|
end
|
43
43
|
|
44
44
|
# Convert the configuration to a hash sutiable for Pusher JS options.
|
@@ -50,5 +50,15 @@ module PusherFake
|
|
50
50
|
wsPort: socket_options[:port]
|
51
51
|
)
|
52
52
|
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def available_port
|
57
|
+
socket = Socket.new(:INET, :STREAM, 0)
|
58
|
+
socket.bind(Addrinfo.tcp("127.0.0.1", 0))
|
59
|
+
socket.local_address.ip_port.tap do
|
60
|
+
socket.close
|
61
|
+
end
|
62
|
+
end
|
53
63
|
end
|
54
64
|
end
|
@@ -5,10 +5,24 @@ describe PusherFake::Configuration do
|
|
5
5
|
it { should have_configuration_option(:key).with_default("PUSHER_API_KEY") }
|
6
6
|
it { should have_configuration_option(:logger).with_default(STDOUT.to_io) }
|
7
7
|
it { should have_configuration_option(:secret).with_default("PUSHER_API_SECRET") }
|
8
|
-
it { should have_configuration_option(:socket_options).with_default({ host: "127.0.0.1", port: 8080 }) }
|
9
8
|
it { should have_configuration_option(:verbose).with_default(false) }
|
10
|
-
it { should have_configuration_option(:web_options).with_default({ host: "127.0.0.1", port: 8081 }) }
|
11
9
|
it { should have_configuration_option(:webhooks).with_default([]) }
|
10
|
+
|
11
|
+
it "should have configuration option :socket_options" do
|
12
|
+
expect(subject.socket_options).to be_a(Hash)
|
13
|
+
expect(subject.socket_options[:host]).to eq("127.0.0.1")
|
14
|
+
expect(subject.socket_options[:port]).to be_a(Integer)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have configuration option :web_options" do
|
18
|
+
expect(subject.web_options).to be_a(Hash)
|
19
|
+
expect(subject.web_options[:host]).to eq("127.0.0.1")
|
20
|
+
expect(subject.web_options[:port]).to be_a(Integer)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "defaults socket and web ports to different values" do
|
24
|
+
expect(subject.socket_options[:port]).to_not eq(subject.web_options[:port])
|
25
|
+
end
|
12
26
|
end
|
13
27
|
|
14
28
|
describe PusherFake::Configuration, "#to_options" do
|
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.2.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: 2014-
|
11
|
+
date: 2014-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-http-request
|
@@ -100,28 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.3.
|
103
|
+
version: 1.3.16
|
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: 1.3.
|
110
|
+
version: 1.3.16
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pusher
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.14.
|
117
|
+
version: 0.14.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.14.
|
124
|
+
version: 0.14.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|