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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2faa76054df9c4e28303d85150d33ed50b315aa5
4
- data.tar.gz: 6595037bb4b9d0c4d5d782ba6023bcf4fc3e60d3
3
+ metadata.gz: 82175de4c60ad19bbd38a5c4e3c7abb69787d5fa
4
+ data.tar.gz: 21b672284628b6531d56670d2055395e03978506
5
5
  SHA512:
6
- metadata.gz: 01a1887b81e5855f5f79ea161772ff30ab924c78703e996fd7cbbbfd5727f0b929e8e98faa2ad482a4bc2d4dbd6ef4edc0dff4f8f2831cea9eb55267abc37da7
7
- data.tar.gz: 2b483b9d83d4acf3b451ee028130ead5cdb36202e74c842c0612d0688a126ec6d6979de0580bf89ad75fd405e73ba6ccdfd2a04bf03bd65686a417b2cb781307
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
- @last_response << (@decoder ||= BaseDecoder.new).decode(data)
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
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module Twitter
3
- VERSION = "0.3.0" unless defined?(EventMachine::Twitter::VERSION)
3
+ VERSION = "0.3.1" unless defined?(EventMachine::Twitter::VERSION)
4
4
  end
5
5
  end
@@ -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.0
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-09-23 00:00:00.000000000 Z
11
+ date: 2013-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine