nebulous_stomp 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/feature/feature_test_spec.rb +9 -2
- data/feature/gimme.rb +4 -1
- data/lib/nebulous_stomp/message.rb +5 -1
- data/lib/nebulous_stomp/msg/body.rb +2 -1
- data/lib/nebulous_stomp/version.rb +1 -1
- data/spec/message_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd218829ddf19457d5aab68ef9a6539a2e68f2a8
|
4
|
+
data.tar.gz: ef55678e7921f2ed9d750b6a6aac5b2b9417e0cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dff8f6526477cf458da01e58ffcac4b59f6ebfeddc7374887ae230f1c2ff7ea7cd25c3278889a6bfd813959450554c1fa00323cb610e2ee2239b6cb9a01a1798
|
7
|
+
data.tar.gz: 46520f833f856a807a135ff0035211ee1e12edf0ae2ae057c28bcac033525ba321cdb2174f0e7b949b4d5a904ad0f9e9b29b0b08e7378dcf6021f739fb4f387d
|
@@ -96,12 +96,19 @@ describe 'stomp use cases:' do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it "can respond to a message with a non-Protocol message" do
|
99
|
-
message = NebulousStomp::Message.new(verb: 'gimmemessage', contentType: '
|
99
|
+
message = NebulousStomp::Message.new(verb: 'gimmemessage', contentType: 'application/json')
|
100
100
|
response = NebulousStomp::Request.new("featuretest", message).send_no_cache
|
101
101
|
|
102
102
|
expect( response ).to be_kind_of(NebulousStomp::Message)
|
103
103
|
expect( response.verb ).to be_nil
|
104
|
-
expect( response.body ).to eq
|
104
|
+
expect( response.body ).to eq(["weird message body", 12])
|
105
|
+
end
|
106
|
+
|
107
|
+
it "can respond with an empty array as the message body" do
|
108
|
+
message = NebulousStomp::Message.new(verb: 'gimmeempty', contentType: 'application/json')
|
109
|
+
response = NebulousStomp::Request.new("featuretest", message).send_no_cache
|
110
|
+
expect( response ).to be_kind_of(NebulousStomp::Message)
|
111
|
+
expect( response.body ).to eq([])
|
105
112
|
end
|
106
113
|
|
107
114
|
it "can send a message >32k" do
|
data/feature/gimme.rb
CHANGED
@@ -48,8 +48,11 @@ class Gimme
|
|
48
48
|
when "gimmeprotocol"
|
49
49
|
msg.respond_with_protocol("foo", "bar", "baz")
|
50
50
|
|
51
|
+
when "gimmeempty"
|
52
|
+
msg.respond([])
|
53
|
+
|
51
54
|
when "gimmemessage"
|
52
|
-
msg.respond("weird message body")
|
55
|
+
msg.respond(["weird message body", 12])
|
53
56
|
|
54
57
|
when "gimmebigmessage"
|
55
58
|
body = big_body msg.params
|
@@ -135,6 +135,9 @@ module NebulousStomp
|
|
135
135
|
# * :stompHeaders -- for a message from Stomp, the raw Stomp Headers string
|
136
136
|
# * :verb -- part of The Protocol
|
137
137
|
#
|
138
|
+
# Note that body is taken to be a string if the content type is text, and is taken to be JSON
|
139
|
+
# if the content type is JSON.
|
140
|
+
#
|
138
141
|
def initialize(hash)
|
139
142
|
@header = Msg::Header.new(hash)
|
140
143
|
@body = Msg::Body.new(content_is_json?, hash)
|
@@ -185,7 +188,8 @@ module NebulousStomp
|
|
185
188
|
# :call-seq:
|
186
189
|
# message.respond_with_protocol(body) -> queue, Message
|
187
190
|
#
|
188
|
-
# Repond with a message body (presumably a custom one that's non-Protocol).
|
191
|
+
# Repond with a message body (presumably a custom one that's non-Protocol). If the content type
|
192
|
+
# is JSON, this can be an array or a Hash. If the content type is text, it must be a String.
|
189
193
|
#
|
190
194
|
def respond(body)
|
191
195
|
fail NebulousError, "Don't know which queue to reply to" unless reply_to
|
data/spec/message_spec.rb
CHANGED
@@ -120,6 +120,12 @@ describe Message do
|
|
120
120
|
expect( m.body ).to eq "wigi wigi"
|
121
121
|
end
|
122
122
|
|
123
|
+
it "leaves body alone if it\'s an empty array and there is no protocol and no stompbody" do
|
124
|
+
# rather than processing a nil stompbody and ending up with nil/NULL
|
125
|
+
m = Message.new(body: [])
|
126
|
+
expect( m.body ).to eq([])
|
127
|
+
end
|
128
|
+
|
123
129
|
it 'takes the content type from the input arguments' do
|
124
130
|
msg = Message.new( new_hash.merge(contentType: 'foo') )
|
125
131
|
expect( msg.content_type ).to eq "foo"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nebulous_stomp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04
|
11
|
+
date: 2017-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|