t 0.6.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/delete_spec.rb CHANGED
@@ -35,63 +35,72 @@ describe T::Delete do
35
35
  @delete.block("sferik")
36
36
  $stdout.string.should =~ /^@testcli unblocked 1 user\.$/
37
37
  end
38
+ context "--id" do
39
+ before do
40
+ @delete.options = @delete.options.merge(:id => true)
41
+ stub_delete("/1/blocks/destroy.json").
42
+ with(:query => {:user_id => "7505382", :include_entities => "false"}).
43
+ to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
44
+ end
45
+ it "should request the correct resource" do
46
+ @delete.block("7505382")
47
+ a_delete("/1/blocks/destroy.json").
48
+ with(:query => {:user_id => "7505382", :include_entities => "false"}).
49
+ should have_been_made
50
+ end
51
+ end
38
52
  end
39
53
 
40
54
  describe "#dm" do
41
55
  before do
42
56
  @delete.options = @delete.options.merge(:profile => fixture_path + "/.trc")
57
+ stub_get("/1/direct_messages/show/1773478249.json").
58
+ with(:query => {:include_entities => "false"}).
59
+ to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
43
60
  stub_delete("/1/direct_messages/destroy/1773478249.json").
44
61
  with(:query => {:include_entities => "false"}).
45
62
  to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
46
63
  end
47
- context ":force => true" do
48
- before do
49
- @delete.options = @delete.options.merge(:force => true)
50
- end
51
- it "should request the correct resource" do
64
+ it "should request the correct resource" do
65
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
66
+ $stdin.should_receive(:gets).and_return("yes")
67
+ @delete.dm("1773478249")
68
+ a_get("/1/direct_messages/show/1773478249.json").
69
+ with(:query => {:include_entities => "false"}).
70
+ should have_been_made
71
+ a_delete("/1/direct_messages/destroy/1773478249.json").
72
+ with(:query => {:include_entities => "false"}).
73
+ should have_been_made
74
+ end
75
+ context "yes" do
76
+ it "should have the correct output" do
77
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
78
+ $stdin.should_receive(:gets).and_return("yes")
52
79
  @delete.dm("1773478249")
53
- a_delete("/1/direct_messages/destroy/1773478249.json").
54
- with(:query => {:include_entities => "false"}).
55
- should have_been_made
80
+ $stdout.string.chomp.should == "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
56
81
  end
82
+ end
83
+ context "no" do
57
84
  it "should have the correct output" do
85
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
86
+ $stdin.should_receive(:gets).and_return("no")
58
87
  @delete.dm("1773478249")
59
- $stdout.string.chomp.should == "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
88
+ $stdout.string.chomp.should be_empty
60
89
  end
61
90
  end
62
- context ":force => false" do
91
+ context "--force" do
63
92
  before do
64
- @delete.options = @delete.options.merge(:force => false)
65
- stub_get("/1/direct_messages/show/1773478249.json").
66
- with(:query => {:include_entities => "false"}).
67
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
93
+ @delete.options = @delete.options.merge(:force => true)
68
94
  end
69
95
  it "should request the correct resource" do
70
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
71
- $stdin.should_receive(:gets).and_return("yes")
72
96
  @delete.dm("1773478249")
73
- a_get("/1/direct_messages/show/1773478249.json").
74
- with(:query => {:include_entities => "false"}).
75
- should have_been_made
76
97
  a_delete("/1/direct_messages/destroy/1773478249.json").
77
98
  with(:query => {:include_entities => "false"}).
78
99
  should have_been_made
79
100
  end
80
- context "yes" do
81
- it "should have the correct output" do
82
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
83
- $stdin.should_receive(:gets).and_return("yes")
84
- @delete.dm("1773478249")
85
- $stdout.string.chomp.should == "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
86
- end
87
- end
88
- context "no" do
89
- it "should have the correct output" do
90
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
91
- $stdin.should_receive(:gets).and_return("no")
92
- @delete.dm("1773478249")
93
- $stdout.string.chomp.should be_empty
94
- end
101
+ it "should have the correct output" do
102
+ @delete.dm("1773478249")
103
+ $stdout.string.chomp.should == "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
95
104
  end
96
105
  end
97
106
  end
@@ -99,58 +108,53 @@ describe T::Delete do
99
108
  describe "#favorite" do
100
109
  before do
101
110
  @delete.options = @delete.options.merge(:profile => fixture_path + "/.trc")
111
+ stub_get("/1/statuses/show/28439861609.json").
112
+ with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
113
+ to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
102
114
  stub_delete("/1/favorites/destroy/28439861609.json").
103
115
  with(:query => {:include_entities => "false"}).
104
116
  to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
105
117
  end
106
- context ":force => true" do
107
- before do
108
- @delete.options = @delete.options.merge(:force => true)
109
- end
110
- it "should request the correct resource" do
118
+ it "should request the correct resource" do
119
+ $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
120
+ $stdin.should_receive(:gets).and_return("yes")
121
+ @delete.favorite("28439861609")
122
+ a_get("/1/statuses/show/28439861609.json").
123
+ with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
124
+ should have_been_made
125
+ a_delete("/1/favorites/destroy/28439861609.json").
126
+ with(:query => {:include_entities => "false"}).
127
+ should have_been_made
128
+ end
129
+ context "yes" do
130
+ it "should have the correct output" do
131
+ $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
132
+ $stdin.should_receive(:gets).and_return("yes")
111
133
  @delete.favorite("28439861609")
112
- a_delete("/1/favorites/destroy/28439861609.json").
113
- with(:query => {:include_entities => "false"}).
114
- should have_been_made
134
+ $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
115
135
  end
136
+ end
137
+ context "no" do
116
138
  it "should have the correct output" do
139
+ $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
140
+ $stdin.should_receive(:gets).and_return("no")
117
141
  @delete.favorite("28439861609")
118
- $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
142
+ $stdout.string.chomp.should be_empty
119
143
  end
120
144
  end
121
- context ":force => false" do
145
+ context "--force" do
122
146
  before do
123
- @delete.options = @delete.options.merge(:force => false)
124
- stub_get("/1/statuses/show/28439861609.json").
125
- with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
126
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
147
+ @delete.options = @delete.options.merge(:force => true)
127
148
  end
128
149
  it "should request the correct resource" do
129
- $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
130
- $stdin.should_receive(:gets).and_return("yes")
131
150
  @delete.favorite("28439861609")
132
- a_get("/1/statuses/show/28439861609.json").
133
- with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
134
- should have_been_made
135
151
  a_delete("/1/favorites/destroy/28439861609.json").
136
152
  with(:query => {:include_entities => "false"}).
137
153
  should have_been_made
138
154
  end
139
- context "yes" do
140
- it "should have the correct output" do
141
- $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
142
- $stdin.should_receive(:gets).and_return("yes")
143
- @delete.favorite("28439861609")
144
- $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
145
- end
146
- end
147
- context "no" do
148
- it "should have the correct output" do
149
- $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
150
- $stdin.should_receive(:gets).and_return("no")
151
- @delete.favorite("28439861609")
152
- $stdout.string.chomp.should be_empty
153
- end
155
+ it "should have the correct output" do
156
+ @delete.favorite("28439861609")
157
+ $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
154
158
  end
155
159
  end
156
160
  end
@@ -160,11 +164,40 @@ describe T::Delete do
160
164
  @delete.options = @delete.options.merge(:profile => fixture_path + "/.trc")
161
165
  stub_get("/1/account/verify_credentials.json").
162
166
  to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
167
+ stub_get("/1/lists/show.json").
168
+ with(:query => {:owner_screen_name => "sferik", :slug => 'presidents'}).
169
+ to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
163
170
  stub_delete("/1/lists/destroy.json").
164
- with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).
171
+ with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
165
172
  to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
166
173
  end
167
- context ":force => true" do
174
+ it "should request the correct resource" do
175
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
176
+ $stdin.should_receive(:gets).and_return("yes")
177
+ @delete.list("presidents")
178
+ a_get("/1/account/verify_credentials.json").
179
+ should have_been_made
180
+ a_delete("/1/lists/destroy.json").
181
+ with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
182
+ should have_been_made
183
+ end
184
+ context "yes" do
185
+ it "should have the correct output" do
186
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
187
+ $stdin.should_receive(:gets).and_return("yes")
188
+ @delete.list("presidents")
189
+ $stdout.string.chomp.should == "@testcli deleted the list \"presidents\"."
190
+ end
191
+ end
192
+ context "no" do
193
+ it "should have the correct output" do
194
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
195
+ $stdin.should_receive(:gets).and_return("no")
196
+ @delete.list("presidents")
197
+ $stdout.string.chomp.should be_empty
198
+ end
199
+ end
200
+ context "--force" do
168
201
  before do
169
202
  @delete.options = @delete.options.merge(:force => true)
170
203
  end
@@ -173,7 +206,7 @@ describe T::Delete do
173
206
  a_get("/1/account/verify_credentials.json").
174
207
  should have_been_made
175
208
  a_delete("/1/lists/destroy.json").
176
- with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).
209
+ with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
177
210
  should have_been_made
178
211
  end
179
212
  it "should have the correct output" do
@@ -181,94 +214,79 @@ describe T::Delete do
181
214
  $stdout.string.chomp.should == "@testcli deleted the list \"presidents\"."
182
215
  end
183
216
  end
184
- context ":force => false" do
217
+ context "--id" do
185
218
  before do
186
- @delete.options = @delete.options.merge(:force => false)
219
+ @delete.options = @delete.options.merge(:id => true)
220
+ stub_get("/1/lists/show.json").
221
+ with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
222
+ to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
187
223
  end
188
224
  it "should request the correct resource" do
189
225
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
190
226
  $stdin.should_receive(:gets).and_return("yes")
191
- @delete.list("presidents")
227
+ @delete.list("8863586")
228
+ a_get("/1/lists/show.json").
229
+ with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
230
+ should have_been_made
192
231
  a_get("/1/account/verify_credentials.json").
193
232
  should have_been_made
194
233
  a_delete("/1/lists/destroy.json").
195
- with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).
234
+ with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
196
235
  should have_been_made
197
236
  end
198
- context "yes" do
199
- it "should have the correct output" do
200
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
201
- $stdin.should_receive(:gets).and_return("yes")
202
- @delete.list("presidents")
203
- $stdout.string.chomp.should == "@testcli deleted the list \"presidents\"."
204
- end
205
- end
206
- context "no" do
207
- it "should have the correct output" do
208
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
209
- $stdin.should_receive(:gets).and_return("no")
210
- @delete.list("presidents")
211
- $stdout.string.chomp.should be_empty
212
- end
213
- end
214
237
  end
215
238
  end
216
239
 
217
240
  describe "#status" do
218
241
  before do
219
242
  @delete.options = @delete.options.merge(:profile => fixture_path + "/.trc")
243
+ stub_get("/1/statuses/show/26755176471724032.json").
244
+ with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
245
+ to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
220
246
  stub_delete("/1/statuses/destroy/26755176471724032.json").
221
247
  with(:query => {:include_entities => "false", :trim_user => "true"}).
222
248
  to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
223
249
  end
224
- context ":force => true" do
225
- before do
226
- @delete.options = @delete.options.merge(:force => true)
227
- end
228
- it "should request the correct resource" do
250
+ it "should request the correct resource" do
251
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
252
+ $stdin.should_receive(:gets).and_return("yes")
253
+ @delete.status("26755176471724032")
254
+ a_get("/1/statuses/show/26755176471724032.json").
255
+ with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
256
+ should have_been_made
257
+ a_delete("/1/statuses/destroy/26755176471724032.json").
258
+ with(:query => {:include_entities => "false", :trim_user => "true"}).
259
+ should have_been_made
260
+ end
261
+ context "yes" do
262
+ it "should have the correct output" do
263
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
264
+ $stdin.should_receive(:gets).and_return("yes")
229
265
  @delete.status("26755176471724032")
230
- a_delete("/1/statuses/destroy/26755176471724032.json").
231
- with(:query => {:include_entities => "false", :trim_user => "true"}).
232
- should have_been_made
266
+ $stdout.string.chomp.should == "@testcli deleted the status: \"The problem with your code is that it's doing exactly what you told it to do.\""
233
267
  end
268
+ end
269
+ context "no" do
234
270
  it "should have the correct output" do
271
+ $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
272
+ $stdin.should_receive(:gets).and_return("no")
235
273
  @delete.status("26755176471724032")
236
- $stdout.string.chomp.should == "@testcli deleted the status: \"The problem with your code is that it's doing exactly what you told it to do.\""
274
+ $stdout.string.chomp.should be_empty
237
275
  end
238
276
  end
239
- context ":force => false" do
277
+ context "--force" do
240
278
  before do
241
- @delete.options = @delete.options.merge(:force => false)
242
- stub_get("/1/statuses/show/26755176471724032.json").
243
- with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
244
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
279
+ @delete.options = @delete.options.merge(:force => true)
245
280
  end
246
281
  it "should request the correct resource" do
247
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
248
- $stdin.should_receive(:gets).and_return("yes")
249
282
  @delete.status("26755176471724032")
250
- a_get("/1/statuses/show/26755176471724032.json").
251
- with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
252
- should have_been_made
253
283
  a_delete("/1/statuses/destroy/26755176471724032.json").
254
284
  with(:query => {:include_entities => "false", :trim_user => "true"}).
255
285
  should have_been_made
256
286
  end
257
- context "yes" do
258
- it "should have the correct output" do
259
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
260
- $stdin.should_receive(:gets).and_return("yes")
261
- @delete.status("26755176471724032")
262
- $stdout.string.chomp.should == "@testcli deleted the status: \"The problem with your code is that it's doing exactly what you told it to do.\""
263
- end
264
- end
265
- context "no" do
266
- it "should have the correct output" do
267
- $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
268
- $stdin.should_receive(:gets).and_return("no")
269
- @delete.status("26755176471724032")
270
- $stdout.string.chomp.should be_empty
271
- end
287
+ it "should have the correct output" do
288
+ @delete.status("26755176471724032")
289
+ $stdout.string.chomp.should == "@testcli deleted the status: \"The problem with your code is that it's doing exactly what you told it to do.\""
272
290
  end
273
291
  end
274
292
  end
@@ -0,0 +1 @@
1
+ false
@@ -1 +1 @@
1
- {"mode":"public","description":"Presidents of the United States of America","id_str":"8863586","member_count":2,"uri":"\/sferik\/presidents","subscriber_count":0,"full_name":"@sferik\/presidents","user":{"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","profile_link_color":"0084B4","description":"Adventures in hunger and foolishness.","screen_name":"sferik","verified":false,"id_str":"7505382","follow_request_sent":false,"profile_background_tile":false,"profile_sidebar_fill_color":"DDEEF6","favourites_count":742,"profile_sidebar_border_color":"C0DEED","followers_count":911,"url":null,"listed_count":29,"lang":"en","time_zone":"Pacific Time (US & Canada)","created_at":"Mon Jul 16 12:59:01 +0000 2007","location":"San Francisco","statuses_count":3018,"profile_background_color":"000000","protected":false,"show_all_inline_media":true,"friends_count":86,"name":"Erik Michaels-Ober","contributors_enabled":false,"following":false,"profile_use_background_image":true,"profile_text_color":"333333","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/323331048\/me_normal.jpg","id":7505382,"geo_enabled":true,"notifications":false,"utc_offset":-28800},"name":"presidents","following":false,"slug":"presidents","id":8863586}
1
+ {"name":"presidents","full_name":"@sferik\/presidents","member_count":2,"description":"Presidents of the United States of America","mode":"public","uri":"\/sferik\/presidents","user":{"id":7505382,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","url":"https:\/\/github.com\/sferik","created_at":"Mon Jul 16 12:59:01 +0000 2007","followers_count":2126,"default_profile":false,"profile_background_color":"000000","lang":"en","utc_offset":-28800,"name":"Erik Michaels-Ober","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","location":"San Francisco","profile_link_color":"0084B4","listed_count":115,"verified":false,"protected":false,"profile_use_background_image":true,"is_translator":false,"following":null,"description":"My heart is in the work.","profile_text_color":"333333","statuses_count":6951,"screen_name":"sferik","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","time_zone":"Pacific Time (US & Canada)","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","friends_count":204,"default_profile_image":false,"contributors_enabled":false,"profile_sidebar_border_color":"C0DEED","id_str":"7505382","geo_enabled":true,"favourites_count":3124,"profile_background_tile":false,"notifications":null,"show_all_inline_media":true,"profile_sidebar_fill_color":"DDEEF6","follow_request_sent":null},"id_str":"8863586","subscriber_count":1,"created_at":"Mon Mar 15 12:10:13 +0000 2010","following":false,"slug":"presidents","id":8863586}
@@ -0,0 +1 @@
1
+ {"lists":[{"slug":"code-for-america","name":"code for america","full_name":"@sferik\/code-for-america","description":"Code for America","mode":"public","uri":"\/sferik\/code-for-america","user":{"id":7505382,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","url":"https:\/\/github.com\/sferik","created_at":"Mon Jul 16 12:59:01 +0000 2007","followers_count":2126,"default_profile":false,"profile_background_color":"000000","lang":"en","utc_offset":-28800,"name":"Erik Michaels-Ober","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","location":"San Francisco","profile_link_color":"0084B4","listed_count":115,"verified":false,"protected":false,"profile_use_background_image":true,"is_translator":false,"following":false,"description":"My heart is in the work.","profile_text_color":"333333","statuses_count":6953,"screen_name":"sferik","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","time_zone":"Pacific Time (US & Canada)","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","friends_count":204,"default_profile_image":false,"contributors_enabled":false,"profile_sidebar_border_color":"C0DEED","id_str":"7505382","geo_enabled":true,"favourites_count":3128,"profile_background_tile":false,"notifications":false,"show_all_inline_media":true,"profile_sidebar_fill_color":"DDEEF6","follow_request_sent":false},"member_count":26,"id_str":"21718825","created_at":"Tue Sep 14 21:46:56 +0000 2010","subscriber_count":5,"following":false,"id":21718825},{"slug":"presidents","name":"presidents","full_name":"@sferik\/presidents","description":"Presidents of the United States of America","mode":"public","uri":"\/sferik\/presidents","user":{"id":7505382,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","url":"https:\/\/github.com\/sferik","created_at":"Mon Jul 16 12:59:01 +0000 2007","followers_count":2126,"default_profile":false,"profile_background_color":"000000","lang":"en","utc_offset":-28800,"name":"Erik Michaels-Ober","profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","location":"San Francisco","profile_link_color":"0084B4","listed_count":115,"verified":false,"protected":false,"profile_use_background_image":true,"is_translator":false,"following":false,"description":"My heart is in the work.","profile_text_color":"333333","statuses_count":6953,"screen_name":"sferik","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1759857427\/image1326743606_normal.png","time_zone":"Pacific Time (US & Canada)","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","friends_count":204,"default_profile_image":false,"contributors_enabled":false,"profile_sidebar_border_color":"C0DEED","id_str":"7505382","geo_enabled":true,"favourites_count":3128,"profile_background_tile":false,"notifications":false,"show_all_inline_media":true,"profile_sidebar_fill_color":"DDEEF6","follow_request_sent":false},"member_count":2,"id_str":"8863586","created_at":"Mon Mar 15 12:10:13 +0000 2010","subscriber_count":1,"following":false,"id":8863586}], "next_cursor":0, "previous_cursor":0, "next_cursor_str":"0", "previous_cursor_str":"0"}
@@ -0,0 +1 @@
1
+ [{"placeType":{"code":7,"name":"Town"},"url":"http://where.yahooapis.com/v1/place/2367105","countryCode":"US","woeid":2367105,"name":"Boston","country":"United States"},{"countryCode":null,"url":"http://where.yahooapis.com/v1/place/1","woeid":1,"name":"Worldwide","country":"","placeType":{"code":19,"name":"Supername"}},{"url":"http://where.yahooapis.com/v1/place/2459115","woeid":2459115,"placeType":{"code":7,"name":"Town"},"countryCode":"US","name":"New York","country":"United States"},{"countryCode":"US","url":"http://where.yahooapis.com/v1/place/23424977","country":"United States","woeid":23424977,"name":"United States","placeType":{"code":12,"name":"Country"}},{"placeType":{"code":7,"name":"Town"},"countryCode":"US","url":"http://where.yahooapis.com/v1/place/2487956","woeid":2487956,"name":"San Francisco","country":"United States"}]
@@ -0,0 +1 @@
1
+ {"error":"The specified user is not a member of this list","request":"\/1\/lists\/members\/show.json?owner_screen_name=sferik&slug=presidents&screen_name=sferik"}
@@ -0,0 +1 @@
1
+ [{"as_of":"2010-10-25T14:49:50Z","created_at":"2010-10-25T14:41:13Z","trends":[{"promoted_content":null,"query":"%23sevenwordsaftersex","url":"http:\/\/search.twitter.com\/search?q=%23sevenwordsaftersex","name":"#sevenwordsaftersex","events":null},{"promoted_content":null,"query":"Walkman","url":"http:\/\/search.twitter.com\/search?q=Walkman","name":"Walkman","events":null},{"promoted_content":null,"query":"Allen+Iverson","url":"http:\/\/search.twitter.com\/search?q=Allen+Iverson","name":"Allen Iverson","events":null}],"locations":[{"woeid":1,"name":"Worldwide"}]}]
@@ -0,0 +1 @@
1
+ true
data/spec/helper.rb CHANGED
@@ -42,6 +42,10 @@ def stub_put(path, endpoint=Twitter.endpoint)
42
42
  stub_request(:put, endpoint + path)
43
43
  end
44
44
 
45
+ def project_path
46
+ File.expand_path("../..", __FILE__)
47
+ end
48
+
45
49
  def fixture_path
46
50
  File.expand_path("../fixtures", __FILE__)
47
51
  end
data/spec/list_spec.rb CHANGED
@@ -26,31 +26,47 @@ describe T::List do
26
26
  stub_get("/1/account/verify_credentials.json").
27
27
  to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
28
28
  stub_post("/1/lists/members/create_all.json").
29
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
29
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
30
30
  to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
31
31
  end
32
32
  it "should request the correct resource" do
33
- @list.add("presidents", "sferik")
33
+ @list.add("presidents", "BarackObama")
34
34
  a_get("/1/account/verify_credentials.json").
35
35
  should have_been_made
36
36
  a_post("/1/lists/members/create_all.json").
37
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
37
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
38
38
  should have_been_made
39
39
  end
40
40
  it "should have the correct output" do
41
- @list.add("presidents", "sferik")
41
+ @list.add("presidents", "BarackObama")
42
42
  $stdout.string.should =~ /@testcli added 1 member to the list "presidents"\./
43
43
  end
44
+ context "--id" do
45
+ before do
46
+ @list.options = @list.options.merge(:id => true)
47
+ stub_post("/1/lists/members/create_all.json").
48
+ with(:body => {:user_id => "7505382", :slug => "presidents", :owner_screen_name => "sferik"}).
49
+ to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
50
+ end
51
+ it "should request the correct resource" do
52
+ @list.add("presidents", "7505382")
53
+ a_get("/1/account/verify_credentials.json").
54
+ should have_been_made
55
+ a_post("/1/lists/members/create_all.json").
56
+ with(:body => {:user_id => "7505382", :slug => "presidents", :owner_screen_name => "sferik"}).
57
+ should have_been_made
58
+ end
59
+ end
44
60
  context "Twitter is down" do
45
61
  it "should retry 3 times and then raise an error" do
46
62
  stub_post("/1/lists/members/create_all.json").
47
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
63
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
48
64
  to_return(:status => 502)
49
65
  lambda do
50
- @list.add("presidents", "sferik")
66
+ @list.add("presidents", "BarackObama")
51
67
  end.should raise_error("Twitter is down or being upgraded.")
52
68
  a_post("/1/lists/members/create_all.json").
53
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
69
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
54
70
  should have_been_made.times(3)
55
71
  end
56
72
  end
@@ -75,6 +91,70 @@ describe T::List do
75
91
  end
76
92
  end
77
93
 
94
+ describe "#information" do
95
+ before do
96
+ @list.options = @list.options.merge(:profile => fixture_path + "/.trc")
97
+ stub_get("/1/lists/show.json").
98
+ with(:query => {:owner_screen_name => "testcli", :slug => "presidents"}).
99
+ to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
100
+ end
101
+ it "should request the correct resource" do
102
+ @list.information("presidents")
103
+ a_get("/1/lists/show.json").
104
+ with(:query => {:owner_screen_name => "testcli", :slug => "presidents"}).
105
+ should have_been_made
106
+ end
107
+ it "should have the correct output" do
108
+ @list.information("presidents")
109
+ $stdout.string.should == <<-eos
110
+ ID 8863586
111
+ Description Presidents of the United States of America
112
+ Slug presidents
113
+ Screen name @sferik
114
+ Created at Mar 15 2010
115
+ Members 2
116
+ Subscribers 1
117
+ Status Not following
118
+ Mode public
119
+ URL https://twitter.com/sferik/presidents
120
+ eos
121
+ end
122
+ context "with a user passed" do
123
+ it "should request the correct resource" do
124
+ @list.information("testcli/presidents")
125
+ a_get("/1/lists/show.json").
126
+ with(:query => {:owner_screen_name => "testcli", :slug => "presidents"}).
127
+ should have_been_made
128
+ end
129
+ context "--id" do
130
+ before do
131
+ @list.options = @list.options.merge(:id => true)
132
+ stub_get("/1/lists/show.json").
133
+ with(:query => {:owner_id => "7505382", :slug => "presidents"}).
134
+ to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
135
+ end
136
+ it "should request the correct resource" do
137
+ @list.information("7505382/presidents")
138
+ a_get("/1/lists/show.json").
139
+ with(:query => {:owner_id => "7505382", :slug => "presidents"}).
140
+ should have_been_made
141
+ end
142
+ end
143
+ end
144
+ context "--csv" do
145
+ before do
146
+ @list.options = @list.options.merge(:csv => true)
147
+ end
148
+ it "should have the correct output" do
149
+ @list.information("presidents")
150
+ $stdout.string.should == <<-eos
151
+ ID,Description,Slug,Screen name,Created at,Members,Subscribers,Following,Mode,URL
152
+ 8863586,Presidents of the United States of America,presidents,sferik,2010-03-15 12:10:13 +0000,2,1,false,public,https://twitter.com/sferik/presidents
153
+ eos
154
+ end
155
+ end
156
+ end
157
+
78
158
  describe "#members" do
79
159
  before do
80
160
  stub_get("/1/lists/members.json").
@@ -89,15 +169,19 @@ describe T::List do
89
169
  end
90
170
  it "should have the correct output" do
91
171
  @list.members("presidents")
92
- $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
172
+ $stdout.string.rstrip.should == "@pengwynn @sferik"
93
173
  end
94
- context "--created" do
174
+ context "--csv" do
95
175
  before do
96
- @list.options = @list.options.merge(:created => true)
176
+ @list.options = @list.options.merge(:csv => true)
97
177
  end
98
- it "should sort by the time wshen Twitter account was created" do
178
+ it "should output in CSV format" do
99
179
  @list.members("presidents")
100
- $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
180
+ $stdout.string.should == <<-eos
181
+ ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
182
+ 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
183
+ 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
184
+ eos
101
185
  end
102
186
  end
103
187
  context "--favorites" do
@@ -106,7 +190,7 @@ describe T::List do
106
190
  end
107
191
  it "should sort by number of favorites" do
108
192
  @list.members("presidents")
109
- $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
193
+ $stdout.string.rstrip.should == "@pengwynn @sferik"
110
194
  end
111
195
  end
112
196
  context "--followers" do
@@ -115,7 +199,7 @@ describe T::List do
115
199
  end
116
200
  it "should sort by number of followers" do
117
201
  @list.members("presidents")
118
- $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
202
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
119
203
  end
120
204
  end
121
205
  context "--friends" do
@@ -124,7 +208,7 @@ describe T::List do
124
208
  end
125
209
  it "should sort by number of friends" do
126
210
  @list.members("presidents")
127
- $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
211
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
128
212
  end
129
213
  end
130
214
  context "--listed" do
@@ -133,14 +217,14 @@ describe T::List do
133
217
  end
134
218
  it "should sort by number of list memberships" do
135
219
  @list.members("presidents")
136
- $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
220
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
137
221
  end
138
222
  end
139
223
  context "--long" do
140
224
  before do
141
225
  @list.options = @list.options.merge(:long => true)
142
226
  end
143
- it "should list in long format" do
227
+ it "should output in long format" do
144
228
  @list.members("presidents")
145
229
  $stdout.string.should == <<-eos
146
230
  ID Since Tweets Favorites Listed Following Followers Screen name Name
@@ -149,13 +233,22 @@ ID Since Tweets Favorites Listed Following Followers Screen
149
233
  eos
150
234
  end
151
235
  end
236
+ context "--posted" do
237
+ before do
238
+ @list.options = @list.options.merge(:posted => true)
239
+ end
240
+ it "should sort by the time wshen Twitter account was created" do
241
+ @list.members("presidents")
242
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
243
+ end
244
+ end
152
245
  context "--reverse" do
153
246
  before do
154
247
  @list.options = @list.options.merge(:reverse => true)
155
248
  end
156
249
  it "should reverse the order of the sort" do
157
250
  @list.members("presidents")
158
- $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
251
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
159
252
  end
160
253
  end
161
254
  context "--tweets" do
@@ -164,24 +257,38 @@ ID Since Tweets Favorites Listed Following Followers Screen
164
257
  end
165
258
  it "should sort by number of Tweets" do
166
259
  @list.members("presidents")
167
- $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
260
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
168
261
  end
169
262
  end
170
- context "with a screen name passed" do
263
+ context "--unsorted" do
171
264
  before do
172
- stub_get("/1/lists/members.json").
173
- with(:query => {:cursor => "-1", :include_entities => "false", :owner_screen_name => "sferik", :skip_status => "true", :slug => "presidents"}).
174
- to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
265
+ @list.options = @list.options.merge(:unsorted => true)
266
+ end
267
+ it "should not be sorted" do
268
+ @list.members("presidents")
269
+ $stdout.string.rstrip.should == "@sferik @pengwynn"
175
270
  end
271
+ end
272
+ context "with a user passed" do
176
273
  it "should request the correct resource" do
177
- @list.members("sferik", "presidents")
274
+ @list.members("testcli/presidents")
178
275
  a_get("/1/lists/members.json").
179
- with(:query => {:cursor => "-1", :include_entities => "false", :owner_screen_name => "sferik", :skip_status => "true", :slug => "presidents"}).
276
+ with(:query => {:cursor => "-1", :include_entities => "false", :owner_screen_name => "testcli", :skip_status => "true", :slug => "presidents"}).
180
277
  should have_been_made
181
278
  end
182
- it "should have the correct output" do
183
- @list.members("presidents")
184
- $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
279
+ context "--id" do
280
+ before do
281
+ @list.options = @list.options.merge(:id => true)
282
+ stub_get("/1/lists/members.json").
283
+ with(:query => {:cursor => "-1", :include_entities => "false", :owner_id => "7505382", :skip_status => "true", :slug => "presidents"}).
284
+ to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
285
+ end
286
+ it "should request the correct resource" do
287
+ @list.members("7505382/presidents")
288
+ a_get("/1/lists/members.json").
289
+ with(:query => {:cursor => "-1", :include_entities => "false", :owner_id => "7505382", :skip_status => "true", :slug => "presidents"}).
290
+ should have_been_made
291
+ end
185
292
  end
186
293
  end
187
294
  end
@@ -194,32 +301,48 @@ ID Since Tweets Favorites Listed Following Followers Screen
194
301
  end
195
302
  it "should request the correct resource" do
196
303
  stub_post("/1/lists/members/destroy_all.json").
197
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
304
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
198
305
  to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
199
- @list.remove("presidents", "sferik")
306
+ @list.remove("presidents", "BarackObama")
200
307
  a_get("/1/account/verify_credentials.json").
201
308
  should have_been_made
202
309
  a_post("/1/lists/members/destroy_all.json").
203
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
310
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
204
311
  should have_been_made
205
312
  end
206
313
  it "should have the correct output" do
207
314
  stub_post("/1/lists/members/destroy_all.json").
208
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
315
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
209
316
  to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
210
- @list.remove("presidents", "sferik")
317
+ @list.remove("presidents", "BarackObama")
211
318
  $stdout.string.should =~ /@testcli removed 1 member from the list "presidents"\./
212
319
  end
320
+ context "--id" do
321
+ before do
322
+ @list.options = @list.options.merge(:id => true)
323
+ stub_post("/1/lists/members/destroy_all.json").
324
+ with(:body => {:user_id => "7505382", :slug => "presidents", :owner_screen_name => "sferik"}).
325
+ to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
326
+ end
327
+ it "should request the correct resource" do
328
+ @list.remove("presidents", "7505382")
329
+ a_get("/1/account/verify_credentials.json").
330
+ should have_been_made
331
+ a_post("/1/lists/members/destroy_all.json").
332
+ with(:body => {:user_id => "7505382", :slug => "presidents", :owner_screen_name => "sferik"}).
333
+ should have_been_made
334
+ end
335
+ end
213
336
  context "Twitter is down" do
214
337
  it "should retry 3 times and then raise an error" do
215
338
  stub_post("/1/lists/members/destroy_all.json").
216
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
339
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
217
340
  to_return(:status => 502)
218
341
  lambda do
219
- @list.remove("presidents", "sferik")
342
+ @list.remove("presidents", "BarackObama")
220
343
  end.should raise_error("Twitter is down or being upgraded.")
221
344
  a_post("/1/lists/members/destroy_all.json").
222
- with(:body => {:screen_name => "sferik", :slug => "presidents", :owner_screen_name => "sferik"}).
345
+ with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
223
346
  should have_been_made.times(3)
224
347
  end
225
348
  end
@@ -259,11 +382,39 @@ ID Since Tweets Favorites Listed Following Followers Screen
259
382
  kelseysilver: San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw (7 months ago)
260
383
  eos
261
384
  end
385
+ context "--csv" do
386
+ before do
387
+ @list.options = @list.options.merge(:csv => true)
388
+ end
389
+ it "should output in long format" do
390
+ @list.timeline("presidents")
391
+ $stdout.string.should == <<-eos
392
+ ID,Posted at,Screen name,Text
393
+ 194548121416630272,2011-04-23 22:07:41 +0000,natevillegas,RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present.
394
+ 194547993607806976,2011-04-23 22:07:10 +0000,TD,@kelseysilver how long will you be in town?
395
+ 194547987593183233,2011-04-23 22:07:09 +0000,rusashka,@maciej hahaha :) @gpena together we're going to cover all core 28 languages!
396
+ 194547824690597888,2011-04-23 22:06:30 +0000,fat,@stevej @xc i'm going to picket when i get back.
397
+ 194547658562605057,2011-04-23 22:05:51 +0000,wil,@0x9900 @paulnivin http://t.co/bwVdtAPe
398
+ 194547528430137344,2011-04-23 22:05:19 +0000,wangtian,"@tianhonghe @xiangxin72 oh, you can even order specific items?"
399
+ 194547402550689793,2011-04-23 22:04:49 +0000,shinypb,"@kpk Pfft, I think you're forgetting mechanical television, which depended on a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird"
400
+ 194547260233760768,2011-04-23 22:04:16 +0000,0x9900,@wil @paulnivin if you want to take you seriously don't say daemontools!
401
+ 194547084349804544,2011-04-23 22:03:34 +0000,kpk,@shinypb @skilldrick @hoverbird invented it
402
+ 194546876782092291,2011-04-23 22:02:44 +0000,skilldrick,@shinypb Well played :) @hoverbird
403
+ 194546811480969217,2011-04-23 22:02:29 +0000,sam,"Can someone project the date that I'll get a 27"" retina display?"
404
+ 194546738810458112,2011-04-23 22:02:11 +0000,shinypb,"@skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain."
405
+ 194546727670390784,2011-04-23 22:02:09 +0000,bartt,"@noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come."
406
+ 194546649203347456,2011-04-23 22:01:50 +0000,skilldrick,"@hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all."
407
+ 194546583608639488,2011-04-23 22:01:34 +0000,sean,@mep Thanks for coming by. Was great to have you.
408
+ 194546388707717120,2011-04-23 22:00:48 +0000,hoverbird,"@shinypb @trammell it's all suck a ""duck blur"" sometimes."
409
+ 194546264212385793,2011-04-23 22:00:18 +0000,kelseysilver,San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw
410
+ eos
411
+ end
412
+ end
262
413
  context "--long" do
263
414
  before do
264
415
  @list.options = @list.options.merge(:long => true)
265
416
  end
266
- it "should list in long format" do
417
+ it "should output in long format" do
267
418
  @list.timeline("presidents")
268
419
  $stdout.string.should == <<-eos
269
420
  ID Posted at Screen name Text
@@ -328,39 +479,26 @@ ID Posted at Screen name Text
328
479
  eos
329
480
  end
330
481
  end
331
- context "with a screen name passed" do
332
- before do
333
- stub_get("/1/lists/statuses.json").
334
- with(:query => {:owner_screen_name => "sferik", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
335
- to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
336
- end
482
+ context "with a user passed" do
337
483
  it "should request the correct resource" do
338
- @list.timeline("sferik", "presidents")
484
+ @list.timeline("testcli/presidents")
339
485
  a_get("/1/lists/statuses.json").
340
- with(:query => {:owner_screen_name => "sferik", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
486
+ with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
341
487
  should have_been_made
342
488
  end
343
- it "should have the correct output" do
344
- @list.timeline("sferik", "presidents")
345
- $stdout.string.should == <<-eos
346
- natevillegas: RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it's called the present. (7 months ago)
347
- TD: @kelseysilver how long will you be in town? (7 months ago)
348
- rusashka: @maciej hahaha :) @gpena together we're going to cover all core 28 languages! (7 months ago)
349
- fat: @stevej @xc i'm going to picket when i get back. (7 months ago)
350
- wil: @0x9900 @paulnivin http://t.co/bwVdtAPe (7 months ago)
351
- wangtian: @tianhonghe @xiangxin72 oh, you can even order specific items? (7 months ago)
352
- shinypb: @kpk Pfft, I think you're forgetting mechanical television, which depended on a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird (7 months ago)
353
- 0x9900: @wil @paulnivin if you want to take you seriously don't say daemontools! (7 months ago)
354
- kpk: @shinypb @skilldrick @hoverbird invented it (7 months ago)
355
- skilldrick: @shinypb Well played :) @hoverbird (7 months ago)
356
- sam: Can someone project the date that I'll get a 27" retina display? (7 months ago)
357
- shinypb: @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain. (7 months ago)
358
- bartt: @noahlt @gaarf Yup, now owning @twitter -&gt; FB from FE to daemons. Lot’s of fun. Expect improvements in the weeks to come. (7 months ago)
359
- skilldrick: @hoverbird @shinypb You guys must be soooo old, I don't remember the words to the duck tales intro at all. (7 months ago)
360
- sean: @mep Thanks for coming by. Was great to have you. (7 months ago)
361
- hoverbird: @shinypb @trammell it's all suck a "duck blur" sometimes. (7 months ago)
362
- kelseysilver: San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/ 92 others) http://t.co/eoLANJZw (7 months ago)
363
- eos
489
+ context "--id" do
490
+ before do
491
+ @list.options = @list.options.merge(:id => true)
492
+ stub_get("/1/lists/statuses.json").
493
+ with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
494
+ to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
495
+ end
496
+ it "should request the correct resource" do
497
+ @list.timeline("7505382/presidents")
498
+ a_get("/1/lists/statuses.json").
499
+ with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents", :include_entities => "false"}).
500
+ should have_been_made
501
+ end
364
502
  end
365
503
  end
366
504
  end