qsagi 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +2 -2
- data/lib/qsagi/version.rb +1 -1
- data/qsagi.gemspec +1 -1
- data/spec/qsagi/confirmed_queue_spec.rb +4 -4
- data/spec/qsagi/json_serializer_spec.rb +3 -3
- data/spec/qsagi/message_spec.rb +3 -3
- data/spec/qsagi/queue_spec.rb +16 -16
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 86214de8cc8d5656f3f4aa2a3b07b50db7f09700d3480d8bab7f18d24b9796ce
|
4
|
+
data.tar.gz: e65636480947e02b0a5fb7533c409ac43f8fd71a044bafbfb8652a781212bb77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79e5678de21442c5c070b82852e23f1e9082ef8095bea93b85729dd62c2f60bf4b4831705ca2b2a2aecb9e19bde37e2c4e6636f2de50fead4b25b0f800176da5
|
7
|
+
data.tar.gz: b771c9e5b46ab38cf537a997b455b79598ce32ae8ae1e654e362edc457c8ee95634c8aec6c76cc6fda620032cba5f7b81dd30cc24e9da75a79178e9c86721a9a
|
data/Gemfile
CHANGED
data/lib/qsagi/version.rb
CHANGED
data/qsagi.gemspec
CHANGED
@@ -6,28 +6,28 @@ describe Qsagi::ConfirmedQueue do
|
|
6
6
|
queue = Qsagi::ConfirmedQueue.new(nil)
|
7
7
|
queue.instance_variable_set(:@unconfirmed_messages, {2 => "message"})
|
8
8
|
queue._confirm_messages!(:delivery_tag => 2, :multiple => false, :is_nack => true)
|
9
|
-
queue.nacked_messages.
|
9
|
+
expect(queue.nacked_messages).to eq(["message"])
|
10
10
|
end
|
11
11
|
|
12
12
|
it "adds multiple nacked messages to nacked_messages" do
|
13
13
|
queue = Qsagi::ConfirmedQueue.new(nil)
|
14
14
|
queue.instance_variable_set(:@unconfirmed_messages, {2 => "message", 3 => "other_message"})
|
15
15
|
queue._confirm_messages!(:delivery_tag => 3, :multiple => true, :is_nack => true)
|
16
|
-
queue.nacked_messages.
|
16
|
+
expect(queue.nacked_messages).to eq(["message", "other_message"])
|
17
17
|
end
|
18
18
|
|
19
19
|
it "removes a single acked message from unconfirmed_messages" do
|
20
20
|
queue = Qsagi::ConfirmedQueue.new(nil)
|
21
21
|
queue.instance_variable_set(:@unconfirmed_messages, {2 => "message", 3 => "other_message"})
|
22
22
|
queue._confirm_messages!(:delivery_tag => 2, :multiple => false, :is_nack => false)
|
23
|
-
queue.instance_variable_get(:@unconfirmed_messages).
|
23
|
+
expect(queue.instance_variable_get(:@unconfirmed_messages)).to eq(3 => "other_message")
|
24
24
|
end
|
25
25
|
|
26
26
|
it "removes multiple acked messages from unconfirmed_messages" do
|
27
27
|
queue = Qsagi::ConfirmedQueue.new(nil)
|
28
28
|
queue.instance_variable_set(:@unconfirmed_messages, {2 => "message", 3 => "other_message", 4 => "this_dude"})
|
29
29
|
queue._confirm_messages!(:delivery_tag => 3, :multiple => true, :is_nack => false)
|
30
|
-
queue.instance_variable_get(:@unconfirmed_messages).
|
30
|
+
expect(queue.instance_variable_get(:@unconfirmed_messages)).to eq(4 => "this_dude")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -3,13 +3,13 @@ require "spec_helper"
|
|
3
3
|
describe Qsagi::JsonSerializer do
|
4
4
|
describe "self.deserialize" do
|
5
5
|
it "parses json" do
|
6
|
-
Qsagi::JsonSerializer.deserialize('{"a": "b"}').
|
6
|
+
expect(Qsagi::JsonSerializer.deserialize('{"a": "b"}')).to eq("a" => "b")
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
describe "self.serialize" do
|
11
11
|
it "parses json" do
|
12
|
-
Qsagi::JsonSerializer.serialize({"a" => "b"}).
|
12
|
+
expect(Qsagi::JsonSerializer.serialize({"a" => "b"})).to eq('{"a":"b"}')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -19,7 +19,7 @@ describe Qsagi::JsonSerializer do
|
|
19
19
|
end
|
20
20
|
json_queue.connect do |queue|
|
21
21
|
queue.push :a => 1
|
22
|
-
queue.pop.payload.
|
22
|
+
expect(queue.pop.payload).to eq('a' => 1)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/spec/qsagi/message_spec.rb
CHANGED
@@ -4,20 +4,20 @@ describe Qsagi::Message do
|
|
4
4
|
describe "delivery_tag" do
|
5
5
|
it "returns the delivery_tag" do
|
6
6
|
delivery_details = OpenStruct.new(:delivery_tag => "tag")
|
7
|
-
Qsagi::Message.new(delivery_details, :parsed_payload).delivery_tag.
|
7
|
+
expect(Qsagi::Message.new(delivery_details, :parsed_payload).delivery_tag).to eq("tag")
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "exchange" do
|
12
12
|
it "returns the exchange" do
|
13
13
|
delivery_details = OpenStruct.new(:exchange => "the_exchange")
|
14
|
-
Qsagi::Message.new(delivery_details, :parsed_payload).exchange.
|
14
|
+
expect(Qsagi::Message.new(delivery_details, :parsed_payload).exchange).to eq("the_exchange")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe "payload" do
|
19
19
|
it "returns the parsed payload" do
|
20
|
-
Qsagi::Message.new(:deliver_details, :parsed_payload).payload.
|
20
|
+
expect(Qsagi::Message.new(:deliver_details, :parsed_payload).payload).to eq(:parsed_payload)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/spec/qsagi/queue_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Qsagi::Queue do
|
|
5
5
|
ExampleQueue.connect do |queue|
|
6
6
|
queue.push("message")
|
7
7
|
result = queue.pop
|
8
|
-
result.payload.
|
8
|
+
expect(result.payload).to eq("message")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -22,11 +22,11 @@ describe Qsagi::Queue do
|
|
22
22
|
end
|
23
23
|
queue_on_exchange1.connect do |queue|
|
24
24
|
message = queue.pop
|
25
|
-
message.payload.
|
26
|
-
message.exchange.
|
25
|
+
expect(message.payload).to eq("message1")
|
26
|
+
expect(message.exchange).to eq("exchange1")
|
27
27
|
end
|
28
28
|
queue_on_exchange2.connect do |queue|
|
29
|
-
queue.pop.
|
29
|
+
expect(queue.pop).to be_nil
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -36,7 +36,7 @@ describe Qsagi::Queue do
|
|
36
36
|
ExampleQueue.connect do |queue|
|
37
37
|
queue.push("message")
|
38
38
|
queue.clear
|
39
|
-
queue.pop.
|
39
|
+
expect(queue.pop).to be_nil
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -45,11 +45,11 @@ describe Qsagi::Queue do
|
|
45
45
|
it "returns the number of messages in the queue" do
|
46
46
|
ExampleQueue.connect do |queue|
|
47
47
|
queue.push("message")
|
48
|
-
queue.length.
|
48
|
+
expect(queue.length).to eq(1)
|
49
49
|
queue.push("message")
|
50
|
-
queue.length.
|
50
|
+
expect(queue.length).to eq(2)
|
51
51
|
queue.pop
|
52
|
-
queue.length.
|
52
|
+
expect(queue.length).to eq(1)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -62,7 +62,7 @@ describe Qsagi::Queue do
|
|
62
62
|
queue.reject(message, :requeue => true)
|
63
63
|
end
|
64
64
|
ExampleQueue.connect do |queue|
|
65
|
-
queue.length.
|
65
|
+
expect(queue.length).to eq(1)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -73,7 +73,7 @@ describe Qsagi::Queue do
|
|
73
73
|
queue.reject(message, :requeue => false)
|
74
74
|
end
|
75
75
|
ExampleQueue.connect do |queue|
|
76
|
-
queue.length.
|
76
|
+
expect(queue.length).to eq(0)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -83,11 +83,11 @@ describe Qsagi::Queue do
|
|
83
83
|
ExampleQueue.connect do |queue|
|
84
84
|
queue.push("message")
|
85
85
|
message = queue.pop
|
86
|
-
message.payload.
|
86
|
+
expect(message.payload).to eq("message")
|
87
87
|
end
|
88
88
|
ExampleQueue.connect do |queue|
|
89
89
|
message = queue.pop
|
90
|
-
message.
|
90
|
+
expect(message).to be_nil
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -95,16 +95,16 @@ describe Qsagi::Queue do
|
|
95
95
|
ExampleQueue.connect do |queue|
|
96
96
|
queue.push("message")
|
97
97
|
message = queue.pop(:auto_ack => false)
|
98
|
-
message.payload.
|
98
|
+
expect(message.payload).to eq("message")
|
99
99
|
end
|
100
100
|
ExampleQueue.connect do |queue|
|
101
101
|
message = queue.pop(:auto_ack => false)
|
102
|
-
message.payload.
|
102
|
+
expect(message.payload).to eq("message")
|
103
103
|
queue.ack(message)
|
104
104
|
end
|
105
105
|
ExampleQueue.connect do |queue|
|
106
106
|
message = queue.pop(:auto_ack => false)
|
107
|
-
message.
|
107
|
+
expect(message).to be_nil
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
@@ -114,7 +114,7 @@ describe Qsagi::Queue do
|
|
114
114
|
ExampleQueue.connect(:queue_type => :confirmed) do |queue|
|
115
115
|
queue.push("message")
|
116
116
|
queue.wait_for_confirms
|
117
|
-
queue.nacked_messages.size.
|
117
|
+
expect(queue.nacked_messages.size).to eq(0)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qsagi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.7'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.7'
|
41
41
|
description: A friendly way to talk to RabbitMQ
|
@@ -83,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
87
|
-
rubygems_version: 2.5.2.1
|
86
|
+
rubygems_version: 3.0.8
|
88
87
|
signing_key:
|
89
88
|
specification_version: 4
|
90
89
|
summary: A friendly way to talk to RabbitMQ
|