t 0.9.7 → 0.9.8
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.rb +1 -1
- data/lib/t/authorizable.rb +10 -2
- data/lib/t/cli.rb +92 -28
- data/lib/t/collectable.rb +7 -4
- data/lib/t/delete.rb +13 -6
- data/lib/t/format_helpers.rb +44 -44
- data/lib/t/list.rb +22 -14
- data/lib/t/printable.rb +156 -145
- data/lib/t/rcfile.rb +2 -1
- data/lib/t/requestable.rb +21 -21
- data/lib/t/search.rb +12 -8
- data/lib/t/set.rb +3 -3
- data/lib/t/stream.rb +13 -5
- data/lib/t/version.rb +1 -1
- data/spec/cli_spec.rb +190 -78
- data/spec/fixtures/search.json +111 -1
- data/spec/fixtures/statuses.json +180 -0
- data/spec/format_helpers_spec.rb +96 -0
- data/spec/list_spec.rb +24 -5
- data/spec/search_spec.rb +23 -3
- metadata +4 -2
data/spec/fixtures/search.json
CHANGED
@@ -7,6 +7,116 @@
|
|
7
7
|
"query": "twitter",
|
8
8
|
"refresh_url": "?since_id=194521262415032320&q=twitter",
|
9
9
|
"results": [
|
10
|
+
{
|
11
|
+
"created_at": "Mon, 23 Apr 2011 20:20:57 +0000",
|
12
|
+
"from_user": "Somedude",
|
13
|
+
"from_user_id": 818993897,
|
14
|
+
"from_user_id_str": "818993897",
|
15
|
+
"from_user_name": "Random Dude",
|
16
|
+
"geo": null,
|
17
|
+
"id": 194521323202624150,
|
18
|
+
"id_str": "194521323202624150",
|
19
|
+
"iso_language_code": "en",
|
20
|
+
"metadata": {
|
21
|
+
"result_type": "recent"
|
22
|
+
},
|
23
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/1014656526/pic.jpg",
|
24
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/1014656526/pic.jpg",
|
25
|
+
"source": "<a href="http://twitter.com/">web</a>",
|
26
|
+
"text": "Gotta get right with twitter",
|
27
|
+
"to_user": null,
|
28
|
+
"to_user_id": null,
|
29
|
+
"to_user_id_str": null,
|
30
|
+
"to_user_name": null
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"created_at": "Mon, 23 Apr 2011 20:20:57 +0000",
|
34
|
+
"from_user": "TestMan",
|
35
|
+
"from_user_id": 32702507980,
|
36
|
+
"from_user_id_str": "32702507980",
|
37
|
+
"from_user_name": "Test Account",
|
38
|
+
"geo": null,
|
39
|
+
"id": 194526951936212623,
|
40
|
+
"id_str": "194526951936212623",
|
41
|
+
"iso_language_code": "en",
|
42
|
+
"metadata": {
|
43
|
+
"result_type": "recent"
|
44
|
+
},
|
45
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/2147508883/IMG-20120404-WA003_normal.jpg",
|
46
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/2147508883/IMG-20120404-WA003_normal.jpg",
|
47
|
+
"source": "<a href="http://blackberry.com/twitter" rel="nofollow">Twitter for BlackBerry®</a>",
|
48
|
+
"text": "Twitter to Facebook test",
|
49
|
+
"to_user": null,
|
50
|
+
"to_user_id": null,
|
51
|
+
"to_user_id_str": null,
|
52
|
+
"to_user_name": null
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"created_at": "Mon, 23 Apr 2011 20:20:57 +0000",
|
56
|
+
"from_user": "Jena_Jones",
|
57
|
+
"from_user_id": 13938181651,
|
58
|
+
"from_user_id_str": "13938181651",
|
59
|
+
"from_user_name": "Jena Jones",
|
60
|
+
"geo": null,
|
61
|
+
"id": 194521346690562622,
|
62
|
+
"id_str": "194521346690562622",
|
63
|
+
"iso_language_code": "en",
|
64
|
+
"metadata": {
|
65
|
+
"result_type": "recent"
|
66
|
+
},
|
67
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/2156571407/543631_337343819653633_100001340549098_850013_1999940127_n_normal.jpg",
|
68
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/2156571407/543631_337343819653633_100001340549098_850013_1999940127_n_normal.jpg",
|
69
|
+
"source": "<a href="http://mobile.twitter.com" rel="nofollow">Mobile Web</a>",
|
70
|
+
"text": "test my new twitter..... :)",
|
71
|
+
"to_user": null,
|
72
|
+
"to_user_id": null,
|
73
|
+
"to_user_id_str": null,
|
74
|
+
"to_user_name": null
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"created_at": "Mon, 23 Apr 2011 20:20:57 +0000",
|
78
|
+
"from_user": "misterpic",
|
79
|
+
"from_user_id": 259342250,
|
80
|
+
"from_user_id_str": "259342250",
|
81
|
+
"from_user_name": "mister pic!",
|
82
|
+
"geo": null,
|
83
|
+
"id": 194521262134160820,
|
84
|
+
"id_str": "194521262134160820",
|
85
|
+
"iso_language_code": "en",
|
86
|
+
"metadata": {
|
87
|
+
"result_type": "recent"
|
88
|
+
},
|
89
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/2159952653/P2191655_normal.JPG",
|
90
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/2159952653/P2191655_normal.JPG",
|
91
|
+
"source": "<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>",
|
92
|
+
"text": "Wallah there should be a test before you can get a twitter account some people are so dumb... better",
|
93
|
+
"to_user": null,
|
94
|
+
"to_user_id": null,
|
95
|
+
"to_user_id_str": null,
|
96
|
+
"to_user_name": null
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"created_at": "Mon, 23 Apr 2011 20:20:57 +0000",
|
100
|
+
"from_user": "RRabbit",
|
101
|
+
"from_user_id": 91022555146,
|
102
|
+
"from_user_id_str": "91022555146",
|
103
|
+
"from_user_name": "Rogger Rabbit",
|
104
|
+
"geo": null,
|
105
|
+
"id": 194521016652621340,
|
106
|
+
"id_str": "194521016652621340",
|
107
|
+
"iso_language_code": "en",
|
108
|
+
"metadata": {
|
109
|
+
"result_type": "recent"
|
110
|
+
},
|
111
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/1663790229/390753_10150394068222898_738242897_8656853_1501249832_n_1__normal.jpg",
|
112
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/1663790229/390753_10150394068222898_738242897_8656853_1501249832_n_1__normal.jpg",
|
113
|
+
"source": "<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>",
|
114
|
+
"text": "Twitter is kinda fun... Kinda!",
|
115
|
+
"to_user": null,
|
116
|
+
"to_user_id": null,
|
117
|
+
"to_user_id_str": null,
|
118
|
+
"to_user_name": null
|
119
|
+
},
|
10
120
|
{
|
11
121
|
"created_at": "Mon, 23 Apr 2011 20:20:57 +0000",
|
12
122
|
"from_user": "JessRoveel",
|
@@ -340,7 +450,7 @@
|
|
340
450
|
"to_user_name": null
|
341
451
|
}
|
342
452
|
],
|
343
|
-
"results_per_page":
|
453
|
+
"results_per_page": 20,
|
344
454
|
"since_id": 0,
|
345
455
|
"since_id_str": "0"
|
346
456
|
}
|
data/spec/fixtures/statuses.json
CHANGED
@@ -1,4 +1,184 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"geo": null,
|
4
|
+
"retweeted": false,
|
5
|
+
"in_reply_to_status_id": null,
|
6
|
+
"contributors": null,
|
7
|
+
"in_reply_to_screen_name": null,
|
8
|
+
"truncated": false,
|
9
|
+
"id_str": "194548141663027221",
|
10
|
+
"coordinates": null,
|
11
|
+
"in_reply_to_user_id": null,
|
12
|
+
"place": null,
|
13
|
+
"user": {
|
14
|
+
"id": 14506011,
|
15
|
+
"followers_count": 2588,
|
16
|
+
"profile_background_color": "5D8A8C",
|
17
|
+
"url": "http://www.ryanbigg.com",
|
18
|
+
"created_at": "Thu Apr 24 03:23:53 +0000 2008",
|
19
|
+
"profile_background_image_url": "http://a0.twimg.com/profile_background_images/2503404/Untitled.jpg",
|
20
|
+
"listed_count": 250,
|
21
|
+
"lang": "en",
|
22
|
+
"profile_link_color": "000000",
|
23
|
+
"utc_offset": 36000,
|
24
|
+
"name": "Ryan Bigg",
|
25
|
+
"is_translator": false,
|
26
|
+
"location": "Melbourne, Australia",
|
27
|
+
"protected": false,
|
28
|
+
"profile_use_background_image": true,
|
29
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/1500934941/superman_normal.png",
|
30
|
+
"time_zone": "Brisbane",
|
31
|
+
"profile_text_color": "000000",
|
32
|
+
"friends_count": 417,
|
33
|
+
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/2503404/Untitled.jpg",
|
34
|
+
"default_profile_image": false,
|
35
|
+
"verified": false,
|
36
|
+
"profile_sidebar_border_color": "000000",
|
37
|
+
"favourites_count": 267,
|
38
|
+
"following": false,
|
39
|
+
"statuses_count": 33152,
|
40
|
+
"description": "Award winning super hero published author (Rails 3 in Action). Avid cyclist and hiker. Community manager for Spree Commerce. Views are my own, etc.",
|
41
|
+
"contributors_enabled": false,
|
42
|
+
"id_str": "14506011",
|
43
|
+
"geo_enabled": true,
|
44
|
+
"profile_background_tile": true,
|
45
|
+
"show_all_inline_media": true,
|
46
|
+
"profile_sidebar_border_color": "121212",
|
47
|
+
"follow_request_sent": false,
|
48
|
+
"screen_name": "ryanbigg",
|
49
|
+
"default_profile": false,
|
50
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/1500934941/superman_normal.png",
|
51
|
+
"notifications": false
|
52
|
+
},
|
53
|
+
"retweet_count": 0,
|
54
|
+
"favorited": false,
|
55
|
+
"in_reply_to_status_id_str": null,
|
56
|
+
"source": "web",
|
57
|
+
"in_reply_to_user_id_str": null,
|
58
|
+
"id": 194548141663027221,
|
59
|
+
"created_at": "Mon Apr 23 22:08:32 +0000 2011",
|
60
|
+
"text": "Things that have made my life better, in order of greatness: GitHub, Travis CI, the element Oxygen."
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"geo": null,
|
64
|
+
"retweeted": false,
|
65
|
+
"in_reply_to_status_id": null,
|
66
|
+
"contributors": null,
|
67
|
+
"in_reply_to_screen_name": null,
|
68
|
+
"truncated": false,
|
69
|
+
"id_str": "194548121416630272",
|
70
|
+
"coordinates": null,
|
71
|
+
"in_reply_to_user_id": null,
|
72
|
+
"place": null,
|
73
|
+
"user": {
|
74
|
+
"id": 20187443,
|
75
|
+
"followers_count": 8365,
|
76
|
+
"profile_background_color": "C0DEED",
|
77
|
+
"url": "http://sfbike.org",
|
78
|
+
"created_at": "Thu Feb 05 21:00:04 +0000 2009",
|
79
|
+
"profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png",
|
80
|
+
"listed_count": 609,
|
81
|
+
"lang": "en",
|
82
|
+
"profile_link_color": "591828",
|
83
|
+
"utc_offset": -28800,
|
84
|
+
"name": "SF Bicycle Coalition",
|
85
|
+
"is_translator": false,
|
86
|
+
"location": "San Francisco",
|
87
|
+
"protected": false,
|
88
|
+
"profile_use_background_image": true,
|
89
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/75810351/logo_normal.jpg",
|
90
|
+
"time_zone": "Pacific Time (US & Canada)",
|
91
|
+
"profile_text_color": "000000",
|
92
|
+
"friends_count": 1346,
|
93
|
+
"profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png",
|
94
|
+
"default_profile_image": false,
|
95
|
+
"verified": false,
|
96
|
+
"profile_sidebar_border_color": "000000",
|
97
|
+
"favourites_count": 53,
|
98
|
+
"following": false,
|
99
|
+
"statuses_count": 3051,
|
100
|
+
"description": "Promoting the bicycle for everyday transportation",
|
101
|
+
"contributors_enabled": false,
|
102
|
+
"id_str": "20187443",
|
103
|
+
"geo_enabled": true,
|
104
|
+
"profile_background_tile": false,
|
105
|
+
"show_all_inline_media": true,
|
106
|
+
"profile_sidebar_fill_color": "f8f6f6",
|
107
|
+
"follow_request_sent": false,
|
108
|
+
"screen_name": "sfbike",
|
109
|
+
"default_profile": false,
|
110
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/75810351/logo_normal.jpg",
|
111
|
+
"notifications": false
|
112
|
+
},
|
113
|
+
"retweet_count": 0,
|
114
|
+
"favorited": false,
|
115
|
+
"in_reply_to_status_id_str": null,
|
116
|
+
"source": "web",
|
117
|
+
"in_reply_to_user_id_str": null,
|
118
|
+
"id": 194563027248121416,
|
119
|
+
"created_at": "Mon Apr 23 22:08:11 +0000 2011",
|
120
|
+
"text": "Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers counted in 1 hour--that's 17 per minute. Way to roll, SF!"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"geo": null,
|
124
|
+
"retweeted": false,
|
125
|
+
"in_reply_to_status_id": null,
|
126
|
+
"contributors": null,
|
127
|
+
"in_reply_to_screen_name": null,
|
128
|
+
"truncated": false,
|
129
|
+
"id_str": "194548120271416632",
|
130
|
+
"coordinates": null,
|
131
|
+
"in_reply_to_user_id": null,
|
132
|
+
"place": null,
|
133
|
+
"user": {
|
134
|
+
"id": 914061,
|
135
|
+
"followers_count": 8943,
|
136
|
+
"profile_background_color": "FFFAFE",
|
137
|
+
"url": "http://www.box.com",
|
138
|
+
"created_at": "Sun Mar 11 09:25:44 +0000 2007",
|
139
|
+
"profile_background_image_url": "http://a0.twimg.com/profile_background_images/21668675/box_logo.png",
|
140
|
+
"listed_count": 291,
|
141
|
+
"lang": "en",
|
142
|
+
"profile_link_color": "0000FF",
|
143
|
+
"utc_offset": -28800,
|
144
|
+
"name": "Aaron Levie",
|
145
|
+
"is_translator": false,
|
146
|
+
"location": "Palo Alto",
|
147
|
+
"protected": false,
|
148
|
+
"profile_use_background_image": false,
|
149
|
+
"profile_image_url_https": "https://si0.twimg.com/profile_images/1626898956/twitter_normal.png",
|
150
|
+
"time_zone": "Pacific Time (US & Canada)",
|
151
|
+
"profile_text_color": "000000",
|
152
|
+
"friends_count": 486,
|
153
|
+
"profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/21668675/box_logo.png",
|
154
|
+
"default_profile_image": false,
|
155
|
+
"verified": false,
|
156
|
+
"profile_sidebar_border_color": "87BC44",
|
157
|
+
"favourites_count": 439,
|
158
|
+
"following": false,
|
159
|
+
"statuses_count": 1301,
|
160
|
+
"description": "Lead Magician (and CEO) at Box; I don't fully endorse anything I say below. Go ☁",
|
161
|
+
"contributors_enabled": false,
|
162
|
+
"id_str": "914061",
|
163
|
+
"geo_enabled": true,
|
164
|
+
"profile_background_tile": true,
|
165
|
+
"show_all_inline_media": true,
|
166
|
+
"profile_sidebar_fill_color": "E0FF92",
|
167
|
+
"follow_request_sent": false,
|
168
|
+
"screen_name": "levie",
|
169
|
+
"default_profile": false,
|
170
|
+
"profile_image_url": "http://a0.twimg.com/profile_images/1626898956/twitter_normal.png",
|
171
|
+
"notifications": false
|
172
|
+
},
|
173
|
+
"retweet_count": 0,
|
174
|
+
"favorited": false,
|
175
|
+
"in_reply_to_status_id_str": null,
|
176
|
+
"source": "web",
|
177
|
+
"in_reply_to_user_id_str": null,
|
178
|
+
"id": 194548120271416632,
|
179
|
+
"created_at": "Mon Apr 23 22:07:51 +0000 2011",
|
180
|
+
"text": "I know you're as rare as leprechauns, but if you're an amazing designer then Box wants to hire you. Email recruiting@box.com"
|
181
|
+
},
|
2
182
|
{
|
3
183
|
"geo": null,
|
4
184
|
"retweeted": false,
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
describe T::FormatHelpers do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
Timecop.freeze(Time.utc(2011, 11, 24, 16, 20, 0))
|
8
|
+
T.utc_offset = 'PST'
|
9
|
+
end
|
10
|
+
|
11
|
+
after :all do
|
12
|
+
T.utc_offset = nil
|
13
|
+
Timecop.return
|
14
|
+
end
|
15
|
+
|
16
|
+
before do
|
17
|
+
class Test; end
|
18
|
+
@test = Test.new
|
19
|
+
@test.extend(T::FormatHelpers)
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#distance_of_time_in_words" do
|
23
|
+
it "returns \"a split second\" if difference is less than a second" do
|
24
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 0))).should == "a split second"
|
25
|
+
end
|
26
|
+
it "returns \"a second\" if difference is a second" do
|
27
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 1))).should == "a second"
|
28
|
+
end
|
29
|
+
it "returns \"2 seconds\" if difference is 2 seconds" do
|
30
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 2))).should == "2 seconds"
|
31
|
+
end
|
32
|
+
it "returns \"59 seconds\" if difference is just shy of 1 minute" do
|
33
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 59.9))).should == "59 seconds"
|
34
|
+
end
|
35
|
+
it "returns \"a minute\" if difference is 1 minute" do
|
36
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 21, 0))).should == "a minute"
|
37
|
+
end
|
38
|
+
it "returns \"2 minutes\" if difference is 2 minutes" do
|
39
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 22, 0))).should == "2 minutes"
|
40
|
+
end
|
41
|
+
it "returns \"59 minutes\" if difference is just shy of 1 hour" do
|
42
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 17, 19, 59.9))).should == "59 minutes"
|
43
|
+
end
|
44
|
+
it "returns \"an hour\" if difference is 1 hour" do
|
45
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 17, 20, 0))).should == "an hour"
|
46
|
+
end
|
47
|
+
it "returns \"2 hours\" if difference is 2 hours" do
|
48
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 18, 20, 0))).should == "2 hours"
|
49
|
+
end
|
50
|
+
it "returns \"23 hours\" if difference is just shy of 23.5 hours" do
|
51
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 25, 15, 49, 59.9))).should == "23 hours"
|
52
|
+
end
|
53
|
+
it "returns \"a day\" if difference is 23.5 hours" do
|
54
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 25, 15, 50, 0))).should == "a day"
|
55
|
+
end
|
56
|
+
it "returns \"2 days\" if difference is 2 days" do
|
57
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 26, 16, 20, 0))).should == "2 days"
|
58
|
+
end
|
59
|
+
it "returns \"29 days\" if difference is just shy of 29.5 days" do
|
60
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 12, 24, 4, 19, 59.9))).should == "29 days"
|
61
|
+
end
|
62
|
+
it "returns \"a month\" if difference is 29.5 days" do
|
63
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2011, 12, 24, 4, 20, 0))).should == "a month"
|
64
|
+
end
|
65
|
+
it "returns \"2 months\" if difference is 2 months" do
|
66
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2012, 1, 24, 16, 20, 0))).should == "2 months"
|
67
|
+
end
|
68
|
+
it "returns \"11 months\" if difference is just shy of 11.5 months" do
|
69
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2012, 11, 8, 11, 19, 59.9))).should == "11 months"
|
70
|
+
end
|
71
|
+
it "returns \"a year\" if difference is 11.5 months" do
|
72
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2012, 11, 8, 11, 20, 0))).should == "a year"
|
73
|
+
end
|
74
|
+
it "returns \"2 years\" if difference is 2 years" do
|
75
|
+
@test.send(:distance_of_time_in_words, (Time.utc(2013, 11, 24, 16, 20, 0))).should == "2 years"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#strip_tags" do
|
80
|
+
it "returns string sans tags" do
|
81
|
+
@test.send(:strip_tags, '<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>').should == "Twitter for iPhone"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "#number_with_delimiter" do
|
86
|
+
it "returns number with delimiter" do
|
87
|
+
@test.send(:number_with_delimiter, 1234567890).should == "1,234,567,890"
|
88
|
+
end
|
89
|
+
context "with custom delimiter" do
|
90
|
+
it "returns number with custom delimiter" do
|
91
|
+
@test.send(:number_with_delimiter, 1234567890, ".").should == "1.234.567.890"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
data/spec/list_spec.rb
CHANGED
@@ -119,7 +119,7 @@ ID 8863586
|
|
119
119
|
Description Presidents of the United States of America
|
120
120
|
Slug presidents
|
121
121
|
Screen name @sferik
|
122
|
-
Created at Mar 15 2010 (
|
122
|
+
Created at Mar 15 2010 (a year ago)
|
123
123
|
Members 2
|
124
124
|
Subscribers 1
|
125
125
|
Status Not following
|
@@ -382,6 +382,9 @@ ID Since Tweets Favorites Listed Following Followers Scre...
|
|
382
382
|
@list.timeline("presidents")
|
383
383
|
$stdout.string.should == <<-eos
|
384
384
|
ID,Posted at,Screen name,Text
|
385
|
+
194548141663027221,2011-04-23 22:08:32 +0000,ryanbigg,"Things that have made my life better, in order of greatness: GitHub, Travis CI, the element Oxygen."
|
386
|
+
194563027248121416,2011-04-23 22:08:11 +0000,sfbike,"Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers counted in 1 hour--that's 17 per minute. Way to roll, SF!"
|
387
|
+
194548120271416632,2011-04-23 22:07:51 +0000,levie,"I know you're as rare as leprechauns, but if you're an amazing designer then Box wants to hire you. Email recruiting@box.com"
|
385
388
|
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.
|
386
389
|
194547993607806976,2011-04-23 22:07:10 +0000,TD,@kelseysilver how long will you be in town?
|
387
390
|
194547987593183233,2011-04-23 22:07:09 +0000,rusashka,@maciej hahaha :) @gpena together we're going to cover all core 28 languages!
|
@@ -410,6 +413,9 @@ ID,Posted at,Screen name,Text
|
|
410
413
|
@list.timeline("presidents")
|
411
414
|
$stdout.string.should == <<-eos
|
412
415
|
ID Posted at Screen name Text
|
416
|
+
194548141663027221 Apr 23 2011 @ryanbigg Things that have made my lif...
|
417
|
+
194563027248121416 Apr 23 2011 @sfbike Bike to Work Counts in: 73% ...
|
418
|
+
194548120271416632 Apr 23 2011 @levie I know you're as rare as lep...
|
413
419
|
194548121416630272 Apr 23 2011 @natevillegas RT @gelobautista #riordan RT...
|
414
420
|
194547993607806976 Apr 23 2011 @TD @kelseysilver how long will ...
|
415
421
|
194547987593183233 Apr 23 2011 @rusashka @maciej hahaha :) @gpena tog...
|
@@ -454,6 +460,9 @@ ID Posted at Screen name Text
|
|
454
460
|
194547987593183233 Apr 23 2011 @rusashka @maciej hahaha :) @gpena tog...
|
455
461
|
194547993607806976 Apr 23 2011 @TD @kelseysilver how long will ...
|
456
462
|
194548121416630272 Apr 23 2011 @natevillegas RT @gelobautista #riordan RT...
|
463
|
+
194548120271416632 Apr 23 2011 @levie I know you're as rare as lep...
|
464
|
+
194563027248121416 Apr 23 2011 @sfbike Bike to Work Counts in: 73% ...
|
465
|
+
194548141663027221 Apr 23 2011 @ryanbigg Things that have made my lif...
|
457
466
|
eos
|
458
467
|
end
|
459
468
|
end
|
@@ -467,8 +476,13 @@ ID Posted at Screen name Text
|
|
467
476
|
with(:query => {:owner_screen_name => "testcli", :per_page => "200", :slug => "presidents"}).
|
468
477
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
469
478
|
stub_get("/1/lists/statuses.json").
|
470
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "
|
471
|
-
to_return(:body => fixture("
|
479
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "200", :max_id => "194546264212385792", :slug => "presidents"}).
|
480
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
481
|
+
(5..185).step(20).to_a.reverse.each do |count|
|
482
|
+
stub_get("/1/lists/statuses.json").
|
483
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => count, :max_id => "194546264212385792", :slug => "presidents"}).
|
484
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
485
|
+
end
|
472
486
|
end
|
473
487
|
it "should limit the number of results to 1" do
|
474
488
|
@list.options = @list.options.merge("number" => 1)
|
@@ -484,8 +498,13 @@ ID Posted at Screen name Text
|
|
484
498
|
with(:query => {:owner_screen_name => "testcli", :per_page => "200", :slug => "presidents"}).
|
485
499
|
should have_been_made
|
486
500
|
a_get("/1/lists/statuses.json").
|
487
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "
|
488
|
-
should have_been_made
|
501
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "200", :max_id => "194546264212385792", :slug => "presidents"}).
|
502
|
+
should have_been_made.times(7)
|
503
|
+
(5..185).step(20).to_a.reverse.each do |count|
|
504
|
+
a_get("/1/lists/statuses.json").
|
505
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => count, :max_id => "194546264212385792", :slug => "presidents"}).
|
506
|
+
should have_been_made
|
507
|
+
end
|
489
508
|
end
|
490
509
|
end
|
491
510
|
context "with a user passed" do
|