t 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/t/collectable.rb +6 -0
- data/lib/t/search.rb +37 -22
- data/lib/t/version.rb +1 -1
- data/spec/fixtures/empty_array.json +1 -0
- data/spec/search_spec.rb +82 -220
- metadata +270 -269
data/lib/t/collectable.rb
CHANGED
@@ -7,5 +7,11 @@ module T
|
|
7
7
|
object.last? ? collection : collect_with_cursor(collection, object.next_cursor, &block)
|
8
8
|
end
|
9
9
|
|
10
|
+
def collect_with_max_id(collection=[], max_id=nil, &block)
|
11
|
+
array = yield max_id
|
12
|
+
collection += array
|
13
|
+
array.empty? ? collection : collect_with_max_id(collection, array.last.id - 1, &block)
|
14
|
+
end
|
15
|
+
|
10
16
|
end
|
11
17
|
end
|
data/lib/t/search.rb
CHANGED
@@ -3,7 +3,7 @@ require 'csv'
|
|
3
3
|
# 'fastercsv' required on Ruby versions < 1.9
|
4
4
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
5
5
|
require 'retryable'
|
6
|
-
require 't/
|
6
|
+
require 't/collectable'
|
7
7
|
require 't/printable'
|
8
8
|
require 't/rcfile'
|
9
9
|
require 't/requestable'
|
@@ -12,11 +12,11 @@ require 'thor'
|
|
12
12
|
module T
|
13
13
|
class Search < Thor
|
14
14
|
include ActionView::Helpers::DateHelper
|
15
|
+
include T::Collectable
|
15
16
|
include T::Printable
|
16
17
|
include T::Requestable
|
17
18
|
|
18
19
|
DEFAULT_NUM_RESULTS = 20
|
19
|
-
MAX_PAGES = 16
|
20
20
|
MAX_NUM_RESULTS = 200
|
21
21
|
MAX_SCREEN_NAME_SIZE = 20
|
22
22
|
|
@@ -62,13 +62,16 @@ module T
|
|
62
62
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
63
63
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
64
64
|
def favorites(query)
|
65
|
-
|
65
|
+
opts = {:count => MAX_NUM_RESULTS}
|
66
|
+
statuses = collect_with_max_id do |max_id|
|
67
|
+
opts[:max_id] = max_id unless max_id.nil?
|
66
68
|
retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
|
67
|
-
client.favorites(
|
68
|
-
/#{query}/i.match(status.text)
|
69
|
-
end
|
69
|
+
client.favorites(opts)
|
70
70
|
end
|
71
71
|
end.flatten.compact
|
72
|
+
statuses = statuses.select do |status|
|
73
|
+
/#{query}/i.match(status.text)
|
74
|
+
end
|
72
75
|
print_statuses(statuses)
|
73
76
|
end
|
74
77
|
map %w(faves) => :favorites
|
@@ -77,13 +80,16 @@ module T
|
|
77
80
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
78
81
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
79
82
|
def mentions(query)
|
80
|
-
|
83
|
+
opts = {:count => MAX_NUM_RESULTS}
|
84
|
+
statuses = collect_with_max_id do |max_id|
|
85
|
+
opts[:max_id] = max_id unless max_id.nil?
|
81
86
|
retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
|
82
|
-
client.mentions(
|
83
|
-
/#{query}/i.match(status.text)
|
84
|
-
end
|
87
|
+
client.mentions(opts)
|
85
88
|
end
|
86
89
|
end.flatten.compact
|
90
|
+
statuses = statuses.select do |status|
|
91
|
+
/#{query}/i.match(status.text)
|
92
|
+
end
|
87
93
|
print_statuses(statuses)
|
88
94
|
end
|
89
95
|
map %w(replies) => :mentions
|
@@ -92,13 +98,16 @@ module T
|
|
92
98
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
93
99
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
94
100
|
def retweets(query)
|
95
|
-
|
101
|
+
opts = {:count => MAX_NUM_RESULTS}
|
102
|
+
statuses = collect_with_max_id do |max_id|
|
103
|
+
opts[:max_id] = max_id unless max_id.nil?
|
96
104
|
retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
|
97
|
-
client.retweeted_by(
|
98
|
-
/#{query}/i.match(status.text)
|
99
|
-
end
|
105
|
+
client.retweeted_by(opts)
|
100
106
|
end
|
101
107
|
end.flatten.compact
|
108
|
+
statuses = statuses.select do |status|
|
109
|
+
/#{query}/i.match(status.text)
|
110
|
+
end
|
102
111
|
print_statuses(statuses)
|
103
112
|
end
|
104
113
|
map %w(rts) => :retweets
|
@@ -107,13 +116,16 @@ module T
|
|
107
116
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
108
117
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
109
118
|
def timeline(query)
|
110
|
-
|
119
|
+
opts = {:count => MAX_NUM_RESULTS}
|
120
|
+
statuses = collect_with_max_id do |max_id|
|
121
|
+
opts[:max_id] = max_id unless max_id.nil?
|
111
122
|
retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
|
112
|
-
client.home_timeline(
|
113
|
-
/#{query}/i.match(status.text)
|
114
|
-
end
|
123
|
+
client.home_timeline(opts)
|
115
124
|
end
|
116
125
|
end.flatten.compact
|
126
|
+
statuses = statuses.select do |status|
|
127
|
+
/#{query}/i.match(status.text)
|
128
|
+
end
|
117
129
|
print_statuses(statuses)
|
118
130
|
end
|
119
131
|
map %w(tl) => :timeline
|
@@ -128,13 +140,16 @@ module T
|
|
128
140
|
else
|
129
141
|
user.strip_ats
|
130
142
|
end
|
131
|
-
|
143
|
+
opts = {:count => MAX_NUM_RESULTS}
|
144
|
+
statuses = collect_with_max_id do |max_id|
|
145
|
+
opts[:max_id] = max_id unless max_id.nil?
|
132
146
|
retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
|
133
|
-
client.user_timeline(user,
|
134
|
-
/#{query}/i.match(status.text)
|
135
|
-
end
|
147
|
+
client.user_timeline(user, opts)
|
136
148
|
end
|
137
149
|
end.flatten.compact
|
150
|
+
statuses = statuses.select do |status|
|
151
|
+
/#{query}/i.match(status.text)
|
152
|
+
end
|
138
153
|
print_statuses(statuses)
|
139
154
|
end
|
140
155
|
|
data/lib/t/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
data/spec/search_spec.rb
CHANGED
@@ -126,19 +126,21 @@ ID Posted at Screen name Text
|
|
126
126
|
|
127
127
|
describe "#favorites" do
|
128
128
|
before do
|
129
|
-
1.
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
stub_get("/1/favorites.json").
|
130
|
+
with(:query => {:count => "200"}).
|
131
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
132
|
+
stub_get("/1/favorites.json").
|
133
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
134
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
134
135
|
end
|
135
136
|
it "should request the correct resource" do
|
136
137
|
@search.favorites("twitter")
|
137
|
-
1.
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
138
|
+
a_get("/1/favorites.json").
|
139
|
+
with(:query => {:count => "200"}).
|
140
|
+
should have_been_made
|
141
|
+
a_get("/1/favorites.json").
|
142
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
143
|
+
should have_been_made
|
142
144
|
end
|
143
145
|
it "should have the correct output" do
|
144
146
|
@search.favorites("twitter")
|
@@ -155,21 +157,6 @@ ID Posted at Screen name Text
|
|
155
157
|
@search.favorites("twitter")
|
156
158
|
$stdout.string.should == <<-eos
|
157
159
|
ID,Posted at,Screen name,Text
|
158
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
159
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
160
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
161
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
162
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
163
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
164
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
165
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
166
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
167
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
168
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
169
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
170
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
171
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
172
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
173
160
|
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
174
161
|
eos
|
175
162
|
end
|
@@ -182,21 +169,6 @@ ID,Posted at,Screen name,Text
|
|
182
169
|
@search.favorites("twitter")
|
183
170
|
$stdout.string.should == <<-eos
|
184
171
|
ID Posted at Screen name Text
|
185
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
186
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
187
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
188
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
189
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
190
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
191
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
192
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
193
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
194
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
195
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
196
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
197
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
198
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
199
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
200
172
|
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
201
173
|
eos
|
202
174
|
end
|
@@ -204,13 +176,13 @@ ID Posted at Screen name Text
|
|
204
176
|
context "Twitter is down" do
|
205
177
|
it "should retry 3 times and then raise an error" do
|
206
178
|
stub_get("/1/favorites.json").
|
207
|
-
with(:query => {:count => "200"
|
179
|
+
with(:query => {:count => "200"}).
|
208
180
|
to_return(:status => 502)
|
209
181
|
lambda do
|
210
182
|
@search.favorites("twitter")
|
211
183
|
end.should raise_error("Twitter is down or being upgraded.")
|
212
184
|
a_get("/1/favorites.json").
|
213
|
-
with(:query => {:count => "200"
|
185
|
+
with(:query => {:count => "200"}).
|
214
186
|
should have_been_made.times(3)
|
215
187
|
end
|
216
188
|
end
|
@@ -218,19 +190,21 @@ ID Posted at Screen name Text
|
|
218
190
|
|
219
191
|
describe "#mentions" do
|
220
192
|
before do
|
221
|
-
1.
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
193
|
+
stub_get("/1/statuses/mentions.json").
|
194
|
+
with(:query => {:count => "200"}).
|
195
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
196
|
+
stub_get("/1/statuses/mentions.json").
|
197
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
198
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
226
199
|
end
|
227
200
|
it "should request the correct resource" do
|
228
201
|
@search.mentions("twitter")
|
229
|
-
1.
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
202
|
+
a_get("/1/statuses/mentions.json").
|
203
|
+
with(:query => {:count => "200"}).
|
204
|
+
should have_been_made
|
205
|
+
a_get("/1/statuses/mentions.json").
|
206
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
207
|
+
should have_been_made
|
234
208
|
end
|
235
209
|
it "should have the correct output" do
|
236
210
|
@search.mentions("twitter")
|
@@ -247,21 +221,6 @@ ID Posted at Screen name Text
|
|
247
221
|
@search.mentions("twitter")
|
248
222
|
$stdout.string.should == <<-eos
|
249
223
|
ID,Posted at,Screen name,Text
|
250
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
251
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
252
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
253
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
254
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
255
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
256
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
257
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
258
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
259
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
260
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
261
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
262
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
263
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
264
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
265
224
|
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
266
225
|
eos
|
267
226
|
end
|
@@ -274,21 +233,6 @@ ID,Posted at,Screen name,Text
|
|
274
233
|
@search.mentions("twitter")
|
275
234
|
$stdout.string.should == <<-eos
|
276
235
|
ID Posted at Screen name Text
|
277
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
278
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
279
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
280
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
281
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
282
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
283
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
284
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
285
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
286
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
287
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
288
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
289
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
290
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
291
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
292
236
|
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
293
237
|
eos
|
294
238
|
end
|
@@ -296,13 +240,13 @@ ID Posted at Screen name Text
|
|
296
240
|
context "Twitter is down" do
|
297
241
|
it "should retry 3 times and then raise an error" do
|
298
242
|
stub_get("/1/statuses/mentions.json").
|
299
|
-
with(:query => {:count => "200"
|
243
|
+
with(:query => {:count => "200"}).
|
300
244
|
to_return(:status => 502)
|
301
245
|
lambda do
|
302
246
|
@search.mentions("twitter")
|
303
247
|
end.should raise_error("Twitter is down or being upgraded.")
|
304
248
|
a_get("/1/statuses/mentions.json").
|
305
|
-
with(:query => {:count => "200"
|
249
|
+
with(:query => {:count => "200"}).
|
306
250
|
should have_been_made.times(3)
|
307
251
|
end
|
308
252
|
end
|
@@ -310,19 +254,21 @@ ID Posted at Screen name Text
|
|
310
254
|
|
311
255
|
describe "#retweets" do
|
312
256
|
before do
|
313
|
-
1.
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
257
|
+
stub_get("/1/statuses/retweeted_by_me.json").
|
258
|
+
with(:query => {:count => "200"}).
|
259
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
260
|
+
stub_get("/1/statuses/retweeted_by_me.json").
|
261
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
262
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
318
263
|
end
|
319
264
|
it "should request the correct resource" do
|
320
265
|
@search.retweets("twitter")
|
321
|
-
1.
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
266
|
+
a_get("/1/statuses/retweeted_by_me.json").
|
267
|
+
with(:query => {:count => "200"}).
|
268
|
+
should have_been_made
|
269
|
+
a_get("/1/statuses/retweeted_by_me.json").
|
270
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
271
|
+
should have_been_made
|
326
272
|
end
|
327
273
|
it "should have the correct output" do
|
328
274
|
@search.retweets("twitter")
|
@@ -339,21 +285,6 @@ ID Posted at Screen name Text
|
|
339
285
|
@search.retweets("twitter")
|
340
286
|
$stdout.string.should == <<-eos
|
341
287
|
ID,Posted at,Screen name,Text
|
342
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
343
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
344
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
345
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
346
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
347
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
348
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
349
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
350
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
351
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
352
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
353
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
354
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
355
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
356
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
357
288
|
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
358
289
|
eos
|
359
290
|
end
|
@@ -366,21 +297,6 @@ ID,Posted at,Screen name,Text
|
|
366
297
|
@search.retweets("twitter")
|
367
298
|
$stdout.string.should == <<-eos
|
368
299
|
ID Posted at Screen name Text
|
369
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
370
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
371
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
372
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
373
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
374
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
375
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
376
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
377
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
378
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
379
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
380
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
381
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
382
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
383
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
384
300
|
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
385
301
|
eos
|
386
302
|
end
|
@@ -388,13 +304,13 @@ ID Posted at Screen name Text
|
|
388
304
|
context "Twitter is down" do
|
389
305
|
it "should retry 3 times and then raise an error" do
|
390
306
|
stub_get("/1/statuses/retweeted_by_me.json").
|
391
|
-
with(:query => {:count => "200"
|
307
|
+
with(:query => {:count => "200"}).
|
392
308
|
to_return(:status => 502)
|
393
309
|
lambda do
|
394
310
|
@search.retweets("twitter")
|
395
311
|
end.should raise_error("Twitter is down or being upgraded.")
|
396
312
|
a_get("/1/statuses/retweeted_by_me.json").
|
397
|
-
with(:query => {:count => "200"
|
313
|
+
with(:query => {:count => "200"}).
|
398
314
|
should have_been_made.times(3)
|
399
315
|
end
|
400
316
|
end
|
@@ -402,19 +318,21 @@ ID Posted at Screen name Text
|
|
402
318
|
|
403
319
|
describe "#timeline" do
|
404
320
|
before do
|
405
|
-
1.
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
321
|
+
stub_get("/1/statuses/home_timeline.json").
|
322
|
+
with(:query => {:count => "200"}).
|
323
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
324
|
+
stub_get("/1/statuses/home_timeline.json").
|
325
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
326
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
410
327
|
end
|
411
328
|
it "should request the correct resource" do
|
412
329
|
@search.timeline("twitter")
|
413
|
-
1.
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
330
|
+
a_get("/1/statuses/home_timeline.json").
|
331
|
+
with(:query => {:count => "200"}).
|
332
|
+
should have_been_made
|
333
|
+
a_get("/1/statuses/home_timeline.json").
|
334
|
+
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
335
|
+
should have_been_made
|
418
336
|
end
|
419
337
|
it "should have the correct output" do
|
420
338
|
@search.timeline("twitter")
|
@@ -431,21 +349,6 @@ ID Posted at Screen name Text
|
|
431
349
|
@search.timeline("twitter")
|
432
350
|
$stdout.string.should == <<-eos
|
433
351
|
ID,Posted at,Screen name,Text
|
434
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
435
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
436
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
437
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
438
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
439
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
440
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
441
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
442
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
443
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
444
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
445
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
446
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
447
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
448
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
449
352
|
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
450
353
|
eos
|
451
354
|
end
|
@@ -458,21 +361,6 @@ ID,Posted at,Screen name,Text
|
|
458
361
|
@search.timeline("twitter")
|
459
362
|
$stdout.string.should == <<-eos
|
460
363
|
ID Posted at Screen name Text
|
461
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
462
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
463
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
464
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
465
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
466
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
467
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
468
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
469
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
470
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
471
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
472
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
473
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
474
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
475
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
476
364
|
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
477
365
|
eos
|
478
366
|
end
|
@@ -480,13 +368,13 @@ ID Posted at Screen name Text
|
|
480
368
|
context "Twitter is down" do
|
481
369
|
it "should retry 3 times and then raise an error" do
|
482
370
|
stub_get("/1/statuses/home_timeline.json").
|
483
|
-
with(:query => {:count => "200"
|
371
|
+
with(:query => {:count => "200"}).
|
484
372
|
to_return(:status => 502)
|
485
373
|
lambda do
|
486
374
|
@search.timeline("twitter")
|
487
375
|
end.should raise_error("Twitter is down or being upgraded.")
|
488
376
|
a_get("/1/statuses/home_timeline.json").
|
489
|
-
with(:query => {:count => "200"
|
377
|
+
with(:query => {:count => "200"}).
|
490
378
|
should have_been_made.times(3)
|
491
379
|
end
|
492
380
|
end
|
@@ -494,19 +382,21 @@ ID Posted at Screen name Text
|
|
494
382
|
|
495
383
|
describe "#user" do
|
496
384
|
before do
|
497
|
-
1.
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
385
|
+
stub_get("/1/statuses/user_timeline.json").
|
386
|
+
with(:query => {:count => "200", :screen_name => "sferik"}).
|
387
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
388
|
+
stub_get("/1/statuses/user_timeline.json").
|
389
|
+
with(:query => {:count => "200", :max_id => "194546264212385792", :screen_name => "sferik"}).
|
390
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
502
391
|
end
|
503
392
|
it "should request the correct resource" do
|
504
393
|
@search.user("sferik", "twitter")
|
505
|
-
1.
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
394
|
+
a_get("/1/statuses/user_timeline.json").
|
395
|
+
with(:query => {:count => "200", :screen_name => "sferik"}).
|
396
|
+
should have_been_made
|
397
|
+
a_get("/1/statuses/user_timeline.json").
|
398
|
+
with(:query => {:count => "200", :max_id => "194546264212385792", :screen_name => "sferik"}).
|
399
|
+
should have_been_made
|
510
400
|
end
|
511
401
|
it "should have the correct output" do
|
512
402
|
@search.user("sferik", "twitter")
|
@@ -523,21 +413,6 @@ ID Posted at Screen name Text
|
|
523
413
|
@search.user("sferik", "twitter")
|
524
414
|
$stdout.string.should == <<-eos
|
525
415
|
ID,Posted at,Screen name,Text
|
526
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
527
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
528
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
529
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
530
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
531
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
532
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
533
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
534
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
535
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
536
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
537
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
538
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
539
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
540
|
-
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
541
416
|
194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
|
542
417
|
eos
|
543
418
|
end
|
@@ -545,19 +420,21 @@ ID,Posted at,Screen name,Text
|
|
545
420
|
context "--id" do
|
546
421
|
before do
|
547
422
|
@search.options = @search.options.merge("id" => true)
|
548
|
-
1.
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
423
|
+
stub_get("/1/statuses/user_timeline.json").
|
424
|
+
with(:query => {:count => "200", :user_id => "7505382"}).
|
425
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
426
|
+
stub_get("/1/statuses/user_timeline.json").
|
427
|
+
with(:query => {:count => "200", :max_id => "194546264212385792", :user_id => "7505382"}).
|
428
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
553
429
|
end
|
554
430
|
it "should request the correct resource" do
|
555
431
|
@search.user("7505382", "twitter")
|
556
|
-
1.
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
432
|
+
a_get("/1/statuses/user_timeline.json").
|
433
|
+
with(:query => {:count => "200", :user_id => "7505382"}).
|
434
|
+
should have_been_made
|
435
|
+
a_get("/1/statuses/user_timeline.json").
|
436
|
+
with(:query => {:count => "200", :max_id => "194546264212385792", :user_id => "7505382"}).
|
437
|
+
should have_been_made
|
561
438
|
end
|
562
439
|
end
|
563
440
|
context "--long" do
|
@@ -568,21 +445,6 @@ ID,Posted at,Screen name,Text
|
|
568
445
|
@search.user("sferik", "twitter")
|
569
446
|
$stdout.string.should == <<-eos
|
570
447
|
ID Posted at Screen name Text
|
571
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
572
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
573
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
574
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
575
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
576
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
577
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
578
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
579
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
580
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
581
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
582
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
583
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
584
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
585
|
-
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
586
448
|
194546727670390784 Apr 23 2011 @bartt @noahlt @gaarf Yup, now owning...
|
587
449
|
eos
|
588
450
|
end
|
@@ -590,13 +452,13 @@ ID Posted at Screen name Text
|
|
590
452
|
context "Twitter is down" do
|
591
453
|
it "should retry 3 times and then raise an error" do
|
592
454
|
stub_get("/1/statuses/user_timeline.json").
|
593
|
-
with(:query => {:screen_name => "sferik", :count => "200"
|
455
|
+
with(:query => {:screen_name => "sferik", :count => "200"}).
|
594
456
|
to_return(:status => 502)
|
595
457
|
lambda do
|
596
458
|
@search.user("sferik", "twitter")
|
597
459
|
end.should raise_error("Twitter is down or being upgraded.")
|
598
460
|
a_get("/1/statuses/user_timeline.json").
|
599
|
-
with(:query => {:screen_name => "sferik", :count => "200"
|
461
|
+
with(:query => {:screen_name => "sferik", :count => "200"}).
|
600
462
|
should have_been_made.times(3)
|
601
463
|
end
|
602
464
|
end
|