bps 0.0.3 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bps.rb +2 -2
- data/spec/bps/coercer_spec.rb +6 -5
- data/spec/bps/publisher/in_mem_spec.rb +14 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dcfafba4e1ba7aec2d812ed9a900d8c456b3805aaa7fc06b3aaa09a25a82fe7
|
4
|
+
data.tar.gz: a26e3d94327c39234daad0381504dda9024a26ff61640935d5e911746601fb46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593c087d4fd8dc66cb737c8da308269cbf2d0aa1cff40a7eb88dc29532405eceb075b92ba11f90e06c527eb20b83a7a4c923a3e0b8db73289ea55a23bf5e0ed7
|
7
|
+
data.tar.gz: fabb9c003aff6112f935fcf4e41e5c1f21a5ed29d731bde44e8efef332e45b6a8dab708977ce8e8789fa24775c3b9628a65876114f103d07df9c9c168b2ce710
|
data/lib/bps.rb
CHANGED
@@ -24,7 +24,7 @@ module BPS
|
|
24
24
|
CGI.parse(url.query.to_s).each do |key, values|
|
25
25
|
opts[key.to_sym] = values.first
|
26
26
|
end
|
27
|
-
rsl.call(url, opts)
|
27
|
+
rsl.call(url, **opts)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -47,7 +47,7 @@ module BPS
|
|
47
47
|
CGI.parse(url.query.to_s).each do |key, values|
|
48
48
|
opts[key.to_sym] = values.first
|
49
49
|
end
|
50
|
-
rsl.call(url, opts)
|
50
|
+
rsl.call(url, **opts)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/spec/bps/coercer_spec.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe BPS::Coercer do
|
4
|
-
subject
|
4
|
+
subject { coercer }
|
5
|
+
|
6
|
+
let(:coercer) do
|
5
7
|
described_class.new(
|
6
8
|
name: :string,
|
7
9
|
codec: :symbol,
|
@@ -11,7 +13,6 @@ RSpec.describe BPS::Coercer do
|
|
11
13
|
tags: [:string],
|
12
14
|
)
|
13
15
|
end
|
14
|
-
|
15
16
|
let :options do
|
16
17
|
{
|
17
18
|
name: 123,
|
@@ -24,13 +25,13 @@ RSpec.describe BPS::Coercer do
|
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
27
|
-
it '
|
28
|
+
it 'validates' do
|
28
29
|
expect { described_class.new(name: :unknown) }.to raise_error(ArgumentError, /Unknown type :unknown/)
|
29
30
|
expect { described_class.new(bad: []) }.to raise_error(ArgumentError, /Array types must have exactly one entry/)
|
30
31
|
end
|
31
32
|
|
32
|
-
it '
|
33
|
-
expect(
|
33
|
+
it 'coerces options' do
|
34
|
+
expect(coercer.coerce(options)).to eq(
|
34
35
|
name: '123',
|
35
36
|
codec: :snappy,
|
36
37
|
retries: 4,
|
@@ -1,22 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe BPS::Publisher::InMem do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
expect(
|
10
|
-
expect(
|
4
|
+
subject { publisher }
|
5
|
+
|
6
|
+
let(:publisher) { described_class.new }
|
7
|
+
|
8
|
+
it 'maintains topics' do
|
9
|
+
expect(publisher.topic('x')).to be_a(described_class::Topic)
|
10
|
+
expect(publisher.topic_names).to eq(%w[x])
|
11
|
+
expect(publisher.topic('z')).to be_a(described_class::Topic)
|
12
|
+
expect(publisher.topic_names).to eq(%w[x z])
|
13
|
+
expect(publisher.topic('y')).to be_a(described_class::Topic)
|
14
|
+
expect(publisher.topic_names).to eq(%w[x y z])
|
11
15
|
end
|
12
16
|
|
13
|
-
it '
|
14
|
-
topic =
|
17
|
+
it 'publishes' do
|
18
|
+
topic = publisher.topic('x')
|
15
19
|
topic.publish('foo')
|
16
20
|
topic.publish('bar')
|
17
21
|
expect(topic.messages).to eq(%w[foo bar])
|
18
22
|
|
19
23
|
expect { topic.flush }.not_to raise_error
|
20
|
-
expect(
|
24
|
+
expect(publisher.topic('x').messages).to eq(%w[foo bar])
|
21
25
|
end
|
22
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Minimalist abstraction for publish-subscribe
|
14
14
|
email: info@blacksquaremedia.com
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
|
-
rubygems_version: 3.1.
|
46
|
+
rubygems_version: 3.1.4
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Multi-platform pubsub adapter
|