em-twitter 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/em-twitter/connection.rb +3 -1
- data/lib/em-twitter/version.rb +1 -1
- data/spec/em-twitter/connection_spec.rb +34 -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: 82175de4c60ad19bbd38a5c4e3c7abb69787d5fa
|
4
|
+
data.tar.gz: 21b672284628b6531d56670d2055395e03978506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67beb9aa870e38824898c935317f5a6830cb5d67a8c46704a0779142f0b03df4603cda9b6ca73008dab5c693f92997c4a6efc52dbabcf303355671e0a38fd35a
|
7
|
+
data.tar.gz: f7ec108c92effab5a0d368c7664ccaeee54dfa6bc1f2ce652a69c803d952717db4a1ad608e0cde3f6653ef5cce8a6a4b3fac7eba520e3292aa131a3871851335
|
@@ -137,8 +137,10 @@ module EventMachine
|
|
137
137
|
protected
|
138
138
|
|
139
139
|
def handle_stream(data)
|
140
|
-
|
140
|
+
# handle empty lines, Site stream sometimes returns \r\n\r\n
|
141
|
+
return if data.strip.empty?
|
141
142
|
|
143
|
+
@last_response << (@decoder ||= BaseDecoder.new).decode(data)
|
142
144
|
if @last_response.complete?
|
143
145
|
invoke_callback(@client.each_item_callback, @last_response.body)
|
144
146
|
end
|
data/lib/em-twitter/version.rb
CHANGED
@@ -93,6 +93,40 @@ describe EM::Twitter::Connection do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
+
describe "#each with extra newlines in responses" do
|
97
|
+
before do
|
98
|
+
Mockingbird.setup(test_options) do
|
99
|
+
status '200', 'Success'
|
100
|
+
|
101
|
+
on_connection('*') do
|
102
|
+
100.times do
|
103
|
+
send %({"foo":"bar"}\r\n\r\n)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
after { Mockingbird.teardown }
|
111
|
+
|
112
|
+
it "emits each complete response chunk" do
|
113
|
+
responses = []
|
114
|
+
|
115
|
+
EM.run do
|
116
|
+
client = EM::Twitter::Client.connect(default_options)
|
117
|
+
client.each do |message|
|
118
|
+
responses << message
|
119
|
+
EM.stop if responses.size >= 100
|
120
|
+
end
|
121
|
+
|
122
|
+
EM::Timer.new(10) { EM.stop }
|
123
|
+
end
|
124
|
+
|
125
|
+
expect(responses.size).to be >= 100
|
126
|
+
expect(responses.last).to eq('{"foo":"bar"}')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
96
130
|
describe "stall handling" do
|
97
131
|
before do
|
98
132
|
stub_const("EM::Twitter::Connection::STALL_TIMEOUT", 5)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Agalloco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|