tweetstream 2.6.0 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of tweetstream might be problematic. Click here for more details.

@@ -10,35 +10,35 @@ describe TweetStream::Client do
10
10
  end
11
11
  @client = TweetStream::Client.new
12
12
 
13
- @stream = double("EM::Twitter::Client",
14
- :connect => true,
15
- :unbind => true,
16
- :each => true,
17
- :on_error => true,
18
- :on_max_reconnects => true,
19
- :on_reconnect => true,
20
- :connection_completed => true,
21
- :on_no_data_received => true,
22
- :on_unauthorized => true,
23
- :on_enhance_your_calm => true
13
+ @stream = double('EM::Twitter::Client',
14
+ :connect => true,
15
+ :unbind => true,
16
+ :each => true,
17
+ :on_error => true,
18
+ :on_max_reconnects => true,
19
+ :on_reconnect => true,
20
+ :connection_completed => true,
21
+ :on_no_data_received => true,
22
+ :on_unauthorized => true,
23
+ :on_enhance_your_calm => true
24
24
  )
25
25
  allow(EM).to receive(:run).and_yield
26
26
  allow(EM::Twitter::Client).to receive(:connect).and_return(@stream)
27
27
  end
28
28
 
29
- describe "Site Stream support" do
30
- context "when calling #sitestream" do
31
- it "sends the sitestream host" do
32
- expect(EM::Twitter::Client).to receive(:connect).with(hash_including(:host => "sitestream.twitter.com")).and_return(@stream)
29
+ describe 'Site Stream support' do
30
+ context 'when calling #sitestream' do
31
+ it 'sends the sitestream host' do
32
+ expect(EM::Twitter::Client).to receive(:connect).with(hash_including(:host => 'sitestream.twitter.com')).and_return(@stream)
33
33
  @client.sitestream
34
34
  end
35
35
 
36
- it "uses the sitestream uri" do
36
+ it 'uses the sitestream uri' do
37
37
  expect(@client).to receive(:start).once.with('/1.1/site.json', an_instance_of(Hash)).and_return(@stream)
38
38
  @client.sitestream
39
39
  end
40
40
 
41
- it "supports :followings => true" do
41
+ it 'supports :followings => true' do
42
42
  expect(@client).to receive(:start).once.with('/1.1/site.json', hash_including(:with => 'followings')).and_return(@stream)
43
43
  @client.sitestream(['115192457'], :followings => true)
44
44
  end
@@ -58,19 +58,19 @@ describe TweetStream::Client do
58
58
  @client.sitestream(['115192457'], :replies => 'all')
59
59
  end
60
60
 
61
- describe "control management" do
61
+ describe 'control management' do
62
62
  before do
63
- @control_response = {"control" =>
63
+ @control_response = {'control' =>
64
64
  {
65
- "control_uri" =>"/1.1/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50"
65
+ 'control_uri' => '/1.1/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50'
66
66
  }
67
67
  }
68
68
  end
69
- it "assigns the control_uri" do
69
+ it 'assigns the control_uri' do
70
70
  expect(@stream).to receive(:each).and_yield(@control_response.to_json)
71
71
  @client.sitestream
72
72
 
73
- expect(@client.control_uri).to eq("/1.1/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50")
73
+ expect(@client.control_uri).to eq('/1.1/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50')
74
74
  end
75
75
 
76
76
  it 'invokes the on_control callback' do
@@ -89,7 +89,7 @@ describe TweetStream::Client do
89
89
  expect(@client.controllable?).to be_true
90
90
  end
91
91
 
92
- it "instantiates a SiteStreamClient" do
92
+ it 'instantiates a SiteStreamClient' do
93
93
  expect(@stream).to receive(:each).and_yield(@control_response.to_json)
94
94
  @client.sitestream
95
95
 
@@ -108,24 +108,24 @@ describe TweetStream::Client do
108
108
  end
109
109
  end
110
110
 
111
- describe "data handling" do
112
- context "messages" do
111
+ describe 'data handling' do
112
+ context 'messages' do
113
113
  before do
114
- @ss_message = {'for_user' => '12345', 'message' => {'id' => 123, 'user' => {'screen_name' => 'monkey'}, 'text' => 'Oo oo aa aa'}}
114
+ @ss_message = {'for_user' => '321', 'message' => {'id' => 123, 'user' => {'screen_name' => 'monkey'}, 'text' => 'Oo oo aa aa'}}
115
115
  end
116
116
 
117
- it "yields a site stream message" do
117
+ it 'yields a site stream message' do
118
118
  expect(@stream).to receive(:each).and_yield(@ss_message.to_json)
119
119
  yielded_status = nil
120
120
  @client.sitestream do |message|
121
121
  yielded_status = message
122
122
  end
123
123
  expect(yielded_status).not_to be_nil
124
- expect(yielded_status[:for_user]).to eq('12345')
124
+ expect(yielded_status[:for_user]).to eq('321')
125
125
  expect(yielded_status[:message][:user][:screen_name]).to eq('monkey')
126
126
  expect(yielded_status[:message][:text]).to eq('Oo oo aa aa')
127
127
  end
128
- it "yields itself if block has an arity of 2" do
128
+ it 'yields itself if block has an arity of 2' do
129
129
  expect(@stream).to receive(:each).and_yield(@ss_message.to_json)
130
130
  yielded_client = nil
131
131
  @client.sitestream do |_, client|
@@ -136,12 +136,12 @@ describe TweetStream::Client do
136
136
  end
137
137
  end
138
138
 
139
- context "friends list" do
139
+ context 'friends list' do
140
140
  before do
141
- @friends_list = { 'friends' => [123, 456] }
142
- end
141
+ @friends_list = {'friends' => [123, 456]}
142
+ end
143
143
 
144
- it "yields a friends list array" do
144
+ it 'yields a friends list array' do
145
145
  expect(@stream).to receive(:each).and_yield(@friends_list.to_json)
146
146
  yielded_list = nil
147
147
  @client.on_friends do |friends|
@@ -11,74 +11,74 @@ describe TweetStream::Client do
11
11
  @client = TweetStream::Client.new
12
12
  end
13
13
 
14
- describe "#start" do
14
+ describe '#start' do
15
15
  before do
16
- @stream = double("EM::Twitter::Client",
17
- :connect => true,
18
- :unbind => true,
19
- :each => true,
20
- :on_error => true,
21
- :on_max_reconnects => true,
22
- :on_reconnect => true,
23
- :connection_completed => true,
24
- :on_no_data_received => true,
25
- :on_unauthorized => true,
26
- :on_enhance_your_calm => true
16
+ @stream = double('EM::Twitter::Client',
17
+ :connect => true,
18
+ :unbind => true,
19
+ :each => true,
20
+ :on_error => true,
21
+ :on_max_reconnects => true,
22
+ :on_reconnect => true,
23
+ :connection_completed => true,
24
+ :on_no_data_received => true,
25
+ :on_unauthorized => true,
26
+ :on_enhance_your_calm => true
27
27
  )
28
28
  allow(EM).to receive(:run).and_yield
29
29
  allow(EM::Twitter::Client).to receive(:connect).and_return(@stream)
30
30
  end
31
31
 
32
- it "connects if the reactor is already running" do
32
+ it 'connects if the reactor is already running' do
33
33
  allow(EM).to receive(:reactor_running?).and_return(true)
34
34
  expect(@client).to receive(:connect)
35
35
  @client.track('abc')
36
36
  end
37
37
 
38
- it "starts the reactor if not already running" do
38
+ it 'starts the reactor if not already running' do
39
39
  expect(EM).to receive(:run).once
40
40
  @client.track('abc')
41
41
  end
42
42
 
43
- it "warns when callbacks are passed as options" do
43
+ it 'warns when callbacks are passed as options' do
44
44
  allow(@stream).to receive(:each).and_return
45
45
  expect(Kernel).to receive(:warn).with(/Passing callbacks via the options hash is deprecated and will be removed in TweetStream 3.0/)
46
- @client.track('abc', :inited => Proc.new { })
46
+ @client.track('abc', :inited => proc {})
47
47
  end
48
48
 
49
49
  describe 'proxy usage' do
50
50
  it 'connects with a proxy' do
51
- @client = TweetStream::Client.new(:proxy => { :uri => 'http://someproxy:8081'})
51
+ @client = TweetStream::Client.new(:proxy => {:uri => 'http://someproxy:8081'})
52
52
  expect(EM::Twitter::Client).to receive(:connect).
53
- with(hash_including(:proxy => { :uri => 'http://someproxy:8081'})).and_return(@stream)
53
+ with(hash_including(:proxy => {:uri => 'http://someproxy:8081'})).and_return(@stream)
54
54
  expect(@stream).to receive(:each).and_return
55
55
  @client.track('abc')
56
56
  end
57
57
  end
58
58
 
59
- describe "#each" do
60
- it "calls the appropriate parser" do
59
+ describe '#each' do
60
+ it 'calls the appropriate parser' do
61
61
  @client = TweetStream::Client.new
62
62
  expect(MultiJson).to receive(:decode).and_return({})
63
63
  expect(@stream).to receive(:each).and_yield(sample_tweets[0].to_json)
64
- @client.track('abc','def')
64
+ @client.track('abc', 'def')
65
65
  end
66
66
 
67
- it "yields a Twitter::Tweet" do
67
+ it 'yields a Twitter::Tweet' do
68
68
  expect(@stream).to receive(:each).and_yield(sample_tweets[0].to_json)
69
- @client.track('abc'){|s| expect(s).to be_kind_of(Twitter::Tweet)}
69
+ @client.track('abc') { |s| expect(s).to be_kind_of(Twitter::Tweet) }
70
70
  end
71
71
 
72
- it "yields the client if a block with arity 2 is given" do
72
+ it 'yields the client if a block with arity 2 is given' do
73
73
  expect(@stream).to receive(:each).and_yield(sample_tweets[0].to_json)
74
- @client.track('abc'){|s,c| expect(c).to eq(@client)}
74
+ @client.track('abc') { |s, c| expect(c).to eq(@client) }
75
75
  end
76
76
 
77
- it "includes the proper values" do
77
+ it 'includes the proper values' do
78
78
  tweet = sample_tweets[0]
79
79
  tweet[:id] = 123
80
80
  tweet[:user][:screen_name] = 'monkey'
81
- tweet[:text] = "Oo oo aa aa"
81
+ tweet[:text] = 'Oo oo aa aa'
82
82
  expect(@stream).to receive(:each).and_yield(tweet.to_json)
83
83
  @client.track('abc') do |s|
84
84
  expect(s[:id]).to eq(123)
@@ -87,62 +87,62 @@ describe TweetStream::Client do
87
87
  end
88
88
  end
89
89
 
90
- it "calls the on_stall_warning callback if specified" do
90
+ it 'calls the on_stall_warning callback if specified' do
91
91
  expect(@stream).to receive(:each).and_yield(fixture('stall_warning.json'))
92
92
  @client.on_stall_warning do |warning|
93
93
  expect(warning[:code]).to eq('FALLING_BEHIND')
94
94
  end.track('abc')
95
95
  end
96
96
 
97
- it "calls the on_scrub_geo callback if specified" do
97
+ it 'calls the on_scrub_geo callback if specified' do
98
98
  expect(@stream).to receive(:each).and_yield(fixture('scrub_geo.json'))
99
99
  @client.on_scrub_geo do |up_to_status_id, user_id|
100
- expect(up_to_status_id).to eq(9876)
101
- expect(user_id).to eq(1234)
100
+ expect(up_to_status_id).to eq(987)
101
+ expect(user_id).to eq(123)
102
102
  end.track('abc')
103
103
  end
104
104
 
105
- it "calls the on_delete callback" do
105
+ it 'calls the on_delete callback' do
106
106
  expect(@stream).to receive(:each).and_yield(fixture('delete.json'))
107
107
  @client.on_delete do |id, user_id|
108
- expect(id).to eq(1234)
108
+ expect(id).to eq(123)
109
109
  expect(user_id).to eq(3)
110
110
  end.track('abc')
111
111
  end
112
112
 
113
- it "calls the on_limit callback" do
113
+ it 'calls the on_limit callback' do
114
114
  limit = nil
115
115
  expect(@stream).to receive(:each).and_yield(fixture('limit.json'))
116
116
  @client.on_limit do |l|
117
117
  limit = l
118
118
  end.track('abc')
119
119
 
120
- expect(limit).to eq(1234)
120
+ expect(limit).to eq(123)
121
121
  end
122
122
 
123
- it "calls the on_status_withheld callback" do
123
+ it 'calls the on_status_withheld callback' do
124
124
  status = nil
125
125
  expect(@stream).to receive(:each).and_yield(fixture('status_withheld.json'))
126
126
  @client.on_status_withheld do |s|
127
127
  status = s
128
128
  end.track('abc')
129
129
 
130
- expect(status[:user_id]).to eq(123456)
130
+ expect(status[:user_id]).to eq(123)
131
131
  end
132
132
 
133
- it "calls the on_user_withheld callback" do
133
+ it 'calls the on_user_withheld callback' do
134
134
  status = nil
135
135
  expect(@stream).to receive(:each).and_yield(fixture('user_withheld.json'))
136
136
  @client.on_user_withheld do |s|
137
137
  status = s
138
138
  end.track('abc')
139
139
 
140
- expect(status[:id]).to eq(123456)
140
+ expect(status[:id]).to eq(123)
141
141
  end
142
142
 
143
- context "using on_anything" do
144
- it "yields the raw hash" do
145
- hash = {:id => 1234}
143
+ context 'using on_anything' do
144
+ it 'yields the raw hash' do
145
+ hash = {:id => 123}
146
146
  expect(@stream).to receive(:each).and_yield(hash.to_json)
147
147
  yielded_hash = nil
148
148
  @client.on_anything do |h|
@@ -150,10 +150,10 @@ describe TweetStream::Client do
150
150
  end.track('abc')
151
151
 
152
152
  expect(yielded_hash).not_to be_nil
153
- expect(yielded_hash[:id]).to eq(1234)
153
+ expect(yielded_hash[:id]).to eq(123)
154
154
  end
155
- it "yields itself if block has an arity of 2" do
156
- hash = {:id => 1234}
155
+ it 'yields itself if block has an arity of 2' do
156
+ hash = {:id => 123}
157
157
  expect(@stream).to receive(:each).and_yield(hash.to_json)
158
158
  yielded_client = nil
159
159
  @client.on_anything do |_, client|
@@ -164,12 +164,12 @@ describe TweetStream::Client do
164
164
  end
165
165
  end
166
166
 
167
- context "using on_timeline_status" do
168
- it "yields a Status" do
167
+ context 'using on_timeline_status' do
168
+ it 'yields a Status' do
169
169
  tweet = sample_tweets[0]
170
170
  tweet[:id] = 123
171
171
  tweet[:user][:screen_name] = 'monkey'
172
- tweet[:text] = "Oo oo aa aa"
172
+ tweet[:text] = 'Oo oo aa aa'
173
173
  expect(@stream).to receive(:each).and_yield(tweet.to_json)
174
174
  yielded_status = nil
175
175
  @client.on_timeline_status do |status|
@@ -180,7 +180,7 @@ describe TweetStream::Client do
180
180
  expect(yielded_status.user.screen_name).to eq('monkey')
181
181
  expect(yielded_status.text).to eq('Oo oo aa aa')
182
182
  end
183
- it "yields itself if block has an arity of 2" do
183
+ it 'yields itself if block has an arity of 2' do
184
184
  expect(@stream).to receive(:each).and_yield(sample_tweets[0].to_json)
185
185
  yielded_client = nil
186
186
  @client.on_timeline_status do |_, client|
@@ -191,22 +191,22 @@ describe TweetStream::Client do
191
191
  end
192
192
  end
193
193
 
194
- context "using on_direct_message" do
195
- it "yields a DirectMessage" do
194
+ context 'using on_direct_message' do
195
+ it 'yields a DirectMessage' do
196
196
  direct_message = sample_direct_messages[0]
197
- direct_message[:direct_message][:id] = 1234
198
- direct_message[:direct_message][:sender][:screen_name] = "coder"
197
+ direct_message[:direct_message][:id] = 123
198
+ direct_message[:direct_message][:sender][:screen_name] = 'coder'
199
199
  expect(@stream).to receive(:each).and_yield(direct_message.to_json)
200
200
  yielded_dm = nil
201
201
  @client.on_direct_message do |dm|
202
202
  yielded_dm = dm
203
203
  end.userstream
204
204
  expect(yielded_dm).not_to be_nil
205
- expect(yielded_dm.id).to eq(1234)
206
- expect(yielded_dm.sender.screen_name).to eq("coder")
205
+ expect(yielded_dm.id).to eq(123)
206
+ expect(yielded_dm.sender.screen_name).to eq('coder')
207
207
  end
208
208
 
209
- it "yields itself if block has an arity of 2" do
209
+ it 'yields itself if block has an arity of 2' do
210
210
  expect(@stream).to receive(:each).and_yield(sample_direct_messages[0].to_json)
211
211
  yielded_client = nil
212
212
  @client.on_direct_message do |_, client|
@@ -216,14 +216,14 @@ describe TweetStream::Client do
216
216
  end
217
217
  end
218
218
 
219
- it "calls on_error if a non-hash response is received" do
219
+ it 'calls on_error if a non-hash response is received' do
220
220
  expect(@stream).to receive(:each).and_yield('["favorited"]')
221
221
  @client.on_error do |message|
222
222
  expect(message).to eq('Unexpected JSON object in stream: ["favorited"]')
223
223
  end.track('abc')
224
224
  end
225
225
 
226
- it "calls on_error if a json parse error occurs" do
226
+ it 'calls on_error if a json parse error occurs' do
227
227
  expect(@stream).to receive(:each).and_yield("{'a_key':}")
228
228
  @client.on_error do |message|
229
229
  expect(message).to eq("MultiJson::DecodeError occured in stream: {'a_key':}")
@@ -231,33 +231,33 @@ describe TweetStream::Client do
231
231
  end
232
232
  end
233
233
 
234
- describe "#on_error" do
235
- it "passes the message on to the error block" do
234
+ describe '#on_error' do
235
+ it 'passes the message on to the error block' do
236
236
  expect(@stream).to receive(:on_error).and_yield('Uh oh')
237
237
  @client.on_error do |m|
238
238
  expect(m).to eq('Uh oh')
239
239
  end.track('abc')
240
240
  end
241
241
 
242
- it "returns the block when defined" do
242
+ it 'returns the block when defined' do
243
243
  @client.on_error { |m| true; }
244
244
  expect(@client.on_error).to be_kind_of(Proc)
245
245
  end
246
246
 
247
- it "returns nil when undefined" do
247
+ it 'returns nil when undefined' do
248
248
  expect(@client.on_error).to be_nil
249
249
  end
250
250
  end
251
251
 
252
- describe "#on_max_reconnects" do
253
- it "raises a ReconnectError" do
252
+ describe '#on_max_reconnects' do
253
+ it 'raises a ReconnectError' do
254
254
  expect(@stream).to receive(:on_max_reconnects).and_yield(30, 20)
255
- expect(lambda{ @client.track('abc') }).to raise_error(TweetStream::ReconnectError, "Failed to reconnect after 20 tries.")
255
+ expect(lambda { @client.track('abc') }).to raise_error(TweetStream::ReconnectError, 'Failed to reconnect after 20 tries.')
256
256
  end
257
257
  end
258
258
  end
259
259
 
260
- describe "API methods" do
260
+ describe 'API methods' do
261
261
  %w(firehose retweet sample links).each do |method|
262
262
  it "##{method} should make a call to start with \"statuses/#{method}\"" do
263
263
  expect(@client).to receive(:start).once.with('/1.1/statuses/' + method + '.json', {})
@@ -265,7 +265,7 @@ describe TweetStream::Client do
265
265
  end
266
266
  end
267
267
 
268
- describe "#filter" do
268
+ describe '#filter' do
269
269
  it "makes a call to 'statuses/filter' with the query params provided" do
270
270
  expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :follow => 123, :method => :post)
271
271
  @client.filter(:follow => 123)
@@ -276,19 +276,19 @@ describe TweetStream::Client do
276
276
  end
277
277
  end
278
278
 
279
- describe "#follow" do
279
+ describe '#follow' do
280
280
  it "makes a call to start with 'statuses/filter' and a follow query parameter" do
281
281
  expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :follow => [123], :method => :post)
282
282
  @client.follow(123)
283
283
  end
284
284
 
285
- it "comma-joins multiple arguments" do
286
- expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :follow => [123,456], :method => :post)
285
+ it 'comma-joins multiple arguments' do
286
+ expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :follow => [123, 456], :method => :post)
287
287
  @client.follow(123, 456)
288
288
  end
289
289
  end
290
290
 
291
- describe "#locations" do
291
+ describe '#locations' do
292
292
  it "calls #start with 'statuses/filter' with the query params provided longitude/latitude pairs" do
293
293
  expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :method => :post)
294
294
  @client.locations('-122.75,36.8,-121.75,37.8,-74,40,-73,41')
@@ -300,24 +300,24 @@ describe TweetStream::Client do
300
300
  end
301
301
  end
302
302
 
303
- describe "#track" do
303
+ describe '#track' do
304
304
  it "makes a call to start with 'statuses/filter' and a track query parameter" do
305
- expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => ['test'], :method => :post)
305
+ expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => %w[test], :method => :post)
306
306
  @client.track('test')
307
307
  end
308
308
 
309
- it "comma-joins multiple arguments" do
310
- expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => ['foo', 'bar', 'baz'], :method => :post)
309
+ it 'comma-joins multiple arguments' do
310
+ expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => %w[foo bar baz], :method => :post)
311
311
  @client.track('foo', 'bar', 'baz')
312
312
  end
313
313
 
314
- it "comma-joins an array of arguments" do
315
- expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => [['foo','bar','baz']], :method => :post)
316
- @client.track(['foo','bar','baz'])
314
+ it 'comma-joins an array of arguments' do
315
+ expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => [%w[foo bar baz]], :method => :post)
316
+ @client.track(%w[foo bar baz])
317
317
  end
318
318
 
319
319
  it "calls #start with 'statuses/filter' and the provided queries" do
320
- expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => ['rock'], :method => :post)
320
+ expect(@client).to receive(:start).once.with('/1.1/statuses/filter.json', :track => %w[rock], :method => :post)
321
321
  @client.track('rock')
322
322
  end
323
323
  end
@@ -325,25 +325,25 @@ describe TweetStream::Client do
325
325
 
326
326
  %w(on_delete on_limit on_inited on_reconnect on_no_data_received on_unauthorized on_enhance_your_calm).each do |proc_setter|
327
327
  describe "##{proc_setter}" do
328
- it "sets when a block is given" do
329
- proc = Proc.new{|a,b| puts a }
330
- @client.send(proc_setter, &proc)
331
- expect(@client.send(proc_setter)).to eq(proc)
328
+ it 'sets when a block is given' do
329
+ block = proc { |a, b| puts a }
330
+ @client.send(proc_setter, &block)
331
+ expect(@client.send(proc_setter)).to eq(block)
332
332
  end
333
333
 
334
- it "returns nil when undefined" do
334
+ it 'returns nil when undefined' do
335
335
  expect(@client.send(proc_setter)).to be_nil
336
336
  end
337
337
  end
338
338
  end
339
339
 
340
- describe "#stop" do
341
- it "calls EventMachine::stop_event_loop" do
340
+ describe '#stop' do
341
+ it 'calls EventMachine::stop_event_loop' do
342
342
  expect(EventMachine).to receive(:stop_event_loop)
343
343
  expect(TweetStream::Client.new.stop).to be_nil
344
344
  end
345
345
 
346
- it "returns the last status yielded" do
346
+ it 'returns the last status yielded' do
347
347
  expect(EventMachine).to receive(:stop_event_loop)
348
348
  client = TweetStream::Client.new
349
349
  client.send(:instance_variable_set, :@last_status, {})
@@ -351,39 +351,39 @@ describe TweetStream::Client do
351
351
  end
352
352
  end
353
353
 
354
- describe "#close_connection" do
355
- it "does not call EventMachine::stop_event_loop" do
354
+ describe '#close_connection' do
355
+ it 'does not call EventMachine::stop_event_loop' do
356
356
  expect(EventMachine).not_to receive(:stop_event_loop)
357
357
  expect(TweetStream::Client.new.close_connection).to be_nil
358
358
  end
359
359
  end
360
360
 
361
- describe "#stop_stream" do
361
+ describe '#stop_stream' do
362
362
  before(:each) do
363
- @stream = double("EM::Twitter::Client",
364
- :connect => true,
365
- :unbind => true,
366
- :each => true,
367
- :on_error => true,
368
- :on_max_reconnects => true,
369
- :on_reconnect => true,
370
- :connection_completed => true,
371
- :on_no_data_received => true,
372
- :on_unauthorized => true,
373
- :on_enhance_your_calm => true,
374
- :stop => true
363
+ @stream = double('EM::Twitter::Client',
364
+ :connect => true,
365
+ :unbind => true,
366
+ :each => true,
367
+ :on_error => true,
368
+ :on_max_reconnects => true,
369
+ :on_reconnect => true,
370
+ :connection_completed => true,
371
+ :on_no_data_received => true,
372
+ :on_unauthorized => true,
373
+ :on_enhance_your_calm => true,
374
+ :stop => true
375
375
  )
376
376
  allow(EM::Twitter::Client).to receive(:connect).and_return(@stream)
377
377
  @client = TweetStream::Client.new
378
378
  @client.connect('/')
379
379
  end
380
380
 
381
- it "calls stream.stop to cleanly stop the current stream" do
381
+ it 'calls stream.stop to cleanly stop the current stream' do
382
382
  expect(@stream).to receive(:stop)
383
383
  @client.stop_stream
384
384
  end
385
385
 
386
- it "does not stop eventmachine" do
386
+ it 'does not stop eventmachine' do
387
387
  expect(EventMachine).not_to receive(:stop_event_loop)
388
388
  @client.stop_stream
389
389
  end