t 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -2
- data/lib/t/cli.rb +43 -36
- data/lib/t/collectable.rb +3 -15
- data/lib/t/delete.rb +9 -4
- data/lib/t/list.rb +11 -6
- data/lib/t/printable.rb +7 -7
- data/lib/t/search.rb +40 -14
- data/lib/t/set.rb +5 -0
- data/lib/t/stream.rb +21 -13
- data/lib/t/utils.rb +16 -0
- data/lib/t/version.rb +1 -1
- data/spec/cli_spec.rb +538 -440
- data/spec/delete_spec.rb +24 -24
- data/spec/fixtures/200_direct_messages.json +27054 -0
- data/spec/fixtures/200_statuses.json +1 -0
- data/spec/fixtures/geo.kml +64 -0
- data/spec/fixtures/geo_no_city.kml +24 -0
- data/spec/fixtures/geo_no_state.kml +16 -0
- data/spec/fixtures/search.json +1 -1
- data/spec/fixtures/search_with_entities.json +1 -0
- data/spec/fixtures/status_no_place.json +72 -0
- data/spec/fixtures/status_with_mention.json +1 -0
- data/spec/fixtures/statuses.json +1 -1
- data/spec/list_spec.rb +94 -100
- data/spec/rcfile_spec.rb +21 -21
- data/spec/search_spec.rb +788 -189
- data/spec/set_spec.rb +19 -19
- data/spec/utils_spec.rb +1 -1
- data/t.gemspec +34 -33
- metadata +22 -5
data/lib/t/printable.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module T
|
2
2
|
module Printable
|
3
3
|
LIST_HEADINGS = ["ID", "Created at", "Screen name", "Slug", "Members", "Subscribers", "Mode", "Description"]
|
4
|
-
|
4
|
+
TWEET_HEADINGS = ["ID", "Posted at", "Screen name", "Text"]
|
5
5
|
USER_HEADINGS = ["ID", "Since", "Last tweeted at", "Tweets", "Favorites", "Listed", "Following", "Followers", "Screen name", "Name"]
|
6
6
|
MONTH_IN_SECONDS = 2592000
|
7
7
|
|
@@ -13,7 +13,7 @@ module T
|
|
13
13
|
|
14
14
|
def build_long_tweet(tweet)
|
15
15
|
require 'htmlentities'
|
16
|
-
[tweet.id, ls_formatted_time(tweet), "@#{tweet.from_user}",
|
16
|
+
[tweet.id, ls_formatted_time(tweet), "@#{tweet.from_user}", decode_full_text(tweet, options['decode_urls']).gsub(/\n+/, ' ')]
|
17
17
|
end
|
18
18
|
|
19
19
|
def build_long_user(user)
|
@@ -46,7 +46,7 @@ module T
|
|
46
46
|
require 'csv'
|
47
47
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
48
48
|
require 'htmlentities'
|
49
|
-
say [tweet.id, csv_formatted_time(tweet), tweet.from_user,
|
49
|
+
say [tweet.id, csv_formatted_time(tweet), tweet.from_user, decode_full_text(tweet)].to_csv
|
50
50
|
end
|
51
51
|
|
52
52
|
def print_csv_user(user)
|
@@ -129,7 +129,7 @@ module T
|
|
129
129
|
if options['csv']
|
130
130
|
require 'csv'
|
131
131
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
132
|
-
say
|
132
|
+
say TWEET_HEADINGS.to_csv unless tweets.empty?
|
133
133
|
tweets.each do |tweet|
|
134
134
|
print_csv_tweet(tweet)
|
135
135
|
end
|
@@ -137,11 +137,11 @@ module T
|
|
137
137
|
array = tweets.map do |tweet|
|
138
138
|
build_long_tweet(tweet)
|
139
139
|
end
|
140
|
-
format = options['format'] ||
|
141
|
-
print_table_with_headings(array,
|
140
|
+
format = options['format'] || TWEET_HEADINGS.size.times.map{"%s"}
|
141
|
+
print_table_with_headings(array, TWEET_HEADINGS, format)
|
142
142
|
else
|
143
143
|
tweets.each do |tweet|
|
144
|
-
print_message(tweet.user.screen_name, tweet.full_text)
|
144
|
+
print_message(tweet.user.screen_name, decode_urls(tweet.full_text, options['decode_urls'] ? tweet.urls : nil))
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
data/lib/t/search.rb
CHANGED
@@ -18,6 +18,11 @@ module T
|
|
18
18
|
|
19
19
|
check_unknown_options!
|
20
20
|
|
21
|
+
class_option "host", :aliases => "-H", :type => :string, :default => T::Requestable::DEFAULT_HOST, :desc => "Twitter API server"
|
22
|
+
class_option "no-color", :aliases => "-N", :type => :boolean, :desc => "Disable colorization in output"
|
23
|
+
class_option "no-ssl", :aliases => "-U", :type => :boolean, :default => false, :desc => "Disable SSL"
|
24
|
+
class_option "profile", :aliases => "-P", :type => :string, :default => File.join(File.expand_path("~"), T::RCFile::FILE_NAME), :desc => "Path to RC file", :banner => "FILE"
|
25
|
+
|
21
26
|
def initialize(*)
|
22
27
|
@rcfile = T::RCFile.instance
|
23
28
|
super
|
@@ -26,10 +31,12 @@ module T
|
|
26
31
|
desc "all QUERY", "Returns the #{DEFAULT_NUM_RESULTS} most recent Tweets that match the specified query."
|
27
32
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
28
33
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
34
|
+
method_option "decode_urls", :aliases => "-d", :type => :boolean, :default => false, :desc => "Decodes t.co URLs into their original form."
|
29
35
|
method_option "number", :aliases => "-n", :type => :numeric, :default => DEFAULT_NUM_RESULTS
|
30
36
|
def all(query)
|
31
|
-
|
32
|
-
tweets =
|
37
|
+
count = options['number'] || DEFAULT_NUM_RESULTS
|
38
|
+
tweets = collect_with_count(count) do |opts|
|
39
|
+
opts[:include_entities] = 1 if options['decode_urls']
|
33
40
|
client.search(query, opts).results
|
34
41
|
end
|
35
42
|
tweets.reverse! if options['reverse']
|
@@ -37,32 +44,34 @@ module T
|
|
37
44
|
if options['csv']
|
38
45
|
require 'csv'
|
39
46
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
40
|
-
say
|
47
|
+
say TWEET_HEADINGS.to_csv unless tweets.empty?
|
41
48
|
tweets.each do |tweet|
|
42
|
-
say [tweet.id, csv_formatted_time(tweet), tweet.from_user,
|
49
|
+
say [tweet.id, csv_formatted_time(tweet), tweet.from_user, decode_full_text(tweet)].to_csv
|
43
50
|
end
|
44
51
|
elsif options['long']
|
45
52
|
array = tweets.map do |tweet|
|
46
|
-
[tweet.id, ls_formatted_time(tweet), "@#{tweet.from_user}",
|
53
|
+
[tweet.id, ls_formatted_time(tweet), "@#{tweet.from_user}", decode_full_text(tweet, options['decode_urls']).gsub(/\n+/, ' ')]
|
47
54
|
end
|
48
|
-
format = options['format'] ||
|
49
|
-
print_table_with_headings(array,
|
55
|
+
format = options['format'] || TWEET_HEADINGS.size.times.map{"%s"}
|
56
|
+
print_table_with_headings(array, TWEET_HEADINGS, format)
|
50
57
|
else
|
51
58
|
say unless tweets.empty?
|
52
59
|
tweets.each do |tweet|
|
53
|
-
print_message(tweet.from_user, tweet
|
60
|
+
print_message(tweet.from_user, decode_full_text(tweet, options['decode_urls']))
|
54
61
|
end
|
55
62
|
end
|
56
63
|
end
|
57
64
|
|
58
65
|
desc "favorites [USER] QUERY", "Returns Tweets you've favorited that match the specified query."
|
59
66
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
60
|
-
method_option "id", :aliases => "-i", :type =>
|
67
|
+
method_option "id", :aliases => "-i", :type => :boolean, :default => false, :desc => "Specify user via ID instead of screen name."
|
68
|
+
method_option "decode_urls", :aliases => "-d", :type => :boolean, :default => false, :desc => "Decodes t.co URLs into their original form."
|
61
69
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
62
70
|
def favorites(*args)
|
63
71
|
opts = {:count => MAX_NUM_RESULTS}
|
64
72
|
query = args.pop
|
65
73
|
user = args.pop
|
74
|
+
opts[:include_entities] = 1 if options['decode_urls']
|
66
75
|
if user
|
67
76
|
require 't/core_ext/string'
|
68
77
|
user = if options['id']
|
@@ -89,11 +98,13 @@ module T
|
|
89
98
|
|
90
99
|
desc "list [USER/]LIST QUERY", "Returns Tweets on a list that match specified query."
|
91
100
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
92
|
-
method_option "id", :aliases => "-i", :type =>
|
101
|
+
method_option "id", :aliases => "-i", :type => :boolean, :default => false, :desc => "Specify user via ID instead of screen name."
|
93
102
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
103
|
+
method_option "decode_urls", :aliases => "-d", :type => :boolean, :default => false, :desc => "Decodes t.co URLs into their original form."
|
94
104
|
def list(list, query)
|
95
105
|
owner, list = extract_owner(list, options)
|
96
106
|
opts = {:count => MAX_NUM_RESULTS}
|
107
|
+
opts[:include_entities] = 1 if options['decode_urls']
|
97
108
|
tweets = collect_with_max_id do |max_id|
|
98
109
|
opts[:max_id] = max_id unless max_id.nil?
|
99
110
|
client.list_timeline(owner, list, opts)
|
@@ -107,8 +118,10 @@ module T
|
|
107
118
|
desc "mentions QUERY", "Returns Tweets mentioning you that match the specified query."
|
108
119
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
109
120
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
121
|
+
method_option "decode_urls", :aliases => "-d", :type => :boolean, :default => false, :desc => "Decodes t.co URLs into their original form."
|
110
122
|
def mentions(query)
|
111
123
|
opts = {:count => MAX_NUM_RESULTS}
|
124
|
+
opts[:include_entities] = 1 if options['decode_urls']
|
112
125
|
tweets = collect_with_max_id do |max_id|
|
113
126
|
opts[:max_id] = max_id unless max_id.nil?
|
114
127
|
client.mentions(opts)
|
@@ -122,12 +135,14 @@ module T
|
|
122
135
|
|
123
136
|
desc "retweets [USER] QUERY", "Returns Tweets you've retweeted that match the specified query."
|
124
137
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
125
|
-
method_option "id", :aliases => "-i", :type =>
|
138
|
+
method_option "id", :aliases => "-i", :type => :boolean, :default => false, :desc => "Specify user via ID instead of screen name."
|
126
139
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
140
|
+
method_option "decode_urls", :aliases => "-d", :type => :boolean, :default => false, :desc => "Decodes t.co URLs into their original form."
|
127
141
|
def retweets(*args)
|
128
142
|
opts = {:count => MAX_NUM_RESULTS}
|
129
143
|
query = args.pop
|
130
144
|
user = args.pop
|
145
|
+
opts[:include_entities] = 1 if options['decode_urls']
|
131
146
|
if user
|
132
147
|
require 't/core_ext/string'
|
133
148
|
user = if options['id']
|
@@ -154,12 +169,23 @@ module T
|
|
154
169
|
|
155
170
|
desc "timeline [USER] QUERY", "Returns Tweets in your timeline that match the specified query."
|
156
171
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
157
|
-
method_option "
|
172
|
+
method_option "exclude", :aliases => "-e", :type => :string, :enum => %w(replies retweets), :desc => "Exclude certain types of Tweets from the results.", :banner => "TYPE"
|
173
|
+
method_option "id", :aliases => "-i", :type => :boolean, :default => false, :desc => "Specify user via ID instead of screen name."
|
158
174
|
method_option "long", :aliases => "-l", :type => :boolean, :default => false, :desc => "Output in long format."
|
175
|
+
method_option "decode_urls", :aliases => "-d", :type => :boolean, :default => false, :desc => "Decodes t.co URLs into their original form."
|
159
176
|
def timeline(*args)
|
160
177
|
opts = {:count => MAX_NUM_RESULTS}
|
161
178
|
query = args.pop
|
162
179
|
user = args.pop
|
180
|
+
opts[:include_entities] = 1 if options['decode_urls']
|
181
|
+
exclude_opts = case options['exclude']
|
182
|
+
when 'replies'
|
183
|
+
{:exclude_replies => true}
|
184
|
+
when 'retweets'
|
185
|
+
{:include_rts => false}
|
186
|
+
else
|
187
|
+
{}
|
188
|
+
end
|
163
189
|
if user
|
164
190
|
require 't/core_ext/string'
|
165
191
|
user = if options['id']
|
@@ -169,12 +195,12 @@ module T
|
|
169
195
|
end
|
170
196
|
tweets = collect_with_max_id do |max_id|
|
171
197
|
opts[:max_id] = max_id unless max_id.nil?
|
172
|
-
client.user_timeline(user, opts)
|
198
|
+
client.user_timeline(user, opts.merge(exclude_opts))
|
173
199
|
end
|
174
200
|
else
|
175
201
|
tweets = collect_with_max_id do |max_id|
|
176
202
|
opts[:max_id] = max_id unless max_id.nil?
|
177
|
-
client.home_timeline(opts)
|
203
|
+
client.home_timeline(opts.merge(exclude_opts))
|
178
204
|
end
|
179
205
|
end
|
180
206
|
tweets = tweets.select do |tweet|
|
data/lib/t/set.rb
CHANGED
@@ -8,6 +8,11 @@ module T
|
|
8
8
|
|
9
9
|
check_unknown_options!
|
10
10
|
|
11
|
+
class_option "host", :aliases => "-H", :type => :string, :default => T::Requestable::DEFAULT_HOST, :desc => "Twitter API server"
|
12
|
+
class_option "no-color", :aliases => "-N", :type => :boolean, :desc => "Disable colorization in output"
|
13
|
+
class_option "no-ssl", :aliases => "-U", :type => :boolean, :default => false, :desc => "Disable SSL"
|
14
|
+
class_option "profile", :aliases => "-P", :type => :string, :default => File.join(File.expand_path("~"), T::RCFile::FILE_NAME), :desc => "Path to RC file", :banner => "FILE"
|
15
|
+
|
11
16
|
def initialize(*)
|
12
17
|
@rcfile = T::RCFile.instance
|
13
18
|
super
|
data/lib/t/stream.rb
CHANGED
@@ -5,14 +5,22 @@ require 't/rcfile'
|
|
5
5
|
module T
|
6
6
|
class Stream < Thor
|
7
7
|
include T::Printable
|
8
|
+
include T::Utils
|
8
9
|
|
9
|
-
|
10
|
+
TWEET_HEADINGS_FORMATTING = [
|
10
11
|
"%-18s", # Add padding to maximum length of a Tweet ID
|
11
12
|
"%-12s", # Add padding to length of a timestamp formatted with ls_formatted_time
|
12
13
|
"%-20s", # Add padding to maximum length of a Twitter screen name
|
13
14
|
"%s", # Last element does not need special formatting
|
14
15
|
]
|
15
16
|
|
17
|
+
check_unknown_options!
|
18
|
+
|
19
|
+
class_option "host", :aliases => "-H", :type => :string, :default => T::Requestable::DEFAULT_HOST, :desc => "Twitter API server"
|
20
|
+
class_option "no-color", :aliases => "-N", :type => :boolean, :desc => "Disable colorization in output"
|
21
|
+
class_option "no-ssl", :aliases => "-U", :type => :boolean, :default => false, :desc => "Disable SSL"
|
22
|
+
class_option "profile", :aliases => "-P", :type => :string, :default => File.join(File.expand_path("~"), T::RCFile::FILE_NAME), :desc => "Path to RC file", :banner => "FILE"
|
23
|
+
|
16
24
|
def initialize(*)
|
17
25
|
@rcfile = T::RCFile.instance
|
18
26
|
super
|
@@ -27,10 +35,10 @@ module T
|
|
27
35
|
if options['csv']
|
28
36
|
require 'csv'
|
29
37
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
30
|
-
say
|
38
|
+
say TWEET_HEADINGS.to_csv
|
31
39
|
elsif options['long'] && STDOUT.tty?
|
32
|
-
headings =
|
33
|
-
|
40
|
+
headings = TWEET_HEADINGS.size.times.map do |index|
|
41
|
+
TWEET_HEADINGS_FORMATTING[index] % TWEET_HEADINGS[index]
|
34
42
|
end
|
35
43
|
print_table([headings])
|
36
44
|
end
|
@@ -40,7 +48,7 @@ module T
|
|
40
48
|
print_csv_tweet(tweet)
|
41
49
|
elsif options['long']
|
42
50
|
array = build_long_tweet(tweet).each_with_index.map do |element, index|
|
43
|
-
|
51
|
+
TWEET_HEADINGS_FORMATTING[index] % element
|
44
52
|
end
|
45
53
|
print_table([array], :truncate => STDOUT.tty?)
|
46
54
|
else
|
@@ -70,7 +78,7 @@ module T
|
|
70
78
|
search = T::Search.new
|
71
79
|
search.options = search.options.merge(options)
|
72
80
|
search.options = search.options.merge(:reverse => true)
|
73
|
-
search.options = search.options.merge(:format =>
|
81
|
+
search.options = search.options.merge(:format => TWEET_HEADINGS_FORMATTING)
|
74
82
|
search.all(keywords.join(' OR '))
|
75
83
|
end
|
76
84
|
client.on_timeline_status do |tweet|
|
@@ -78,7 +86,7 @@ module T
|
|
78
86
|
print_csv_tweet(tweet)
|
79
87
|
elsif options['long']
|
80
88
|
array = build_long_tweet(tweet).each_with_index.map do |element, index|
|
81
|
-
|
89
|
+
TWEET_HEADINGS_FORMATTING[index] % element
|
82
90
|
end
|
83
91
|
print_table([array], :truncate => STDOUT.tty?)
|
84
92
|
else
|
@@ -98,7 +106,7 @@ module T
|
|
98
106
|
cli = T::CLI.new
|
99
107
|
cli.options = cli.options.merge(options)
|
100
108
|
cli.options = cli.options.merge(:reverse => true)
|
101
|
-
cli.options = cli.options.merge(:format =>
|
109
|
+
cli.options = cli.options.merge(:format => TWEET_HEADINGS_FORMATTING)
|
102
110
|
cli.timeline
|
103
111
|
end
|
104
112
|
client.on_timeline_status do |tweet|
|
@@ -106,7 +114,7 @@ module T
|
|
106
114
|
print_csv_tweet(tweet)
|
107
115
|
elsif options['long']
|
108
116
|
array = build_long_tweet(tweet).each_with_index.map do |element, index|
|
109
|
-
|
117
|
+
TWEET_HEADINGS_FORMATTING[index] % element
|
110
118
|
end
|
111
119
|
print_table([array], :truncate => STDOUT.tty?)
|
112
120
|
else
|
@@ -127,10 +135,10 @@ module T
|
|
127
135
|
if options['csv']
|
128
136
|
require 'csv'
|
129
137
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
130
|
-
say
|
138
|
+
say TWEET_HEADINGS.to_csv
|
131
139
|
elsif options['long'] && STDOUT.tty?
|
132
|
-
headings =
|
133
|
-
|
140
|
+
headings = TWEET_HEADINGS.size.times.map do |index|
|
141
|
+
TWEET_HEADINGS_FORMATTING[index] % TWEET_HEADINGS[index]
|
134
142
|
end
|
135
143
|
print_table([headings])
|
136
144
|
end
|
@@ -140,7 +148,7 @@ module T
|
|
140
148
|
print_csv_tweet(tweet)
|
141
149
|
elsif options['long']
|
142
150
|
array = build_long_tweet(tweet).each_with_index.map do |element, index|
|
143
|
-
|
151
|
+
TWEET_HEADINGS_FORMATTING[index] % element
|
144
152
|
end
|
145
153
|
print_table([array], :truncate => STDOUT.tty?)
|
146
154
|
else
|
data/lib/t/utils.rb
CHANGED
@@ -95,5 +95,21 @@ module T
|
|
95
95
|
"#{count || 0} " + ((count == 1 || count =~ /^1(\.0+)?$/) ? singular : (plural || "#{singular}s"))
|
96
96
|
end
|
97
97
|
|
98
|
+
def decode_full_text(tweet, decode_full_urls = false)
|
99
|
+
text = HTMLEntities.new.decode(tweet.full_text)
|
100
|
+
text = decode_urls(text, tweet.urls) if decode_full_urls
|
101
|
+
text
|
102
|
+
end
|
103
|
+
|
104
|
+
def decode_urls(full_text, url_entities)
|
105
|
+
return full_text if url_entities.nil?
|
106
|
+
|
107
|
+
url_entities.each do |url_hash|
|
108
|
+
full_text = full_text.gsub(url_hash.url, url_hash.expanded_url)
|
109
|
+
end
|
110
|
+
|
111
|
+
full_text
|
112
|
+
end
|
113
|
+
|
98
114
|
end
|
99
115
|
end
|
data/lib/t/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -32,7 +32,7 @@ describe T::CLI do
|
|
32
32
|
before do
|
33
33
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
34
34
|
end
|
35
|
-
it "
|
35
|
+
it "has the correct output" do
|
36
36
|
@cli.accounts
|
37
37
|
expect($stdout.string).to eq <<-eos
|
38
38
|
testcli
|
@@ -48,7 +48,7 @@ testcli
|
|
48
48
|
stub_post("/oauth/access_token").to_return(:body => fixture("access_token"))
|
49
49
|
stub_get("/1.1/account/verify_credentials.json").with(:query => {:include_entities => "false", :skip_status => "true"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
50
50
|
end
|
51
|
-
it "
|
51
|
+
it "requests the correct resource" do
|
52
52
|
$stdout.should_receive(:print)
|
53
53
|
$stdin.should_receive(:gets).and_return("\n")
|
54
54
|
$stdout.should_receive(:print).with("Enter your consumer key: ")
|
@@ -64,7 +64,7 @@ testcli
|
|
64
64
|
expect(a_post("/oauth/access_token")).to have_been_made
|
65
65
|
expect(a_get("/1.1/account/verify_credentials.json").with(:query => {:include_entities => "false", :skip_status => "true"})).to have_been_made
|
66
66
|
end
|
67
|
-
it "
|
67
|
+
it "does not raise error" do
|
68
68
|
expect do
|
69
69
|
$stdout.should_receive(:print)
|
70
70
|
$stdin.should_receive(:gets).and_return("\n")
|
@@ -79,6 +79,45 @@ testcli
|
|
79
79
|
@cli.authorize
|
80
80
|
end.not_to raise_error
|
81
81
|
end
|
82
|
+
context "empty RC file" do
|
83
|
+
before do
|
84
|
+
@cli.options = @cli.options.merge("profile" => project_path + "/tmp/empty", "display-url" => true)
|
85
|
+
end
|
86
|
+
after do
|
87
|
+
File.delete(project_path + "/tmp/empty")
|
88
|
+
end
|
89
|
+
it "requests the correct resource" do
|
90
|
+
$stdout.should_receive(:print)
|
91
|
+
$stdin.should_receive(:gets).and_return("\n")
|
92
|
+
$stdout.should_receive(:print).with("Enter your consumer key: ")
|
93
|
+
$stdin.should_receive(:gets).and_return("abc123")
|
94
|
+
$stdout.should_receive(:print).with("Enter your consumer secret: ")
|
95
|
+
$stdin.should_receive(:gets).and_return("asdfasd223sd2")
|
96
|
+
$stdout.should_receive(:print).with("Press [Enter] to open the Twitter app authorization page. ")
|
97
|
+
$stdin.should_receive(:gets).and_return("\n")
|
98
|
+
$stdout.should_receive(:print).with("Enter the supplied PIN: ")
|
99
|
+
$stdin.should_receive(:gets).and_return("1234567890")
|
100
|
+
@cli.authorize
|
101
|
+
expect(a_post("/oauth/request_token")).to have_been_made
|
102
|
+
expect(a_post("/oauth/access_token")).to have_been_made
|
103
|
+
expect(a_get("/1.1/account/verify_credentials.json").with(:query => {:include_entities => "false", :skip_status => "true"})).to have_been_made
|
104
|
+
end
|
105
|
+
it "does not raise error" do
|
106
|
+
expect do
|
107
|
+
$stdout.should_receive(:print)
|
108
|
+
$stdin.should_receive(:gets).and_return("\n")
|
109
|
+
$stdout.should_receive(:print).with("Enter your consumer key: ")
|
110
|
+
$stdin.should_receive(:gets).and_return("abc123")
|
111
|
+
$stdout.should_receive(:print).with("Enter your consumer secret: ")
|
112
|
+
$stdin.should_receive(:gets).and_return("asdfasd223sd2")
|
113
|
+
$stdout.should_receive(:print).with("Press [Enter] to open the Twitter app authorization page. ")
|
114
|
+
$stdin.should_receive(:gets).and_return("\n")
|
115
|
+
$stdout.should_receive(:print).with("Enter the supplied PIN: ")
|
116
|
+
$stdin.should_receive(:gets).and_return("1234567890")
|
117
|
+
@cli.authorize
|
118
|
+
end.not_to raise_error
|
119
|
+
end
|
120
|
+
end
|
82
121
|
end
|
83
122
|
|
84
123
|
describe "#block" do
|
@@ -86,11 +125,11 @@ testcli
|
|
86
125
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
87
126
|
stub_post("/1.1/blocks/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
88
127
|
end
|
89
|
-
it "
|
128
|
+
it "requests the correct resource" do
|
90
129
|
@cli.block("sferik")
|
91
130
|
expect(a_post("/1.1/blocks/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
|
92
131
|
end
|
93
|
-
it "
|
132
|
+
it "has the correct output" do
|
94
133
|
@cli.block("sferik")
|
95
134
|
expect($stdout.string).to match /^@testcli blocked 1 user/
|
96
135
|
end
|
@@ -99,7 +138,7 @@ testcli
|
|
99
138
|
@cli.options = @cli.options.merge("id" => true)
|
100
139
|
stub_post("/1.1/blocks/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
101
140
|
end
|
102
|
-
it "
|
141
|
+
it "requests the correct resource" do
|
103
142
|
@cli.block("7505382")
|
104
143
|
expect(a_post("/1.1/blocks/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
105
144
|
end
|
@@ -109,13 +148,13 @@ testcli
|
|
109
148
|
describe "#direct_messages" do
|
110
149
|
before do
|
111
150
|
stub_get("/1.1/direct_messages.json").with(:query => {:count => "20"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
112
|
-
stub_get("/1.1/direct_messages.json").with(:query => {:count => "10", "max_id"=>"1624782205"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
151
|
+
stub_get("/1.1/direct_messages.json").with(:query => {:count => "10", "max_id" => "1624782205"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
113
152
|
end
|
114
|
-
it "
|
153
|
+
it "requests the correct resource" do
|
115
154
|
@cli.direct_messages
|
116
155
|
expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "20"})).to have_been_made
|
117
156
|
end
|
118
|
-
it "
|
157
|
+
it "has the correct output" do
|
119
158
|
@cli.direct_messages
|
120
159
|
expect($stdout.string).to eq <<-eos
|
121
160
|
\e[1m\e[33m @sferik\e[0m
|
@@ -160,7 +199,7 @@ testcli
|
|
160
199
|
before do
|
161
200
|
@cli.options = @cli.options.merge("csv" => true)
|
162
201
|
end
|
163
|
-
it "
|
202
|
+
it "outputs in CSV format" do
|
164
203
|
@cli.direct_messages
|
165
204
|
expect($stdout.string).to eq <<-eos
|
166
205
|
ID,Posted at,Screen name,Text
|
@@ -181,7 +220,7 @@ ID,Posted at,Screen name,Text
|
|
181
220
|
before do
|
182
221
|
@cli.options = @cli.options.merge("long" => true)
|
183
222
|
end
|
184
|
-
it "
|
223
|
+
it "outputs in long format" do
|
185
224
|
@cli.direct_messages
|
186
225
|
expect($stdout.string).to eq <<-eos
|
187
226
|
ID Posted at Screen name Text
|
@@ -201,32 +240,26 @@ ID Posted at Screen name Text
|
|
201
240
|
context "--number" do
|
202
241
|
before do
|
203
242
|
stub_get("/1.1/direct_messages.json").with(:query => {:count => "1"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
204
|
-
stub_get("/1.1/direct_messages.json").with(:query => {:count => "200"}).to_return(:body => fixture("
|
205
|
-
stub_get("/1.1/direct_messages.json").with(:query => {:count => "
|
206
|
-
(5..195).step(10).to_a.reverse.each do |count|
|
207
|
-
stub_get("/1.1/direct_messages.json").with(:query => {:count => count, :max_id => "1624782205"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
208
|
-
end
|
243
|
+
stub_get("/1.1/direct_messages.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
244
|
+
stub_get("/1.1/direct_messages.json").with(:query => {:count => "1", :max_id => "235851563443306495"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
209
245
|
end
|
210
|
-
it "
|
246
|
+
it "limits the number of results to 1" do
|
211
247
|
@cli.options = @cli.options.merge("number" => 1)
|
212
248
|
@cli.direct_messages
|
213
249
|
expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "1"})).to have_been_made
|
214
250
|
end
|
215
|
-
it "
|
216
|
-
@cli.options = @cli.options.merge("number" =>
|
251
|
+
it "limits the number of results to 201" do
|
252
|
+
@cli.options = @cli.options.merge("number" => 201)
|
217
253
|
@cli.direct_messages
|
218
254
|
expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "200"})).to have_been_made
|
219
|
-
expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "
|
220
|
-
(5..195).step(10).to_a.reverse.each do |count|
|
221
|
-
expect(a_get("/1.1/direct_messages.json").with(:query => {:count => count, :max_id => "1624782205"})).to have_been_made
|
222
|
-
end
|
255
|
+
expect(a_get("/1.1/direct_messages.json").with(:query => {:count => "1", :max_id => "235851563443306495"})).to have_been_made
|
223
256
|
end
|
224
257
|
end
|
225
258
|
context "--reverse" do
|
226
259
|
before do
|
227
260
|
@cli.options = @cli.options.merge("reverse" => true)
|
228
261
|
end
|
229
|
-
it "
|
262
|
+
it "reverses the order of the sort" do
|
230
263
|
@cli.direct_messages
|
231
264
|
expect($stdout.string).to eq <<-eos
|
232
265
|
\e[1m\e[33m @sferik\e[0m
|
@@ -273,13 +306,13 @@ ID Posted at Screen name Text
|
|
273
306
|
describe "#direct_messages_sent" do
|
274
307
|
before do
|
275
308
|
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "20"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
276
|
-
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "10", "max_id"=>"1624782205"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
309
|
+
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "10", "max_id" => "1624782205"}).to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
277
310
|
end
|
278
|
-
it "
|
311
|
+
it "requests the correct resource" do
|
279
312
|
@cli.direct_messages_sent
|
280
313
|
expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "20"})).to have_been_made
|
281
314
|
end
|
282
|
-
it "
|
315
|
+
it "has the correct output" do
|
283
316
|
@cli.direct_messages_sent
|
284
317
|
expect($stdout.string).to eq <<-eos
|
285
318
|
\e[1m\e[33m @hurrycane\e[0m
|
@@ -324,7 +357,7 @@ ID Posted at Screen name Text
|
|
324
357
|
before do
|
325
358
|
@cli.options = @cli.options.merge("csv" => true)
|
326
359
|
end
|
327
|
-
it "
|
360
|
+
it "outputs in CSV format" do
|
328
361
|
@cli.direct_messages_sent
|
329
362
|
expect($stdout.string).to eq <<-eos
|
330
363
|
ID,Posted at,Screen name,Text
|
@@ -345,7 +378,7 @@ ID,Posted at,Screen name,Text
|
|
345
378
|
before do
|
346
379
|
@cli.options = @cli.options.merge("long" => true)
|
347
380
|
end
|
348
|
-
it "
|
381
|
+
it "outputs in long format" do
|
349
382
|
@cli.direct_messages_sent
|
350
383
|
expect($stdout.string).to eq <<-eos
|
351
384
|
ID Posted at Screen name Text
|
@@ -365,32 +398,26 @@ ID Posted at Screen name Text
|
|
365
398
|
context "--number" do
|
366
399
|
before do
|
367
400
|
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
368
|
-
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"}).to_return(:body => fixture("
|
369
|
-
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "
|
370
|
-
(5..195).step(10).to_a.reverse.each do |count|
|
371
|
-
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => count, :max_id => "1624782205"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
372
|
-
end
|
401
|
+
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
402
|
+
stub_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1", :max_id => "235851563443306495"}).to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
373
403
|
end
|
374
|
-
it "
|
404
|
+
it "limits the number of results 1" do
|
375
405
|
@cli.options = @cli.options.merge("number" => 1)
|
376
406
|
@cli.direct_messages_sent
|
377
407
|
expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1"})).to have_been_made
|
378
408
|
end
|
379
|
-
it "
|
380
|
-
@cli.options = @cli.options.merge("number" =>
|
409
|
+
it "limits the number of results to 201" do
|
410
|
+
@cli.options = @cli.options.merge("number" => 201)
|
381
411
|
@cli.direct_messages_sent
|
382
412
|
expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "200"})).to have_been_made
|
383
|
-
expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "
|
384
|
-
(5..195).step(10).to_a.reverse.each do |count|
|
385
|
-
expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => count, :max_id => "1624782205"})).to have_been_made
|
386
|
-
end
|
413
|
+
expect(a_get("/1.1/direct_messages/sent.json").with(:query => {:count => "1", :max_id => "235851563443306495"})).to have_been_made
|
387
414
|
end
|
388
415
|
end
|
389
416
|
context "--reverse" do
|
390
417
|
before do
|
391
418
|
@cli.options = @cli.options.merge("reverse" => true)
|
392
419
|
end
|
393
|
-
it "
|
420
|
+
it "reverses the order of the sort" do
|
394
421
|
@cli.direct_messages_sent
|
395
422
|
expect($stdout.string).to eq <<-eos
|
396
423
|
\e[1m\e[33m @hurrycane\e[0m
|
@@ -440,13 +467,13 @@ ID Posted at Screen name Text
|
|
440
467
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
441
468
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
442
469
|
end
|
443
|
-
it "
|
470
|
+
it "requests the correct resource" do
|
444
471
|
@cli.groupies
|
445
472
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
446
473
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
447
474
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"})).to have_been_made
|
448
475
|
end
|
449
|
-
it "
|
476
|
+
it "has the correct output" do
|
450
477
|
@cli.groupies
|
451
478
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
452
479
|
end
|
@@ -454,7 +481,7 @@ ID Posted at Screen name Text
|
|
454
481
|
before do
|
455
482
|
@cli.options = @cli.options.merge("csv" => true)
|
456
483
|
end
|
457
|
-
it "
|
484
|
+
it "outputs in CSV format" do
|
458
485
|
@cli.groupies
|
459
486
|
expect($stdout.string).to eq <<-eos
|
460
487
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
@@ -467,7 +494,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
467
494
|
before do
|
468
495
|
@cli.options = @cli.options.merge("long" => true)
|
469
496
|
end
|
470
|
-
it "
|
497
|
+
it "outputs in long format" do
|
471
498
|
@cli.groupies
|
472
499
|
expect($stdout.string).to eq <<-eos
|
473
500
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
@@ -480,7 +507,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
480
507
|
before do
|
481
508
|
@cli.options = @cli.options.merge("reverse" => true)
|
482
509
|
end
|
483
|
-
it "
|
510
|
+
it "reverses the order of the sort" do
|
484
511
|
@cli.groupies
|
485
512
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
486
513
|
end
|
@@ -489,7 +516,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
489
516
|
before do
|
490
517
|
@cli.options = @cli.options.merge("sort" => "favorites")
|
491
518
|
end
|
492
|
-
it "
|
519
|
+
it "sorts by number of favorites" do
|
493
520
|
@cli.groupies
|
494
521
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
495
522
|
end
|
@@ -498,7 +525,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
498
525
|
before do
|
499
526
|
@cli.options = @cli.options.merge("sort" => "followers")
|
500
527
|
end
|
501
|
-
it "
|
528
|
+
it "sorts by number of followers" do
|
502
529
|
@cli.groupies
|
503
530
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
504
531
|
end
|
@@ -507,7 +534,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
507
534
|
before do
|
508
535
|
@cli.options = @cli.options.merge("sort" => "friends")
|
509
536
|
end
|
510
|
-
it "
|
537
|
+
it "sorts by number of friends" do
|
511
538
|
@cli.groupies
|
512
539
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
513
540
|
end
|
@@ -516,7 +543,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
516
543
|
before do
|
517
544
|
@cli.options = @cli.options.merge("sort" => "listed")
|
518
545
|
end
|
519
|
-
it "
|
546
|
+
it "sorts by number of list memberships" do
|
520
547
|
@cli.groupies
|
521
548
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
522
549
|
end
|
@@ -525,7 +552,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
525
552
|
before do
|
526
553
|
@cli.options = @cli.options.merge("sort" => "since")
|
527
554
|
end
|
528
|
-
it "
|
555
|
+
it "sorts by the time when Twitter acount was created" do
|
529
556
|
@cli.groupies
|
530
557
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
531
558
|
end
|
@@ -534,7 +561,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
534
561
|
before do
|
535
562
|
@cli.options = @cli.options.merge("sort" => "tweets")
|
536
563
|
end
|
537
|
-
it "
|
564
|
+
it "sorts by number of Tweets" do
|
538
565
|
@cli.groupies
|
539
566
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
540
567
|
end
|
@@ -543,7 +570,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
543
570
|
before do
|
544
571
|
@cli.options = @cli.options.merge("sort" => "tweeted")
|
545
572
|
end
|
546
|
-
it "
|
573
|
+
it "sorts by the time of the last Tweet" do
|
547
574
|
@cli.groupies
|
548
575
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
549
576
|
end
|
@@ -552,7 +579,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
552
579
|
before do
|
553
580
|
@cli.options = @cli.options.merge("unsorted" => true)
|
554
581
|
end
|
555
|
-
it "
|
582
|
+
it "is not sorted" do
|
556
583
|
@cli.groupies
|
557
584
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
558
585
|
end
|
@@ -562,7 +589,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
562
589
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
563
590
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
564
591
|
end
|
565
|
-
it "
|
592
|
+
it "requests the correct resource" do
|
566
593
|
@cli.groupies("sferik")
|
567
594
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
568
595
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
@@ -574,7 +601,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
574
601
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
575
602
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
576
603
|
end
|
577
|
-
it "
|
604
|
+
it "requests the correct resource" do
|
578
605
|
@cli.groupies("7505382")
|
579
606
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
580
607
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
@@ -589,11 +616,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
589
616
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
590
617
|
stub_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
591
618
|
end
|
592
|
-
it "
|
619
|
+
it "requests the correct resource" do
|
593
620
|
@cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
|
594
621
|
expect(a_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
|
595
622
|
end
|
596
|
-
it "
|
623
|
+
it "has the correct output" do
|
597
624
|
@cli.dm("pengwynn", "Creating a fixture for the Twitter gem")
|
598
625
|
expect($stdout.string.chomp).to eq "Direct Message sent from @testcli to @pengwynn."
|
599
626
|
end
|
@@ -602,7 +629,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
602
629
|
@cli.options = @cli.options.merge("id" => true)
|
603
630
|
stub_post("/1.1/direct_messages/new.json").with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
604
631
|
end
|
605
|
-
it "
|
632
|
+
it "requests the correct resource" do
|
606
633
|
@cli.dm("14100886", "Creating a fixture for the Twitter gem")
|
607
634
|
expect(a_post("/1.1/direct_messages/new.json").with(:body => {:user_id => "14100886", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
|
608
635
|
end
|
@@ -614,11 +641,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
614
641
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
615
642
|
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
616
643
|
end
|
617
|
-
it "
|
644
|
+
it "requests the correct resource" do
|
618
645
|
@cli.does_contain("presidents")
|
619
646
|
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"})).to have_been_made
|
620
647
|
end
|
621
|
-
it "
|
648
|
+
it "has the correct output" do
|
622
649
|
@cli.does_contain("presidents")
|
623
650
|
expect($stdout.string.chomp).to eq "Yes, presidents contains @testcli."
|
624
651
|
end
|
@@ -628,14 +655,14 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
628
655
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
629
656
|
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
630
657
|
end
|
631
|
-
it "
|
658
|
+
it "requests the correct resource" do
|
632
659
|
@cli.does_contain("presidents", "7505382")
|
633
660
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
|
634
661
|
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
635
662
|
end
|
636
663
|
end
|
637
664
|
context "with an owner passed" do
|
638
|
-
it "
|
665
|
+
it "has the correct output" do
|
639
666
|
@cli.does_contain("testcli/presidents", "testcli")
|
640
667
|
expect($stdout.string.chomp).to eq "Yes, presidents contains @testcli."
|
641
668
|
end
|
@@ -645,7 +672,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
645
672
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
646
673
|
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
647
674
|
end
|
648
|
-
it "
|
675
|
+
it "requests the correct resource" do
|
649
676
|
@cli.does_contain("7505382/presidents", "7505382")
|
650
677
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
|
651
678
|
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
@@ -653,7 +680,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
653
680
|
end
|
654
681
|
end
|
655
682
|
context "with a user passed" do
|
656
|
-
it "
|
683
|
+
it "has the correct output" do
|
657
684
|
@cli.does_contain("presidents", "testcli")
|
658
685
|
expect($stdout.string.chomp).to eq "Yes, presidents contains @testcli."
|
659
686
|
end
|
@@ -662,7 +689,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
662
689
|
before do
|
663
690
|
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "testcli", :screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
664
691
|
end
|
665
|
-
it "
|
692
|
+
it "exits" do
|
666
693
|
expect do
|
667
694
|
@cli.does_contain("presidents")
|
668
695
|
end.to raise_error(SystemExit)
|
@@ -676,11 +703,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
676
703
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
677
704
|
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
678
705
|
end
|
679
|
-
it "
|
706
|
+
it "requests the correct resource" do
|
680
707
|
@cli.does_follow("ev")
|
681
708
|
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"})).to have_been_made
|
682
709
|
end
|
683
|
-
it "
|
710
|
+
it "has the correct output" do
|
684
711
|
@cli.does_follow("ev")
|
685
712
|
expect($stdout.string.chomp).to eq "Yes, @ev follows @testcli."
|
686
713
|
end
|
@@ -690,41 +717,52 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
690
717
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "20"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
691
718
|
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
692
719
|
end
|
693
|
-
it "
|
720
|
+
it "requests the correct resource" do
|
694
721
|
@cli.does_follow("20")
|
695
722
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "20"})).to have_been_made
|
696
723
|
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "testcli"})).to have_been_made
|
697
724
|
end
|
725
|
+
it "has the correct output" do
|
726
|
+
@cli.does_follow("20")
|
727
|
+
expect($stdout.string.chomp).to eq "Yes, @sferik follows @testcli."
|
728
|
+
end
|
698
729
|
end
|
699
730
|
context "with a user passed" do
|
700
731
|
before do
|
701
|
-
|
702
|
-
|
703
|
-
|
732
|
+
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "sferik"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
733
|
+
end
|
734
|
+
it "requests the correct resource" do
|
735
|
+
@cli.does_follow("ev", "sferik")
|
736
|
+
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "sferik"})).to have_been_made
|
704
737
|
end
|
705
|
-
it "
|
706
|
-
@cli.does_follow("ev", "
|
707
|
-
expect($stdout.string.chomp).to eq "Yes, @
|
738
|
+
it "has the correct output" do
|
739
|
+
@cli.does_follow("ev", "sferik")
|
740
|
+
expect($stdout.string.chomp).to eq "Yes, @ev follows @sferik."
|
708
741
|
end
|
709
742
|
context "--id" do
|
710
743
|
before do
|
711
744
|
@cli.options = @cli.options.merge("id" => true)
|
712
745
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "20"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
713
746
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "428004849"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
747
|
+
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
714
748
|
end
|
715
|
-
it "
|
749
|
+
it "requests the correct resource" do
|
716
750
|
@cli.does_follow("20", "428004849")
|
717
751
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "20"})).to have_been_made
|
718
752
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "428004849"})).to have_been_made
|
719
753
|
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "sferik"})).to have_been_made
|
720
754
|
end
|
755
|
+
it "has the correct output" do
|
756
|
+
@cli.does_follow("20", "428004849")
|
757
|
+
expect($stdout.string.chomp).to eq "Yes, @sferik follows @sferik."
|
758
|
+
end
|
721
759
|
end
|
722
760
|
end
|
723
761
|
context "false" do
|
724
762
|
before do
|
725
763
|
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "ev", :target_screen_name => "testcli"}).to_return(:body => fixture("not_following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
726
764
|
end
|
727
|
-
it "
|
765
|
+
it "exits" do
|
728
766
|
expect do
|
729
767
|
@cli.does_follow("ev")
|
730
768
|
end.to raise_error(SystemExit)
|
@@ -738,11 +776,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
738
776
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
739
777
|
stub_post("/1.1/favorites/create.json").with(:body => {:id => "26755176471724032"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
740
778
|
end
|
741
|
-
it "
|
779
|
+
it "requests the correct resource" do
|
742
780
|
@cli.favorite("26755176471724032")
|
743
781
|
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "26755176471724032"})).to have_been_made
|
744
782
|
end
|
745
|
-
it "
|
783
|
+
it "has the correct output" do
|
746
784
|
@cli.favorite("26755176471724032")
|
747
785
|
expect($stdout.string).to match /^@testcli favorited 1 tweet.$/
|
748
786
|
end
|
@@ -752,11 +790,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
752
790
|
before do
|
753
791
|
stub_get("/1.1/favorites/list.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
754
792
|
end
|
755
|
-
it "
|
793
|
+
it "requests the correct resource" do
|
756
794
|
@cli.favorites
|
757
795
|
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "20"})).to have_been_made
|
758
796
|
end
|
759
|
-
it "
|
797
|
+
it "has the correct output" do
|
760
798
|
@cli.favorites
|
761
799
|
expect($stdout.string).to eq <<-eos
|
762
800
|
\e[1m\e[33m @mutgoff\e[0m
|
@@ -840,11 +878,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
840
878
|
before do
|
841
879
|
@cli.options = @cli.options.merge("csv" => true)
|
842
880
|
end
|
843
|
-
it "
|
881
|
+
it "outputs in CSV format" do
|
844
882
|
@cli.favorites
|
845
883
|
expect($stdout.string).to eq <<-eos
|
846
884
|
ID,Posted at,Screen name,Text
|
847
|
-
|
885
|
+
4611686018427387904,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
|
848
886
|
244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
|
849
887
|
244110336414859264,2012-09-07 16:30:14 +0000,pat_shaughnessy,"Something else to vote for: ""New Rails workshops to bring more women into the Boston software scene"" http://t.co/eNBuckHc /cc @bostonrb"
|
850
888
|
244109797308379136,2012-09-07 16:28:05 +0000,calebelston,Pushing the button to launch the site. http://t.co/qLoEn5jG
|
@@ -871,60 +909,60 @@ ID,Posted at,Screen name,Text
|
|
871
909
|
before do
|
872
910
|
@cli.options = @cli.options.merge("long" => true)
|
873
911
|
end
|
874
|
-
it "
|
912
|
+
it "outputs in long format" do
|
875
913
|
@cli.favorites
|
876
914
|
expect($stdout.string).to eq <<-eos
|
877
|
-
ID
|
878
|
-
|
879
|
-
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-
|
880
|
-
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote
|
881
|
-
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to
|
882
|
-
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron:
|
883
|
-
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a
|
884
|
-
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going
|
885
|
-
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just
|
886
|
-
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how
|
887
|
-
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober
|
888
|
-
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better
|
889
|
-
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic
|
890
|
-
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more -->
|
891
|
-
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If
|
892
|
-
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination;
|
893
|
-
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald:
|
894
|
-
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars
|
895
|
-
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now
|
896
|
-
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did
|
897
|
-
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't
|
915
|
+
ID Posted at Screen name Text
|
916
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
917
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
918
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
919
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
920
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
921
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
922
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
923
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
924
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
925
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober...
|
926
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
927
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
928
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
929
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
930
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
931
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
932
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
933
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
934
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
935
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
898
936
|
eos
|
899
937
|
end
|
900
938
|
context "--reverse" do
|
901
939
|
before do
|
902
940
|
@cli.options = @cli.options.merge("reverse" => true)
|
903
941
|
end
|
904
|
-
it "
|
942
|
+
it "reverses the order of the sort" do
|
905
943
|
@cli.favorites
|
906
944
|
expect($stdout.string).to eq <<-eos
|
907
|
-
ID
|
908
|
-
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't
|
909
|
-
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did
|
910
|
-
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now
|
911
|
-
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars
|
912
|
-
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald:
|
913
|
-
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination;
|
914
|
-
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If
|
915
|
-
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more -->
|
916
|
-
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic
|
917
|
-
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better
|
918
|
-
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober
|
919
|
-
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how
|
920
|
-
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just
|
921
|
-
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going
|
922
|
-
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a
|
923
|
-
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron:
|
924
|
-
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to
|
925
|
-
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote
|
926
|
-
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-
|
927
|
-
|
945
|
+
ID Posted at Screen name Text
|
946
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
947
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
948
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
949
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
950
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
951
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
952
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
953
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
954
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
955
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
956
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober...
|
957
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
958
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
959
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
960
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
961
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
962
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
963
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
964
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
965
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
928
966
|
eos
|
929
967
|
end
|
930
968
|
end
|
@@ -932,32 +970,26 @@ ID Posted at Screen name Text
|
|
932
970
|
context "--number" do
|
933
971
|
before do
|
934
972
|
stub_get("/1.1/favorites/list.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
935
|
-
stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:body => fixture("
|
936
|
-
stub_get("/1.1/favorites/list.json").with(:query => {:count => "
|
937
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
938
|
-
stub_get("/1.1/favorites/list.json").with(:query => {:count => count, :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
939
|
-
end
|
973
|
+
stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
974
|
+
stub_get("/1.1/favorites/list.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
940
975
|
end
|
941
|
-
it "
|
976
|
+
it "limits the number of results to 1" do
|
942
977
|
@cli.options = @cli.options.merge("number" => 1)
|
943
978
|
@cli.favorites
|
944
979
|
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "1"})).to have_been_made
|
945
980
|
end
|
946
|
-
it "
|
947
|
-
@cli.options = @cli.options.merge("number" =>
|
981
|
+
it "limits the number of results to 201" do
|
982
|
+
@cli.options = @cli.options.merge("number" => 201)
|
948
983
|
@cli.favorites
|
949
984
|
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200"})).to have_been_made
|
950
|
-
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "
|
951
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
952
|
-
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => count, :max_id => "244099460672679937"})).to have_been_made
|
953
|
-
end
|
985
|
+
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "1", :max_id => "265500541700956160"})).to have_been_made
|
954
986
|
end
|
955
987
|
end
|
956
988
|
context "with a user passed" do
|
957
989
|
before do
|
958
990
|
stub_get("/1.1/favorites/list.json").with(:query => {:count => "20", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
959
991
|
end
|
960
|
-
it "
|
992
|
+
it "requests the correct resource" do
|
961
993
|
@cli.favorites("sferik")
|
962
994
|
expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "20", :screen_name => "sferik"})).to have_been_made
|
963
995
|
end
|
@@ -966,7 +998,7 @@ ID Posted at Screen name Text
|
|
966
998
|
@cli.options = @cli.options.merge("id" => true)
|
967
999
|
stub_get("/1.1/favorites/list.json").with(:query => {:user_id => "7505382", :count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
968
1000
|
end
|
969
|
-
it "
|
1001
|
+
it "requests the correct resource" do
|
970
1002
|
@cli.favorites("7505382")
|
971
1003
|
expect(a_get("/1.1/favorites/list.json").with(:query => {:user_id => "7505382", :count => "20"})).to have_been_made
|
972
1004
|
end
|
@@ -984,13 +1016,13 @@ ID Posted at Screen name Text
|
|
984
1016
|
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
985
1017
|
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
986
1018
|
end
|
987
|
-
it "
|
1019
|
+
it "requests the correct resource" do
|
988
1020
|
@cli.follow("sferik", "pengwynn")
|
989
1021
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
990
1022
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
|
991
1023
|
expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"})).to have_been_made
|
992
1024
|
end
|
993
|
-
it "
|
1025
|
+
it "has the correct output" do
|
994
1026
|
@cli.follow("sferik", "pengwynn")
|
995
1027
|
expect($stdout.string).to match /^@testcli is now following 1 more user\.$/
|
996
1028
|
end
|
@@ -1001,7 +1033,7 @@ ID Posted at Screen name Text
|
|
1001
1033
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1002
1034
|
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1003
1035
|
end
|
1004
|
-
it "
|
1036
|
+
it "requests the correct resource" do
|
1005
1037
|
@cli.follow("7505382", "14100886")
|
1006
1038
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1007
1039
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
|
@@ -1009,7 +1041,7 @@ ID Posted at Screen name Text
|
|
1009
1041
|
end
|
1010
1042
|
end
|
1011
1043
|
context "Twitter is down" do
|
1012
|
-
it "
|
1044
|
+
it "retries 3 times and then raise an error" do
|
1013
1045
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1014
1046
|
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1015
1047
|
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "14100886"}).to_return(:status => 502)
|
@@ -1029,12 +1061,12 @@ ID Posted at Screen name Text
|
|
1029
1061
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1030
1062
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1031
1063
|
end
|
1032
|
-
it "
|
1064
|
+
it "requests the correct resource" do
|
1033
1065
|
@cli.followings
|
1034
1066
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1035
1067
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
1036
1068
|
end
|
1037
|
-
it "
|
1069
|
+
it "has the correct output" do
|
1038
1070
|
@cli.followings
|
1039
1071
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1040
1072
|
end
|
@@ -1042,7 +1074,7 @@ ID Posted at Screen name Text
|
|
1042
1074
|
before do
|
1043
1075
|
@cli.options = @cli.options.merge("csv" => true)
|
1044
1076
|
end
|
1045
|
-
it "
|
1077
|
+
it "outputs in CSV format" do
|
1046
1078
|
@cli.followings
|
1047
1079
|
expect($stdout.string).to eq <<-eos
|
1048
1080
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
@@ -1055,7 +1087,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
1055
1087
|
before do
|
1056
1088
|
@cli.options = @cli.options.merge("long" => true)
|
1057
1089
|
end
|
1058
|
-
it "
|
1090
|
+
it "outputs in long format" do
|
1059
1091
|
@cli.followings
|
1060
1092
|
expect($stdout.string).to eq <<-eos
|
1061
1093
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
@@ -1068,7 +1100,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1068
1100
|
before do
|
1069
1101
|
@cli.options = @cli.options.merge("reverse" => true)
|
1070
1102
|
end
|
1071
|
-
it "
|
1103
|
+
it "reverses the order of the sort" do
|
1072
1104
|
@cli.followings
|
1073
1105
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1074
1106
|
end
|
@@ -1077,7 +1109,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1077
1109
|
before do
|
1078
1110
|
@cli.options = @cli.options.merge("sort" => "favorites")
|
1079
1111
|
end
|
1080
|
-
it "
|
1112
|
+
it "sorts by number of favorites" do
|
1081
1113
|
@cli.followings
|
1082
1114
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1083
1115
|
end
|
@@ -1086,7 +1118,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1086
1118
|
before do
|
1087
1119
|
@cli.options = @cli.options.merge("sort" => "followers")
|
1088
1120
|
end
|
1089
|
-
it "
|
1121
|
+
it "sorts by number of followers" do
|
1090
1122
|
@cli.followings
|
1091
1123
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1092
1124
|
end
|
@@ -1095,7 +1127,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1095
1127
|
before do
|
1096
1128
|
@cli.options = @cli.options.merge("sort" => "friends")
|
1097
1129
|
end
|
1098
|
-
it "
|
1130
|
+
it "sorts by number of friends" do
|
1099
1131
|
@cli.followings
|
1100
1132
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1101
1133
|
end
|
@@ -1104,7 +1136,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1104
1136
|
before do
|
1105
1137
|
@cli.options = @cli.options.merge("sort" => "listed")
|
1106
1138
|
end
|
1107
|
-
it "
|
1139
|
+
it "sorts by number of list memberships" do
|
1108
1140
|
@cli.followings
|
1109
1141
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1110
1142
|
end
|
@@ -1113,7 +1145,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1113
1145
|
before do
|
1114
1146
|
@cli.options = @cli.options.merge("sort" => "since")
|
1115
1147
|
end
|
1116
|
-
it "
|
1148
|
+
it "sorts by the time when Twitter acount was created" do
|
1117
1149
|
@cli.followings
|
1118
1150
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1119
1151
|
end
|
@@ -1122,7 +1154,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1122
1154
|
before do
|
1123
1155
|
@cli.options = @cli.options.merge("sort" => "tweets")
|
1124
1156
|
end
|
1125
|
-
it "
|
1157
|
+
it "sorts by number of Tweets" do
|
1126
1158
|
@cli.followings
|
1127
1159
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1128
1160
|
end
|
@@ -1131,7 +1163,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1131
1163
|
before do
|
1132
1164
|
@cli.options = @cli.options.merge("sort" => "tweeted")
|
1133
1165
|
end
|
1134
|
-
it "
|
1166
|
+
it "sorts by the time of the last Tweet" do
|
1135
1167
|
@cli.followings
|
1136
1168
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1137
1169
|
end
|
@@ -1140,7 +1172,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1140
1172
|
before do
|
1141
1173
|
@cli.options = @cli.options.merge("unsorted" => true)
|
1142
1174
|
end
|
1143
|
-
it "
|
1175
|
+
it "is not sorted" do
|
1144
1176
|
@cli.followings
|
1145
1177
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1146
1178
|
end
|
@@ -1149,7 +1181,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1149
1181
|
before do
|
1150
1182
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1151
1183
|
end
|
1152
|
-
it "
|
1184
|
+
it "requests the correct resource" do
|
1153
1185
|
@cli.followings("sferik")
|
1154
1186
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
1155
1187
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
@@ -1160,7 +1192,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1160
1192
|
@cli.options = @cli.options.merge("id" => true)
|
1161
1193
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1162
1194
|
end
|
1163
|
-
it "
|
1195
|
+
it "requests the correct resource" do
|
1164
1196
|
@cli.followings("7505382")
|
1165
1197
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
1166
1198
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
@@ -1173,12 +1205,12 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1173
1205
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1174
1206
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1175
1207
|
end
|
1176
|
-
it "
|
1208
|
+
it "requests the correct resource" do
|
1177
1209
|
@cli.followers
|
1178
1210
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1179
1211
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
1180
1212
|
end
|
1181
|
-
it "
|
1213
|
+
it "has the correct output" do
|
1182
1214
|
@cli.followers
|
1183
1215
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1184
1216
|
end
|
@@ -1186,7 +1218,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1186
1218
|
before do
|
1187
1219
|
@cli.options = @cli.options.merge("csv" => true)
|
1188
1220
|
end
|
1189
|
-
it "
|
1221
|
+
it "outputs in CSV format" do
|
1190
1222
|
@cli.followers
|
1191
1223
|
expect($stdout.string).to eq <<-eos
|
1192
1224
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
@@ -1199,7 +1231,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
1199
1231
|
before do
|
1200
1232
|
@cli.options = @cli.options.merge("long" => true)
|
1201
1233
|
end
|
1202
|
-
it "
|
1234
|
+
it "outputs in long format" do
|
1203
1235
|
@cli.followers
|
1204
1236
|
expect($stdout.string).to eq <<-eos
|
1205
1237
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
@@ -1212,7 +1244,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1212
1244
|
before do
|
1213
1245
|
@cli.options = @cli.options.merge("reverse" => true)
|
1214
1246
|
end
|
1215
|
-
it "
|
1247
|
+
it "reverses the order of the sort" do
|
1216
1248
|
@cli.followers
|
1217
1249
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1218
1250
|
end
|
@@ -1221,7 +1253,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1221
1253
|
before do
|
1222
1254
|
@cli.options = @cli.options.merge("sort" => "favorites")
|
1223
1255
|
end
|
1224
|
-
it "
|
1256
|
+
it "sorts by number of favorites" do
|
1225
1257
|
@cli.followers
|
1226
1258
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1227
1259
|
end
|
@@ -1230,7 +1262,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1230
1262
|
before do
|
1231
1263
|
@cli.options = @cli.options.merge("sort" => "followers")
|
1232
1264
|
end
|
1233
|
-
it "
|
1265
|
+
it "sorts by number of followers" do
|
1234
1266
|
@cli.followers
|
1235
1267
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1236
1268
|
end
|
@@ -1239,7 +1271,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1239
1271
|
before do
|
1240
1272
|
@cli.options = @cli.options.merge("sort" => "friends")
|
1241
1273
|
end
|
1242
|
-
it "
|
1274
|
+
it "sorts by number of friends" do
|
1243
1275
|
@cli.followers
|
1244
1276
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1245
1277
|
end
|
@@ -1248,7 +1280,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1248
1280
|
before do
|
1249
1281
|
@cli.options = @cli.options.merge("sort" => "listed")
|
1250
1282
|
end
|
1251
|
-
it "
|
1283
|
+
it "sorts by number of list memberships" do
|
1252
1284
|
@cli.followers
|
1253
1285
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1254
1286
|
end
|
@@ -1257,7 +1289,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1257
1289
|
before do
|
1258
1290
|
@cli.options = @cli.options.merge("sort" => "since")
|
1259
1291
|
end
|
1260
|
-
it "
|
1292
|
+
it "sorts by the time when Twitter acount was created" do
|
1261
1293
|
@cli.followers
|
1262
1294
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1263
1295
|
end
|
@@ -1266,7 +1298,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1266
1298
|
before do
|
1267
1299
|
@cli.options = @cli.options.merge("sort" => "tweets")
|
1268
1300
|
end
|
1269
|
-
it "
|
1301
|
+
it "sorts by number of Tweets" do
|
1270
1302
|
@cli.followers
|
1271
1303
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1272
1304
|
end
|
@@ -1275,7 +1307,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1275
1307
|
before do
|
1276
1308
|
@cli.options = @cli.options.merge("sort" => "tweeted")
|
1277
1309
|
end
|
1278
|
-
it "
|
1310
|
+
it "sorts by the time of the last Tweet" do
|
1279
1311
|
@cli.followers
|
1280
1312
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1281
1313
|
end
|
@@ -1284,7 +1316,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1284
1316
|
before do
|
1285
1317
|
@cli.options = @cli.options.merge("unsorted" => true)
|
1286
1318
|
end
|
1287
|
-
it "
|
1319
|
+
it "is not sorted" do
|
1288
1320
|
@cli.followers
|
1289
1321
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1290
1322
|
end
|
@@ -1294,7 +1326,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1294
1326
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1295
1327
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "213747670,428004849"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1296
1328
|
end
|
1297
|
-
it "
|
1329
|
+
it "requests the correct resource" do
|
1298
1330
|
@cli.followers("sferik")
|
1299
1331
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
1300
1332
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
@@ -1304,7 +1336,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1304
1336
|
@cli.options = @cli.options.merge("id" => true)
|
1305
1337
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1306
1338
|
end
|
1307
|
-
it "
|
1339
|
+
it "requests the correct resource" do
|
1308
1340
|
@cli.followers("7505382")
|
1309
1341
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
1310
1342
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
@@ -1319,13 +1351,13 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1319
1351
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1320
1352
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1321
1353
|
end
|
1322
|
-
it "
|
1354
|
+
it "requests the correct resource" do
|
1323
1355
|
@cli.friends
|
1324
1356
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1325
1357
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1326
1358
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
1327
1359
|
end
|
1328
|
-
it "
|
1360
|
+
it "has the correct output" do
|
1329
1361
|
@cli.friends
|
1330
1362
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1331
1363
|
end
|
@@ -1333,7 +1365,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1333
1365
|
before do
|
1334
1366
|
@cli.options = @cli.options.merge("csv" => true)
|
1335
1367
|
end
|
1336
|
-
it "
|
1368
|
+
it "outputs in CSV format" do
|
1337
1369
|
@cli.friends
|
1338
1370
|
expect($stdout.string).to eq <<-eos
|
1339
1371
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
@@ -1346,7 +1378,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
1346
1378
|
before do
|
1347
1379
|
@cli.options = @cli.options.merge("long" => true)
|
1348
1380
|
end
|
1349
|
-
it "
|
1381
|
+
it "outputs in long format" do
|
1350
1382
|
@cli.friends
|
1351
1383
|
expect($stdout.string).to eq <<-eos
|
1352
1384
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
@@ -1359,7 +1391,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1359
1391
|
before do
|
1360
1392
|
@cli.options = @cli.options.merge("reverse" => true)
|
1361
1393
|
end
|
1362
|
-
it "
|
1394
|
+
it "reverses the order of the sort" do
|
1363
1395
|
@cli.friends
|
1364
1396
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1365
1397
|
end
|
@@ -1368,7 +1400,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1368
1400
|
before do
|
1369
1401
|
@cli.options = @cli.options.merge("sort" => "favorites")
|
1370
1402
|
end
|
1371
|
-
it "
|
1403
|
+
it "sorts by number of favorites" do
|
1372
1404
|
@cli.friends
|
1373
1405
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1374
1406
|
end
|
@@ -1377,7 +1409,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1377
1409
|
before do
|
1378
1410
|
@cli.options = @cli.options.merge("sort" => "followers")
|
1379
1411
|
end
|
1380
|
-
it "
|
1412
|
+
it "sorts by number of followers" do
|
1381
1413
|
@cli.friends
|
1382
1414
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1383
1415
|
end
|
@@ -1386,7 +1418,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1386
1418
|
before do
|
1387
1419
|
@cli.options = @cli.options.merge("sort" => "friends")
|
1388
1420
|
end
|
1389
|
-
it "
|
1421
|
+
it "sorts by number of friends" do
|
1390
1422
|
@cli.friends
|
1391
1423
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1392
1424
|
end
|
@@ -1395,7 +1427,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1395
1427
|
before do
|
1396
1428
|
@cli.options = @cli.options.merge("sort" => "listed")
|
1397
1429
|
end
|
1398
|
-
it "
|
1430
|
+
it "sorts by number of list memberships" do
|
1399
1431
|
@cli.friends
|
1400
1432
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1401
1433
|
end
|
@@ -1404,7 +1436,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1404
1436
|
before do
|
1405
1437
|
@cli.options = @cli.options.merge("sort" => "since")
|
1406
1438
|
end
|
1407
|
-
it "
|
1439
|
+
it "sorts by the time when Twitter acount was created" do
|
1408
1440
|
@cli.friends
|
1409
1441
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1410
1442
|
end
|
@@ -1413,7 +1445,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1413
1445
|
before do
|
1414
1446
|
@cli.options = @cli.options.merge("sort" => "tweets")
|
1415
1447
|
end
|
1416
|
-
it "
|
1448
|
+
it "sorts by number of Tweets" do
|
1417
1449
|
@cli.friends
|
1418
1450
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1419
1451
|
end
|
@@ -1422,7 +1454,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1422
1454
|
before do
|
1423
1455
|
@cli.options = @cli.options.merge("sort" => "tweeted")
|
1424
1456
|
end
|
1425
|
-
it "
|
1457
|
+
it "sorts by the time of the last Tweet" do
|
1426
1458
|
@cli.friends
|
1427
1459
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1428
1460
|
end
|
@@ -1431,7 +1463,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1431
1463
|
before do
|
1432
1464
|
@cli.options = @cli.options.merge("unsorted" => true)
|
1433
1465
|
end
|
1434
|
-
it "
|
1466
|
+
it "is not sorted" do
|
1435
1467
|
@cli.friends
|
1436
1468
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1437
1469
|
end
|
@@ -1441,7 +1473,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1441
1473
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1442
1474
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1443
1475
|
end
|
1444
|
-
it "
|
1476
|
+
it "requests the correct resource" do
|
1445
1477
|
@cli.friends("sferik")
|
1446
1478
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
1447
1479
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
@@ -1453,7 +1485,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1453
1485
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1454
1486
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1455
1487
|
end
|
1456
|
-
it "
|
1488
|
+
it "requests the correct resource" do
|
1457
1489
|
@cli.friends("7505382")
|
1458
1490
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
1459
1491
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
@@ -1469,13 +1501,13 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1469
1501
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1470
1502
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1471
1503
|
end
|
1472
|
-
it "
|
1504
|
+
it "requests the correct resource" do
|
1473
1505
|
@cli.leaders
|
1474
1506
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1475
1507
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
|
1476
1508
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
1477
1509
|
end
|
1478
|
-
it "
|
1510
|
+
it "has the correct output" do
|
1479
1511
|
@cli.leaders
|
1480
1512
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1481
1513
|
end
|
@@ -1483,7 +1515,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1483
1515
|
before do
|
1484
1516
|
@cli.options = @cli.options.merge("csv" => true)
|
1485
1517
|
end
|
1486
|
-
it "
|
1518
|
+
it "outputs in CSV format" do
|
1487
1519
|
@cli.leaders
|
1488
1520
|
expect($stdout.string).to eq <<-eos
|
1489
1521
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
@@ -1496,7 +1528,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
1496
1528
|
before do
|
1497
1529
|
@cli.options = @cli.options.merge("long" => true)
|
1498
1530
|
end
|
1499
|
-
it "
|
1531
|
+
it "outputs in long format" do
|
1500
1532
|
@cli.leaders
|
1501
1533
|
expect($stdout.string).to eq <<-eos
|
1502
1534
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
@@ -1509,7 +1541,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1509
1541
|
before do
|
1510
1542
|
@cli.options = @cli.options.merge("reverse" => true)
|
1511
1543
|
end
|
1512
|
-
it "
|
1544
|
+
it "reverses the order of the sort" do
|
1513
1545
|
@cli.leaders
|
1514
1546
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1515
1547
|
end
|
@@ -1518,7 +1550,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1518
1550
|
before do
|
1519
1551
|
@cli.options = @cli.options.merge("sort" => "favorites")
|
1520
1552
|
end
|
1521
|
-
it "
|
1553
|
+
it "sorts by number of favorites" do
|
1522
1554
|
@cli.leaders
|
1523
1555
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1524
1556
|
end
|
@@ -1527,7 +1559,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1527
1559
|
before do
|
1528
1560
|
@cli.options = @cli.options.merge("sort" => "followers")
|
1529
1561
|
end
|
1530
|
-
it "
|
1562
|
+
it "sorts by number of followers" do
|
1531
1563
|
@cli.leaders
|
1532
1564
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1533
1565
|
end
|
@@ -1536,7 +1568,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1536
1568
|
before do
|
1537
1569
|
@cli.options = @cli.options.merge("sort" => "friends")
|
1538
1570
|
end
|
1539
|
-
it "
|
1571
|
+
it "sorts by number of friends" do
|
1540
1572
|
@cli.leaders
|
1541
1573
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1542
1574
|
end
|
@@ -1545,7 +1577,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1545
1577
|
before do
|
1546
1578
|
@cli.options = @cli.options.merge("sort" => "listed")
|
1547
1579
|
end
|
1548
|
-
it "
|
1580
|
+
it "sorts by number of list memberships" do
|
1549
1581
|
@cli.leaders
|
1550
1582
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1551
1583
|
end
|
@@ -1554,7 +1586,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1554
1586
|
before do
|
1555
1587
|
@cli.options = @cli.options.merge("sort" => "since")
|
1556
1588
|
end
|
1557
|
-
it "
|
1589
|
+
it "sorts by the time when Twitter acount was created" do
|
1558
1590
|
@cli.leaders
|
1559
1591
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
1560
1592
|
end
|
@@ -1563,7 +1595,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1563
1595
|
before do
|
1564
1596
|
@cli.options = @cli.options.merge("sort" => "tweets")
|
1565
1597
|
end
|
1566
|
-
it "
|
1598
|
+
it "sorts by number of Tweets" do
|
1567
1599
|
@cli.leaders
|
1568
1600
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1569
1601
|
end
|
@@ -1572,7 +1604,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1572
1604
|
before do
|
1573
1605
|
@cli.options = @cli.options.merge("sort" => "tweeted")
|
1574
1606
|
end
|
1575
|
-
it "
|
1607
|
+
it "sorts by the time of the last Tweet" do
|
1576
1608
|
@cli.leaders
|
1577
1609
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1578
1610
|
end
|
@@ -1581,7 +1613,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1581
1613
|
before do
|
1582
1614
|
@cli.options = @cli.options.merge("unsorted" => true)
|
1583
1615
|
end
|
1584
|
-
it "
|
1616
|
+
it "is not sorted" do
|
1585
1617
|
@cli.leaders
|
1586
1618
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
1587
1619
|
end
|
@@ -1591,7 +1623,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1591
1623
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1592
1624
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1593
1625
|
end
|
1594
|
-
it "
|
1626
|
+
it "requests the correct resource" do
|
1595
1627
|
@cli.leaders("sferik")
|
1596
1628
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
1597
1629
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
@@ -1603,7 +1635,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1603
1635
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1604
1636
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1605
1637
|
end
|
1606
|
-
it "
|
1638
|
+
it "requests the correct resource" do
|
1607
1639
|
@cli.leaders("7505382")
|
1608
1640
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
1609
1641
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
@@ -1617,11 +1649,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1617
1649
|
before do
|
1618
1650
|
stub_get("/1.1/lists/list.json").to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1619
1651
|
end
|
1620
|
-
it "
|
1652
|
+
it "requests the correct resource" do
|
1621
1653
|
@cli.lists
|
1622
1654
|
expect(a_get("/1.1/lists/list.json")).to have_been_made
|
1623
1655
|
end
|
1624
|
-
it "
|
1656
|
+
it "has the correct output" do
|
1625
1657
|
@cli.lists
|
1626
1658
|
expect($stdout.string.chomp).to eq "@pengwynn/rubyists @twitter/team @sferik/test"
|
1627
1659
|
end
|
@@ -1629,7 +1661,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1629
1661
|
before do
|
1630
1662
|
@cli.options = @cli.options.merge("csv" => true)
|
1631
1663
|
end
|
1632
|
-
it "
|
1664
|
+
it "outputs in CSV format" do
|
1633
1665
|
@cli.lists
|
1634
1666
|
expect($stdout.string).to eq <<-eos
|
1635
1667
|
ID,Created at,Screen name,Slug,Members,Subscribers,Mode,Description
|
@@ -1643,7 +1675,7 @@ ID,Created at,Screen name,Slug,Members,Subscribers,Mode,Description
|
|
1643
1675
|
before do
|
1644
1676
|
@cli.options = @cli.options.merge("long" => true)
|
1645
1677
|
end
|
1646
|
-
it "
|
1678
|
+
it "outputs in long format" do
|
1647
1679
|
@cli.lists
|
1648
1680
|
expect($stdout.string).to eq <<-eos
|
1649
1681
|
ID Created at Screen name Slug Members Subscribers Mode ...
|
@@ -1657,7 +1689,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1657
1689
|
before do
|
1658
1690
|
@cli.options = @cli.options.merge("reverse" => true)
|
1659
1691
|
end
|
1660
|
-
it "
|
1692
|
+
it "reverses the order of the sort" do
|
1661
1693
|
@cli.lists
|
1662
1694
|
expect($stdout.string.chomp).to eq "@sferik/test @twitter/team @pengwynn/rubyists"
|
1663
1695
|
end
|
@@ -1666,7 +1698,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1666
1698
|
before do
|
1667
1699
|
@cli.options = @cli.options.merge("sort" => "members")
|
1668
1700
|
end
|
1669
|
-
it "
|
1701
|
+
it "sorts by the time when Twitter acount was created" do
|
1670
1702
|
@cli.lists
|
1671
1703
|
expect($stdout.string.chomp).to eq "@sferik/test @pengwynn/rubyists @twitter/team"
|
1672
1704
|
end
|
@@ -1675,7 +1707,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1675
1707
|
before do
|
1676
1708
|
@cli.options = @cli.options.merge("sort" => "mode")
|
1677
1709
|
end
|
1678
|
-
it "
|
1710
|
+
it "sorts by the time when Twitter acount was created" do
|
1679
1711
|
@cli.lists
|
1680
1712
|
expect($stdout.string.chomp).to eq "@sferik/test @twitter/team @pengwynn/rubyists"
|
1681
1713
|
end
|
@@ -1684,7 +1716,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1684
1716
|
before do
|
1685
1717
|
@cli.options = @cli.options.merge("sort" => "posted")
|
1686
1718
|
end
|
1687
|
-
it "
|
1719
|
+
it "sorts by the time when Twitter acount was created" do
|
1688
1720
|
@cli.lists
|
1689
1721
|
expect($stdout.string.chomp).to eq "@twitter/team @pengwynn/rubyists @sferik/test"
|
1690
1722
|
end
|
@@ -1693,7 +1725,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1693
1725
|
before do
|
1694
1726
|
@cli.options = @cli.options.merge("sort" => "subscribers")
|
1695
1727
|
end
|
1696
|
-
it "
|
1728
|
+
it "sorts by the time when Twitter acount was created" do
|
1697
1729
|
@cli.lists
|
1698
1730
|
expect($stdout.string.chomp).to eq "@sferik/test @pengwynn/rubyists @twitter/team"
|
1699
1731
|
end
|
@@ -1702,7 +1734,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1702
1734
|
before do
|
1703
1735
|
@cli.options = @cli.options.merge("unsorted" => true)
|
1704
1736
|
end
|
1705
|
-
it "
|
1737
|
+
it "is not sorted" do
|
1706
1738
|
@cli.lists
|
1707
1739
|
expect($stdout.string.chomp).to eq "@pengwynn/rubyists @twitter/team @sferik/test"
|
1708
1740
|
end
|
@@ -1711,7 +1743,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1711
1743
|
before do
|
1712
1744
|
stub_get("/1.1/lists/list.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1713
1745
|
end
|
1714
|
-
it "
|
1746
|
+
it "requests the correct resource" do
|
1715
1747
|
@cli.lists("sferik")
|
1716
1748
|
expect(a_get("/1.1/lists/list.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
1717
1749
|
end
|
@@ -1720,7 +1752,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1720
1752
|
@cli.options = @cli.options.merge("id" => true)
|
1721
1753
|
stub_get("/1.1/lists/list.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1722
1754
|
end
|
1723
|
-
it "
|
1755
|
+
it "requests the correct resource" do
|
1724
1756
|
@cli.lists("7505382")
|
1725
1757
|
expect(a_get("/1.1/lists/list.json").with(:query => {:user_id => "7505382"})).to have_been_made
|
1726
1758
|
end
|
@@ -1732,11 +1764,11 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1732
1764
|
before do
|
1733
1765
|
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1734
1766
|
end
|
1735
|
-
it "
|
1767
|
+
it "requests the correct resource" do
|
1736
1768
|
@cli.mentions
|
1737
1769
|
expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "20"})).to have_been_made
|
1738
1770
|
end
|
1739
|
-
it "
|
1771
|
+
it "has the correct output" do
|
1740
1772
|
@cli.mentions
|
1741
1773
|
expect($stdout.string).to eq <<-eos
|
1742
1774
|
\e[1m\e[33m @mutgoff\e[0m
|
@@ -1820,11 +1852,11 @@ ID Created at Screen name Slug Members Subscribers Mode ...
|
|
1820
1852
|
before do
|
1821
1853
|
@cli.options = @cli.options.merge("csv" => true)
|
1822
1854
|
end
|
1823
|
-
it "
|
1855
|
+
it "outputs in CSV format" do
|
1824
1856
|
@cli.mentions
|
1825
1857
|
expect($stdout.string).to eq <<-eos
|
1826
1858
|
ID,Posted at,Screen name,Text
|
1827
|
-
|
1859
|
+
4611686018427387904,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
|
1828
1860
|
244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
|
1829
1861
|
244110336414859264,2012-09-07 16:30:14 +0000,pat_shaughnessy,"Something else to vote for: ""New Rails workshops to bring more women into the Boston software scene"" http://t.co/eNBuckHc /cc @bostonrb"
|
1830
1862
|
244109797308379136,2012-09-07 16:28:05 +0000,calebelston,Pushing the button to launch the site. http://t.co/qLoEn5jG
|
@@ -1851,60 +1883,60 @@ ID,Posted at,Screen name,Text
|
|
1851
1883
|
before do
|
1852
1884
|
@cli.options = @cli.options.merge("long" => true)
|
1853
1885
|
end
|
1854
|
-
it "
|
1886
|
+
it "outputs in long format" do
|
1855
1887
|
@cli.mentions
|
1856
1888
|
expect($stdout.string).to eq <<-eos
|
1857
|
-
ID
|
1858
|
-
|
1859
|
-
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-
|
1860
|
-
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote
|
1861
|
-
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to
|
1862
|
-
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron:
|
1863
|
-
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a
|
1864
|
-
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going
|
1865
|
-
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just
|
1866
|
-
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how
|
1867
|
-
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober
|
1868
|
-
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better
|
1869
|
-
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic
|
1870
|
-
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more -->
|
1871
|
-
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If
|
1872
|
-
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination;
|
1873
|
-
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald:
|
1874
|
-
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars
|
1875
|
-
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now
|
1876
|
-
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did
|
1877
|
-
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't
|
1889
|
+
ID Posted at Screen name Text
|
1890
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
1891
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
1892
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
1893
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
1894
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
1895
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
1896
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
1897
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
1898
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
1899
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober...
|
1900
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
1901
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
1902
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
1903
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
1904
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
1905
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
1906
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
1907
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
1908
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
1909
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
1878
1910
|
eos
|
1879
1911
|
end
|
1880
1912
|
context "--reverse" do
|
1881
1913
|
before do
|
1882
1914
|
@cli.options = @cli.options.merge("reverse" => true)
|
1883
1915
|
end
|
1884
|
-
it "
|
1916
|
+
it "reverses the order of the sort" do
|
1885
1917
|
@cli.mentions
|
1886
1918
|
expect($stdout.string).to eq <<-eos
|
1887
|
-
ID
|
1888
|
-
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't
|
1889
|
-
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did
|
1890
|
-
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now
|
1891
|
-
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars
|
1892
|
-
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald:
|
1893
|
-
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination;
|
1894
|
-
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If
|
1895
|
-
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more -->
|
1896
|
-
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic
|
1897
|
-
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better
|
1898
|
-
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober
|
1899
|
-
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how
|
1900
|
-
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just
|
1901
|
-
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going
|
1902
|
-
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a
|
1903
|
-
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron:
|
1904
|
-
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to
|
1905
|
-
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote
|
1906
|
-
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-
|
1907
|
-
|
1919
|
+
ID Posted at Screen name Text
|
1920
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
1921
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
1922
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
1923
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
1924
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
1925
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
1926
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
1927
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
1928
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
1929
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
1930
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober...
|
1931
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
1932
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
1933
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
1934
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
1935
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
1936
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
1937
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
1938
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
1939
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
1908
1940
|
eos
|
1909
1941
|
end
|
1910
1942
|
end
|
@@ -1912,25 +1944,19 @@ ID Posted at Screen name Text
|
|
1912
1944
|
context "--number" do
|
1913
1945
|
before do
|
1914
1946
|
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1915
|
-
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("
|
1916
|
-
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "
|
1917
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
1918
|
-
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1919
|
-
end
|
1947
|
+
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1948
|
+
stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1920
1949
|
end
|
1921
|
-
it "
|
1950
|
+
it "limits the number of results to 1" do
|
1922
1951
|
@cli.options = @cli.options.merge("number" => 1)
|
1923
1952
|
@cli.mentions
|
1924
1953
|
expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1"})).to have_been_made
|
1925
1954
|
end
|
1926
|
-
it "
|
1927
|
-
@cli.options = @cli.options.merge("number" =>
|
1955
|
+
it "limits the number of results to 201" do
|
1956
|
+
@cli.options = @cli.options.merge("number" => 201)
|
1928
1957
|
@cli.mentions
|
1929
1958
|
expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"})).to have_been_made
|
1930
|
-
expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "
|
1931
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
1932
|
-
expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"})).to have_been_made
|
1933
|
-
end
|
1959
|
+
expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"})).to have_been_made
|
1934
1960
|
end
|
1935
1961
|
end
|
1936
1962
|
end
|
@@ -1939,7 +1965,7 @@ ID Posted at Screen name Text
|
|
1939
1965
|
before do
|
1940
1966
|
@cli.options = @cli.options.merge("display-url" => true)
|
1941
1967
|
end
|
1942
|
-
it "
|
1968
|
+
it "has the correct output" do
|
1943
1969
|
expect do
|
1944
1970
|
@cli.open("sferik")
|
1945
1971
|
end.not_to raise_error
|
@@ -1949,7 +1975,7 @@ ID Posted at Screen name Text
|
|
1949
1975
|
@cli.options = @cli.options.merge("id" => true)
|
1950
1976
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "420"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1951
1977
|
end
|
1952
|
-
it "
|
1978
|
+
it "requests the correct resource" do
|
1953
1979
|
@cli.open("420")
|
1954
1980
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "420"})).to have_been_made
|
1955
1981
|
end
|
@@ -1959,11 +1985,11 @@ ID Posted at Screen name Text
|
|
1959
1985
|
@cli.options = @cli.options.merge("status" => true)
|
1960
1986
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1961
1987
|
end
|
1962
|
-
it "
|
1988
|
+
it "requests the correct resource" do
|
1963
1989
|
@cli.open("55709764298092545")
|
1964
1990
|
expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
|
1965
1991
|
end
|
1966
|
-
it "
|
1992
|
+
it "has the correct output" do
|
1967
1993
|
expect do
|
1968
1994
|
@cli.open("55709764298092545")
|
1969
1995
|
end.not_to raise_error
|
@@ -1974,36 +2000,37 @@ ID Posted at Screen name Text
|
|
1974
2000
|
describe "#reply" do
|
1975
2001
|
before do
|
1976
2002
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc", "location" => true)
|
1977
|
-
stub_get("/1.1/statuses/show/
|
1978
|
-
stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "
|
2003
|
+
stub_get("/1.1/statuses/show/263813522369159169.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_with_mention.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2004
|
+
stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1979
2005
|
stub_request(:get, "http://checkip.dyndns.org/").to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
|
1980
2006
|
stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").to_return(:body => fixture("geoplugin.xml"), :headers => {:content_type => "application/xml"})
|
1981
2007
|
end
|
1982
|
-
it "
|
1983
|
-
@cli.reply("
|
1984
|
-
expect(a_get("/1.1/statuses/show/
|
1985
|
-
expect(a_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "
|
2008
|
+
it "requests the correct resource" do
|
2009
|
+
@cli.reply("263813522369159169", "Testing")
|
2010
|
+
expect(a_get("/1.1/statuses/show/263813522369159169.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
|
2011
|
+
expect(a_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"})).to have_been_made
|
1986
2012
|
expect(a_request(:get, "http://checkip.dyndns.org/")).to have_been_made
|
1987
2013
|
expect(a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169")).to have_been_made
|
1988
2014
|
end
|
1989
|
-
it "
|
1990
|
-
@cli.reply("
|
1991
|
-
expect($stdout.string.split("\n").first).to eq "Reply posted by @testcli to @
|
2015
|
+
it "has the correct output" do
|
2016
|
+
@cli.reply("263813522369159169", "Testing")
|
2017
|
+
expect($stdout.string.split("\n").first).to eq "Reply posted by @testcli to @joshfrench."
|
1992
2018
|
end
|
1993
2019
|
context "--all" do
|
1994
2020
|
before do
|
1995
2021
|
@cli.options = @cli.options.merge("all" => true)
|
2022
|
+
stub_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench @sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
1996
2023
|
end
|
1997
|
-
it "
|
1998
|
-
@cli.reply("
|
1999
|
-
expect(a_get("/1.1/statuses/show/
|
2000
|
-
expect(a_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "
|
2024
|
+
it "requests the correct resource" do
|
2025
|
+
@cli.reply("263813522369159169", "Testing")
|
2026
|
+
expect(a_get("/1.1/statuses/show/263813522369159169.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
|
2027
|
+
expect(a_post("/1.1/statuses/update.json").with(:body => {:in_reply_to_status_id => "263813522369159169", :status => "@joshfrench @sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"})).to have_been_made
|
2001
2028
|
expect(a_request(:get, "http://checkip.dyndns.org/")).to have_been_made
|
2002
2029
|
expect(a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169")).to have_been_made
|
2003
2030
|
end
|
2004
|
-
it "
|
2005
|
-
@cli.reply("
|
2006
|
-
expect($stdout.string.split("\n").first).to eq "Reply posted by @testcli to @sferik."
|
2031
|
+
it "has the correct output" do
|
2032
|
+
@cli.reply("263813522369159169", "Testing")
|
2033
|
+
expect($stdout.string.split("\n").first).to eq "Reply posted by @testcli to @joshfrench @sferik."
|
2007
2034
|
end
|
2008
2035
|
end
|
2009
2036
|
end
|
@@ -2013,11 +2040,11 @@ ID Posted at Screen name Text
|
|
2013
2040
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
2014
2041
|
stub_post("/1.1/report_spam.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2015
2042
|
end
|
2016
|
-
it "
|
2043
|
+
it "requests the correct resource" do
|
2017
2044
|
@cli.report_spam("sferik")
|
2018
2045
|
expect(a_post("/1.1/report_spam.json").with(:body => {:screen_name => "sferik"})).to have_been_made
|
2019
2046
|
end
|
2020
|
-
it "
|
2047
|
+
it "has the correct output" do
|
2021
2048
|
@cli.report_spam("sferik")
|
2022
2049
|
expect($stdout.string).to match /^@testcli reported 1 user/
|
2023
2050
|
end
|
@@ -2026,7 +2053,7 @@ ID Posted at Screen name Text
|
|
2026
2053
|
@cli.options = @cli.options.merge("id" => true)
|
2027
2054
|
stub_post("/1.1/report_spam.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2028
2055
|
end
|
2029
|
-
it "
|
2056
|
+
it "requests the correct resource" do
|
2030
2057
|
@cli.report_spam("7505382")
|
2031
2058
|
expect(a_post("/1.1/report_spam.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
2032
2059
|
end
|
@@ -2038,11 +2065,11 @@ ID Posted at Screen name Text
|
|
2038
2065
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
2039
2066
|
stub_post("/1.1/statuses/retweet/26755176471724032.json").to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2040
2067
|
end
|
2041
|
-
it "
|
2068
|
+
it "requests the correct resource" do
|
2042
2069
|
@cli.retweet("26755176471724032")
|
2043
2070
|
expect(a_post("/1.1/statuses/retweet/26755176471724032.json")).to have_been_made
|
2044
2071
|
end
|
2045
|
-
it "
|
2072
|
+
it "has the correct output" do
|
2046
2073
|
@cli.retweet("26755176471724032")
|
2047
2074
|
expect($stdout.string).to match /^@testcli retweeted 1 tweet.$/
|
2048
2075
|
end
|
@@ -2054,12 +2081,12 @@ ID Posted at Screen name Text
|
|
2054
2081
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2055
2082
|
end
|
2056
2083
|
context "without arguments" do
|
2057
|
-
it "
|
2084
|
+
it "requests the correct resource" do
|
2058
2085
|
@cli.retweets
|
2059
2086
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
|
2060
2087
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"})).to have_been_made.times(3)
|
2061
2088
|
end
|
2062
|
-
it "
|
2089
|
+
it "has the correct output" do
|
2063
2090
|
@cli.retweets
|
2064
2091
|
expect($stdout.string).to eq <<-eos
|
2065
2092
|
\e[1m\e[33m @calebelston\e[0m
|
@@ -2149,7 +2176,7 @@ ID Posted at Screen name Text
|
|
2149
2176
|
before do
|
2150
2177
|
@cli.options = @cli.options.merge("csv" => true)
|
2151
2178
|
end
|
2152
|
-
it "
|
2179
|
+
it "outputs in CSV format" do
|
2153
2180
|
@cli.retweets
|
2154
2181
|
expect($stdout.string).to eq <<-eos
|
2155
2182
|
ID,Posted at,Screen name,Text
|
@@ -2180,7 +2207,7 @@ ID,Posted at,Screen name,Text
|
|
2180
2207
|
before do
|
2181
2208
|
@cli.options = @cli.options.merge("long" => true)
|
2182
2209
|
end
|
2183
|
-
it "
|
2210
|
+
it "outputs in long format" do
|
2184
2211
|
@cli.retweets
|
2185
2212
|
expect($stdout.string).to eq <<-eos
|
2186
2213
|
ID Posted at Screen name Text
|
@@ -2210,7 +2237,7 @@ ID Posted at Screen name Text
|
|
2210
2237
|
before do
|
2211
2238
|
@cli.options = @cli.options.merge("reverse" => true)
|
2212
2239
|
end
|
2213
|
-
it "
|
2240
|
+
it "reverses the order of the sort" do
|
2214
2241
|
@cli.retweets
|
2215
2242
|
expect($stdout.string).to eq <<-eos
|
2216
2243
|
ID Posted at Screen name Text
|
@@ -2243,13 +2270,13 @@ ID Posted at Screen name Text
|
|
2243
2270
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2244
2271
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2245
2272
|
end
|
2246
|
-
it "
|
2273
|
+
it "limits the number of results to 1" do
|
2247
2274
|
@cli.options = @cli.options.merge("number" => 1)
|
2248
2275
|
@cli.retweets
|
2249
2276
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
|
2250
2277
|
end
|
2251
|
-
it "
|
2252
|
-
@cli.options = @cli.options.merge("number" =>
|
2278
|
+
it "limits the number of results to 201" do
|
2279
|
+
@cli.options = @cli.options.merge("number" => 201)
|
2253
2280
|
@cli.retweets
|
2254
2281
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
|
2255
2282
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244107823733174271"})).to have_been_made
|
@@ -2260,7 +2287,7 @@ ID Posted at Screen name Text
|
|
2260
2287
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2261
2288
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2262
2289
|
end
|
2263
|
-
it "
|
2290
|
+
it "requests the correct resource" do
|
2264
2291
|
@cli.retweets("sferik")
|
2265
2292
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"})).to have_been_made
|
2266
2293
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"})).to have_been_made.times(3)
|
@@ -2271,7 +2298,7 @@ ID Posted at Screen name Text
|
|
2271
2298
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2272
2299
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2273
2300
|
end
|
2274
|
-
it "
|
2301
|
+
it "requests the correct resource" do
|
2275
2302
|
@cli.retweets("7505382")
|
2276
2303
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"})).to have_been_made
|
2277
2304
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"})).to have_been_made.times(3)
|
@@ -2281,7 +2308,7 @@ ID Posted at Screen name Text
|
|
2281
2308
|
end
|
2282
2309
|
|
2283
2310
|
describe "#ruler" do
|
2284
|
-
it "
|
2311
|
+
it "has the correct output" do
|
2285
2312
|
@cli.ruler
|
2286
2313
|
expect($stdout.string.chomp.size).to eq 140
|
2287
2314
|
expect($stdout.string.chomp).to eq "----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
|
@@ -2290,7 +2317,7 @@ ID Posted at Screen name Text
|
|
2290
2317
|
before do
|
2291
2318
|
@cli.options = @cli.options.merge("indent" => 2)
|
2292
2319
|
end
|
2293
|
-
it "
|
2320
|
+
it "has the correct output" do
|
2294
2321
|
@cli.ruler
|
2295
2322
|
expect($stdout.string.chomp.size).to eq 142
|
2296
2323
|
expect($stdout.string.chomp).to eq " ----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|"
|
@@ -2303,12 +2330,12 @@ ID Posted at Screen name Text
|
|
2303
2330
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2304
2331
|
stub_get("/i/statuses/55709764298092545/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2305
2332
|
end
|
2306
|
-
it "
|
2333
|
+
it "requests the correct resources" do
|
2307
2334
|
@cli.status("55709764298092545")
|
2308
2335
|
expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
|
2309
2336
|
expect(a_get("/i/statuses/55709764298092545/activity/summary.json")).to have_been_made
|
2310
2337
|
end
|
2311
|
-
it "
|
2338
|
+
it "has the correct output" do
|
2312
2339
|
@cli.status("55709764298092545")
|
2313
2340
|
expect($stdout.string).to eq <<-eos
|
2314
2341
|
ID 55709764298092545
|
@@ -2327,7 +2354,7 @@ URL https://twitter.com/sferik/status/55709764298092545
|
|
2327
2354
|
before do
|
2328
2355
|
@cli.options = @cli.options.merge("csv" => true)
|
2329
2356
|
end
|
2330
|
-
it "
|
2357
|
+
it "has the correct output" do
|
2331
2358
|
@cli.status("55709764298092545")
|
2332
2359
|
expect($stdout.string).to eq <<-eos
|
2333
2360
|
ID,Text,Screen name,Posted at,Location,Retweets,Favorites,Replies,Source,URL
|
@@ -2339,7 +2366,7 @@ ID,Text,Screen name,Posted at,Location,Retweets,Favorites,Replies,Source,URL
|
|
2339
2366
|
before do
|
2340
2367
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_street_address.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2341
2368
|
end
|
2342
|
-
it "
|
2369
|
+
it "has the correct output" do
|
2343
2370
|
@cli.status("55709764298092545")
|
2344
2371
|
expect($stdout.string).to eq <<-eos
|
2345
2372
|
ID 55709764298092550
|
@@ -2359,7 +2386,7 @@ URL https://twitter.com/sferik/status/55709764298092550
|
|
2359
2386
|
before do
|
2360
2387
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_locality.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2361
2388
|
end
|
2362
|
-
it "
|
2389
|
+
it "has the correct output" do
|
2363
2390
|
@cli.status("55709764298092545")
|
2364
2391
|
expect($stdout.string).to eq <<-eos
|
2365
2392
|
ID 55709764298092549
|
@@ -2379,7 +2406,7 @@ URL https://twitter.com/sferik/status/55709764298092549
|
|
2379
2406
|
before do
|
2380
2407
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_attributes.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2381
2408
|
end
|
2382
|
-
it "
|
2409
|
+
it "has the correct output" do
|
2383
2410
|
@cli.status("55709764298092545")
|
2384
2411
|
expect($stdout.string).to eq <<-eos
|
2385
2412
|
ID 55709764298092546
|
@@ -2399,7 +2426,7 @@ URL https://twitter.com/sferik/status/55709764298092546
|
|
2399
2426
|
before do
|
2400
2427
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_country.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2401
2428
|
end
|
2402
|
-
it "
|
2429
|
+
it "has the correct output" do
|
2403
2430
|
@cli.status("55709764298092545")
|
2404
2431
|
expect($stdout.string).to eq <<-eos
|
2405
2432
|
ID 55709764298092547
|
@@ -2419,7 +2446,7 @@ URL https://twitter.com/sferik/status/55709764298092547
|
|
2419
2446
|
before do
|
2420
2447
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_full_name.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2421
2448
|
end
|
2422
|
-
it "
|
2449
|
+
it "has the correct output" do
|
2423
2450
|
@cli.status("55709764298092545")
|
2424
2451
|
expect($stdout.string).to eq <<-eos
|
2425
2452
|
ID 55709764298092548
|
@@ -2435,6 +2462,69 @@ URL https://twitter.com/sferik/status/55709764298092548
|
|
2435
2462
|
eos
|
2436
2463
|
end
|
2437
2464
|
end
|
2465
|
+
context "with no place" do
|
2466
|
+
before do
|
2467
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2468
|
+
stub_request(:get, "http://maps.google.com/maps/geo").with(:query => hash_including({:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml"})).to_return(:body => fixture("geo.kml"), :headers => {:content_type => "text/xml; charset=UTF-8"})
|
2469
|
+
end
|
2470
|
+
it "has the correct output" do
|
2471
|
+
@cli.status("55709764298092545")
|
2472
|
+
expect($stdout.string).to eq <<-eos
|
2473
|
+
ID 55709764298092551
|
2474
|
+
Text The problem with your code is that it's doing exactly what you told it to do.
|
2475
|
+
Screen name @sferik
|
2476
|
+
Posted at Apr 6 2011 (8 months ago)
|
2477
|
+
Location San Francisco, CA, USA
|
2478
|
+
Retweets 320
|
2479
|
+
Favorites 2
|
2480
|
+
Replies 1
|
2481
|
+
Source Twitter for iPhone
|
2482
|
+
URL https://twitter.com/sferik/status/55709764298092551
|
2483
|
+
eos
|
2484
|
+
end
|
2485
|
+
context "with no city" do
|
2486
|
+
before do
|
2487
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2488
|
+
stub_request(:get, "http://maps.google.com/maps/geo").with(:query => hash_including({:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml"})).to_return(:body => fixture("geo_no_city.kml"), :headers => {:content_type => "text/xml; charset=UTF-8"})
|
2489
|
+
end
|
2490
|
+
it "has the correct output" do
|
2491
|
+
@cli.status("55709764298092545")
|
2492
|
+
expect($stdout.string).to eq <<-eos
|
2493
|
+
ID 55709764298092551
|
2494
|
+
Text The problem with your code is that it's doing exactly what you told it to do.
|
2495
|
+
Screen name @sferik
|
2496
|
+
Posted at Apr 6 2011 (8 months ago)
|
2497
|
+
Location CA, USA
|
2498
|
+
Retweets 320
|
2499
|
+
Favorites 2
|
2500
|
+
Replies 1
|
2501
|
+
Source Twitter for iPhone
|
2502
|
+
URL https://twitter.com/sferik/status/55709764298092551
|
2503
|
+
eos
|
2504
|
+
end
|
2505
|
+
end
|
2506
|
+
context "with no state" do
|
2507
|
+
before do
|
2508
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2509
|
+
stub_request(:get, "http://maps.google.com/maps/geo").with(:query => hash_including({:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml"})).to_return(:body => fixture("geo_no_state.kml"), :headers => {:content_type => "text/xml; charset=UTF-8"})
|
2510
|
+
end
|
2511
|
+
it "has the correct output" do
|
2512
|
+
@cli.status("55709764298092545")
|
2513
|
+
expect($stdout.string).to eq <<-eos
|
2514
|
+
ID 55709764298092551
|
2515
|
+
Text The problem with your code is that it's doing exactly what you told it to do.
|
2516
|
+
Screen name @sferik
|
2517
|
+
Posted at Apr 6 2011 (8 months ago)
|
2518
|
+
Location USA
|
2519
|
+
Retweets 320
|
2520
|
+
Favorites 2
|
2521
|
+
Replies 1
|
2522
|
+
Source Twitter for iPhone
|
2523
|
+
URL https://twitter.com/sferik/status/55709764298092551
|
2524
|
+
eos
|
2525
|
+
end
|
2526
|
+
end
|
2527
|
+
end
|
2438
2528
|
end
|
2439
2529
|
|
2440
2530
|
describe "#timeline" do
|
@@ -2442,11 +2532,11 @@ URL https://twitter.com/sferik/status/55709764298092548
|
|
2442
2532
|
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2443
2533
|
end
|
2444
2534
|
context "without user" do
|
2445
|
-
it "
|
2535
|
+
it "requests the correct resource" do
|
2446
2536
|
@cli.timeline
|
2447
2537
|
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20"})).to have_been_made
|
2448
2538
|
end
|
2449
|
-
it "
|
2539
|
+
it "has the correct output" do
|
2450
2540
|
@cli.timeline
|
2451
2541
|
expect($stdout.string).to eq <<-eos
|
2452
2542
|
\e[1m\e[33m @mutgoff\e[0m
|
@@ -2531,11 +2621,11 @@ URL https://twitter.com/sferik/status/55709764298092548
|
|
2531
2621
|
before do
|
2532
2622
|
@cli.options = @cli.options.merge("csv" => true)
|
2533
2623
|
end
|
2534
|
-
it "
|
2624
|
+
it "outputs in CSV format" do
|
2535
2625
|
@cli.timeline
|
2536
2626
|
expect($stdout.string).to eq <<-eos
|
2537
2627
|
ID,Posted at,Screen name,Text
|
2538
|
-
|
2628
|
+
4611686018427387904,2012-09-07 16:35:24 +0000,mutgoff,Happy Birthday @imdane. Watch out for those @rally pranksters!
|
2539
2629
|
244111183165157376,2012-09-07 16:33:36 +0000,ironicsans,"If you like good real-life stories, check out @NarrativelyNY's just-launched site http://t.co/wiUL07jE (and also visit http://t.co/ZoyQxqWA)"
|
2540
2630
|
244110336414859264,2012-09-07 16:30:14 +0000,pat_shaughnessy,"Something else to vote for: ""New Rails workshops to bring more women into the Boston software scene"" http://t.co/eNBuckHc /cc @bostonrb"
|
2541
2631
|
244109797308379136,2012-09-07 16:28:05 +0000,calebelston,Pushing the button to launch the site. http://t.co/qLoEn5jG
|
@@ -2558,64 +2648,84 @@ ID,Posted at,Screen name,Text
|
|
2558
2648
|
eos
|
2559
2649
|
end
|
2560
2650
|
end
|
2651
|
+
context "--exclude=replies" do
|
2652
|
+
before do
|
2653
|
+
@cli.options = @cli.options.merge("exclude" => "replies")
|
2654
|
+
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :exclude_replies => "true"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2655
|
+
end
|
2656
|
+
it "excludes replies" do
|
2657
|
+
@cli.timeline
|
2658
|
+
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :exclude_replies => "true"})).to have_been_made
|
2659
|
+
end
|
2660
|
+
end
|
2661
|
+
context "--exclude=retweets" do
|
2662
|
+
before do
|
2663
|
+
@cli.options = @cli.options.merge("exclude" => "retweets")
|
2664
|
+
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :include_rts => "false"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2665
|
+
end
|
2666
|
+
it "excludes retweets" do
|
2667
|
+
@cli.timeline
|
2668
|
+
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "20", :include_rts => "false"})).to have_been_made
|
2669
|
+
end
|
2670
|
+
end
|
2561
2671
|
context "--long" do
|
2562
2672
|
before do
|
2563
2673
|
@cli.options = @cli.options.merge("long" => true)
|
2564
2674
|
end
|
2565
|
-
it "
|
2675
|
+
it "outputs in long format" do
|
2566
2676
|
@cli.timeline
|
2567
2677
|
expect($stdout.string).to eq <<-eos
|
2568
|
-
ID
|
2569
|
-
|
2570
|
-
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-
|
2571
|
-
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote
|
2572
|
-
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to
|
2573
|
-
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron:
|
2574
|
-
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a
|
2575
|
-
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going
|
2576
|
-
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just
|
2577
|
-
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how
|
2578
|
-
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober
|
2579
|
-
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better
|
2580
|
-
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic
|
2581
|
-
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more -->
|
2582
|
-
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If
|
2583
|
-
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination;
|
2584
|
-
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald:
|
2585
|
-
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars
|
2586
|
-
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now
|
2587
|
-
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did
|
2588
|
-
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't
|
2678
|
+
ID Posted at Screen name Text
|
2679
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
2680
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
2681
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
2682
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
2683
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
2684
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
2685
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
2686
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
2687
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
2688
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober...
|
2689
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
2690
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
2691
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
2692
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
2693
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
2694
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
2695
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
2696
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
2697
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
2698
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
2589
2699
|
eos
|
2590
2700
|
end
|
2591
2701
|
context "--reverse" do
|
2592
2702
|
before do
|
2593
2703
|
@cli.options = @cli.options.merge("reverse" => true)
|
2594
2704
|
end
|
2595
|
-
it "
|
2705
|
+
it "reverses the order of the sort" do
|
2596
2706
|
@cli.timeline
|
2597
2707
|
expect($stdout.string).to eq <<-eos
|
2598
|
-
ID
|
2599
|
-
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't
|
2600
|
-
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did
|
2601
|
-
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now
|
2602
|
-
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars
|
2603
|
-
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald:
|
2604
|
-
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination;
|
2605
|
-
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If
|
2606
|
-
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more -->
|
2607
|
-
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic
|
2608
|
-
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better
|
2609
|
-
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober
|
2610
|
-
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how
|
2611
|
-
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just
|
2612
|
-
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going
|
2613
|
-
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a
|
2614
|
-
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron:
|
2615
|
-
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to
|
2616
|
-
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote
|
2617
|
-
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-
|
2618
|
-
|
2708
|
+
ID Posted at Screen name Text
|
2709
|
+
244099460672679938 Sep 7 07:47 @dwiskus Gentlemen, you can't fig...
|
2710
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did ...
|
2711
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now ...
|
2712
|
+
244102490646278146 Sep 7 07:59 @jasonfried The story of Mars Curios...
|
2713
|
+
244102729860009984 Sep 7 08:00 @dhh RT @ggreenwald: Democrat...
|
2714
|
+
244102741125890048 Sep 7 08:00 @eveningedition LDN—Obama's nomination; ...
|
2715
|
+
244102834398851073 Sep 7 08:00 @JEG2 RT @tenderlove: If corpo...
|
2716
|
+
244103057175113729 Sep 7 08:01 @BarackObama Donate $10 or more --> g...
|
2717
|
+
244104146997870594 Sep 7 08:05 @calebelston We just announced Mosaic...
|
2718
|
+
244104558433951744 Sep 7 08:07 @al3x RT @wcmaier: Better bank...
|
2719
|
+
244105599351148544 Sep 7 08:11 @FakeDorsey “Write drunk. Edit sober...
|
2720
|
+
244106476048764928 Sep 7 08:14 @mbostock If you are wondering how...
|
2721
|
+
244107236262170624 Sep 7 08:17 @fbjork RT @jondot: Just publish...
|
2722
|
+
244107823733174272 Sep 7 08:20 @codeforamerica RT @randomhacks: Going t...
|
2723
|
+
244107890632294400 Sep 7 08:20 @fivethirtyeight The Weatherman is Not a ...
|
2724
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosai...
|
2725
|
+
244109797308379136 Sep 7 08:28 @calebelston Pushing the button to la...
|
2726
|
+
244110336414859264 Sep 7 08:30 @pat_shaughnessy Something else to vote f...
|
2727
|
+
244111183165157376 Sep 7 08:33 @ironicsans If you like good real-li...
|
2728
|
+
4611686018427387904 Sep 7 08:35 @mutgoff Happy Birthday @imdane. ...
|
2619
2729
|
eos
|
2620
2730
|
end
|
2621
2731
|
end
|
@@ -2623,32 +2733,26 @@ ID Posted at Screen name Text
|
|
2623
2733
|
context "--number" do
|
2624
2734
|
before do
|
2625
2735
|
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2626
|
-
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("
|
2627
|
-
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "
|
2628
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
2629
|
-
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2630
|
-
end
|
2736
|
+
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2737
|
+
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2631
2738
|
end
|
2632
|
-
it "
|
2739
|
+
it "limits the number of results to 1" do
|
2633
2740
|
@cli.options = @cli.options.merge("number" => 1)
|
2634
2741
|
@cli.timeline
|
2635
2742
|
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1"})).to have_been_made
|
2636
2743
|
end
|
2637
|
-
it "
|
2638
|
-
@cli.options = @cli.options.merge("number" =>
|
2744
|
+
it "limits the number of results to 201" do
|
2745
|
+
@cli.options = @cli.options.merge("number" => 201)
|
2639
2746
|
@cli.timeline
|
2640
2747
|
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"})).to have_been_made
|
2641
|
-
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "
|
2642
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
2643
|
-
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => count, :max_id => "244099460672679937"})).to have_been_made
|
2644
|
-
end
|
2748
|
+
expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "1", :max_id => "265500541700956160"})).to have_been_made
|
2645
2749
|
end
|
2646
2750
|
end
|
2647
2751
|
context "with a user passed" do
|
2648
2752
|
before do
|
2649
2753
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2650
2754
|
end
|
2651
|
-
it "
|
2755
|
+
it "requests the correct resource" do
|
2652
2756
|
@cli.timeline("sferik")
|
2653
2757
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :screen_name => "sferik"})).to have_been_made
|
2654
2758
|
end
|
@@ -2657,7 +2761,7 @@ ID Posted at Screen name Text
|
|
2657
2761
|
@cli.options = @cli.options.merge("id" => true)
|
2658
2762
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2659
2763
|
end
|
2660
|
-
it "
|
2764
|
+
it "requests the correct resource" do
|
2661
2765
|
@cli.timeline("7505382")
|
2662
2766
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "20", :user_id => "7505382"})).to have_been_made
|
2663
2767
|
end
|
@@ -2665,25 +2769,19 @@ ID Posted at Screen name Text
|
|
2665
2769
|
context "--number" do
|
2666
2770
|
before do
|
2667
2771
|
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2668
|
-
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("
|
2669
|
-
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "
|
2670
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
2671
|
-
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => count, :screen_name => "sferik", :max_id => "244099460672679937"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2672
|
-
end
|
2772
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("200_statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2773
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik", :max_id => "265500541700956160"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2673
2774
|
end
|
2674
|
-
it "
|
2775
|
+
it "limits the number of results to 1" do
|
2675
2776
|
@cli.options = @cli.options.merge("number" => 1)
|
2676
2777
|
@cli.timeline("sferik")
|
2677
2778
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik"})).to have_been_made
|
2678
2779
|
end
|
2679
|
-
it "
|
2680
|
-
@cli.options = @cli.options.merge("number" =>
|
2780
|
+
it "limits the number of results to 201" do
|
2781
|
+
@cli.options = @cli.options.merge("number" => 201)
|
2681
2782
|
@cli.timeline("sferik")
|
2682
2783
|
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"})).to have_been_made
|
2683
|
-
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "
|
2684
|
-
(5..185).step(20).to_a.reverse.each do |count|
|
2685
|
-
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => count, :screen_name => "sferik", :max_id => "244099460672679937"})).to have_been_made
|
2686
|
-
end
|
2784
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "1", :screen_name => "sferik", :max_id => "265500541700956160"})).to have_been_made
|
2687
2785
|
end
|
2688
2786
|
end
|
2689
2787
|
end
|
@@ -2693,11 +2791,11 @@ ID Posted at Screen name Text
|
|
2693
2791
|
before do
|
2694
2792
|
stub_get("/1.1/trends/place.json").with(:query => {:id => "1"}).to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2695
2793
|
end
|
2696
|
-
it "
|
2794
|
+
it "requests the correct resource" do
|
2697
2795
|
@cli.trends
|
2698
2796
|
expect(a_get("/1.1/trends/place.json").with(:query => {:id => "1"})).to have_been_made
|
2699
2797
|
end
|
2700
|
-
it "
|
2798
|
+
it "has the correct output" do
|
2701
2799
|
@cli.trends
|
2702
2800
|
expect($stdout.string.chomp).to eq "#sevenwordsaftersex Walkman Allen Iverson"
|
2703
2801
|
end
|
@@ -2706,11 +2804,11 @@ ID Posted at Screen name Text
|
|
2706
2804
|
@cli.options = @cli.options.merge("exclude-hashtags" => true)
|
2707
2805
|
stub_get("/1.1/trends/place.json").with(:query => {:id => "1", :exclude => "hashtags"}).to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2708
2806
|
end
|
2709
|
-
it "
|
2807
|
+
it "requests the correct resource" do
|
2710
2808
|
@cli.trends
|
2711
2809
|
expect(a_get("/1.1/trends/place.json").with(:query => {:id => "1", :exclude => "hashtags"})).to have_been_made
|
2712
2810
|
end
|
2713
|
-
it "
|
2811
|
+
it "has the correct output" do
|
2714
2812
|
@cli.trends
|
2715
2813
|
expect($stdout.string.chomp).to eq "#sevenwordsaftersex Walkman Allen Iverson"
|
2716
2814
|
end
|
@@ -2719,11 +2817,11 @@ ID Posted at Screen name Text
|
|
2719
2817
|
before do
|
2720
2818
|
stub_get("/1.1/trends/place.json").with(:query => {:id => "2487956"}).to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2721
2819
|
end
|
2722
|
-
it "
|
2820
|
+
it "requests the correct resource" do
|
2723
2821
|
@cli.trends("2487956")
|
2724
2822
|
expect(a_get("/1.1/trends/place.json").with(:query => {:id => "2487956"})).to have_been_made
|
2725
2823
|
end
|
2726
|
-
it "
|
2824
|
+
it "has the correct output" do
|
2727
2825
|
@cli.trends("2487956")
|
2728
2826
|
expect($stdout.string.chomp).to eq "#sevenwordsaftersex Walkman Allen Iverson"
|
2729
2827
|
end
|
@@ -2734,11 +2832,11 @@ ID Posted at Screen name Text
|
|
2734
2832
|
before do
|
2735
2833
|
stub_get("/1.1/trends/available.json").to_return(:body => fixture("locations.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2736
2834
|
end
|
2737
|
-
it "
|
2835
|
+
it "requests the correct resource" do
|
2738
2836
|
@cli.trend_locations
|
2739
2837
|
expect(a_get("/1.1/trends/available.json")).to have_been_made
|
2740
2838
|
end
|
2741
|
-
it "
|
2839
|
+
it "has the correct output" do
|
2742
2840
|
@cli.trend_locations
|
2743
2841
|
expect($stdout.string.chomp).to eq "Boston New York San Francisco United States Worldwide"
|
2744
2842
|
end
|
@@ -2746,7 +2844,7 @@ ID Posted at Screen name Text
|
|
2746
2844
|
before do
|
2747
2845
|
@cli.options = @cli.options.merge("csv" => true)
|
2748
2846
|
end
|
2749
|
-
it "
|
2847
|
+
it "outputs in CSV format" do
|
2750
2848
|
@cli.trend_locations
|
2751
2849
|
expect($stdout.string.chomp).to eq <<-eos.chomp
|
2752
2850
|
WOEID,Parent ID,Type,Name,Country
|
@@ -2762,7 +2860,7 @@ WOEID,Parent ID,Type,Name,Country
|
|
2762
2860
|
before do
|
2763
2861
|
@cli.options = @cli.options.merge("long" => true)
|
2764
2862
|
end
|
2765
|
-
it "
|
2863
|
+
it "outputs in long format" do
|
2766
2864
|
@cli.trend_locations
|
2767
2865
|
expect($stdout.string.chomp).to eq <<-eos.chomp
|
2768
2866
|
WOEID Parent ID Type Name Country
|
@@ -2778,7 +2876,7 @@ WOEID Parent ID Type Name Country
|
|
2778
2876
|
before do
|
2779
2877
|
@cli.options = @cli.options.merge("reverse" => true)
|
2780
2878
|
end
|
2781
|
-
it "
|
2879
|
+
it "reverses the order of the sort" do
|
2782
2880
|
@cli.trend_locations
|
2783
2881
|
expect($stdout.string.chomp).to eq "Worldwide United States San Francisco New York Boston"
|
2784
2882
|
end
|
@@ -2787,7 +2885,7 @@ WOEID Parent ID Type Name Country
|
|
2787
2885
|
before do
|
2788
2886
|
@cli.options = @cli.options.merge("sort" => "country")
|
2789
2887
|
end
|
2790
|
-
it "
|
2888
|
+
it "sorts by number of favorites" do
|
2791
2889
|
@cli.trend_locations
|
2792
2890
|
expect($stdout.string.chomp).to eq "Worldwide New York Boston United States San Francisco"
|
2793
2891
|
end
|
@@ -2796,7 +2894,7 @@ WOEID Parent ID Type Name Country
|
|
2796
2894
|
before do
|
2797
2895
|
@cli.options = @cli.options.merge("sort" => "parent")
|
2798
2896
|
end
|
2799
|
-
it "
|
2897
|
+
it "sorts by number of favorites" do
|
2800
2898
|
@cli.trend_locations
|
2801
2899
|
expect($stdout.string.chomp).to eq "Boston Worldwide New York United States San Francisco"
|
2802
2900
|
end
|
@@ -2805,7 +2903,7 @@ WOEID Parent ID Type Name Country
|
|
2805
2903
|
before do
|
2806
2904
|
@cli.options = @cli.options.merge("sort" => "type")
|
2807
2905
|
end
|
2808
|
-
it "
|
2906
|
+
it "sorts by number of favorites" do
|
2809
2907
|
@cli.trend_locations
|
2810
2908
|
expect($stdout.string.chomp).to eq "United States Worldwide New York Boston San Francisco"
|
2811
2909
|
end
|
@@ -2814,7 +2912,7 @@ WOEID Parent ID Type Name Country
|
|
2814
2912
|
before do
|
2815
2913
|
@cli.options = @cli.options.merge("sort" => "woeid")
|
2816
2914
|
end
|
2817
|
-
it "
|
2915
|
+
it "sorts by number of favorites" do
|
2818
2916
|
@cli.trend_locations
|
2819
2917
|
expect($stdout.string.chomp).to eq "Worldwide Boston New York San Francisco United States"
|
2820
2918
|
end
|
@@ -2823,7 +2921,7 @@ WOEID Parent ID Type Name Country
|
|
2823
2921
|
before do
|
2824
2922
|
@cli.options = @cli.options.merge("unsorted" => true)
|
2825
2923
|
end
|
2826
|
-
it "
|
2924
|
+
it "is not sorted" do
|
2827
2925
|
@cli.trend_locations
|
2828
2926
|
expect($stdout.string.chomp).to eq "Boston Worldwide New York United States San Francisco"
|
2829
2927
|
end
|
@@ -2835,12 +2933,12 @@ WOEID Parent ID Type Name Country
|
|
2835
2933
|
@cli.options = @cli.options.merge("profile" => fixture_path + "/.trc")
|
2836
2934
|
end
|
2837
2935
|
context "one user" do
|
2838
|
-
it "
|
2936
|
+
it "requests the correct resource" do
|
2839
2937
|
stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2840
2938
|
@cli.unfollow("sferik")
|
2841
2939
|
expect(a_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made
|
2842
2940
|
end
|
2843
|
-
it "
|
2941
|
+
it "has the correct output" do
|
2844
2942
|
stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2845
2943
|
@cli.unfollow("sferik")
|
2846
2944
|
expect($stdout.string).to match /^@testcli is no longer following 1 user\.$/
|
@@ -2850,13 +2948,13 @@ WOEID Parent ID Type Name Country
|
|
2850
2948
|
@cli.options = @cli.options.merge("id" => true)
|
2851
2949
|
stub_post("/1.1/friendships/destroy.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2852
2950
|
end
|
2853
|
-
it "
|
2951
|
+
it "requests the correct resource" do
|
2854
2952
|
@cli.unfollow("7505382")
|
2855
2953
|
expect(a_post("/1.1/friendships/destroy.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
2856
2954
|
end
|
2857
2955
|
end
|
2858
2956
|
context "Twitter is down" do
|
2859
|
-
it "
|
2957
|
+
it "retries 3 times and then raise an error" do
|
2860
2958
|
stub_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:status => 502)
|
2861
2959
|
expect do
|
2862
2960
|
@cli.unfollow("sferik")
|
@@ -2874,13 +2972,13 @@ WOEID Parent ID Type Name Country
|
|
2874
2972
|
stub_request(:get, "http://checkip.dyndns.org/").to_return(:body => fixture("checkip.html"), :headers => {:content_type => "text/html"})
|
2875
2973
|
stub_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169").to_return(:body => fixture("geoplugin.xml"), :headers => {:content_type => "application/xml"})
|
2876
2974
|
end
|
2877
|
-
it "
|
2975
|
+
it "requests the correct resource" do
|
2878
2976
|
@cli.update("Testing")
|
2879
2977
|
expect(a_post("/1.1/statuses/update.json").with(:body => {:status => "Testing", :lat => "37.76969909668", :long => "-122.39330291748", :trim_user => "true"})).to have_been_made
|
2880
2978
|
expect(a_request(:get, "http://checkip.dyndns.org/")).to have_been_made
|
2881
2979
|
expect(a_request(:get, "http://www.geoplugin.net/xml.gp?ip=50.131.22.169")).to have_been_made
|
2882
2980
|
end
|
2883
|
-
it "
|
2981
|
+
it "has the correct output" do
|
2884
2982
|
@cli.update("Testing")
|
2885
2983
|
expect($stdout.string.split("\n").first).to eq "Tweet posted by @testcli."
|
2886
2984
|
end
|
@@ -2889,11 +2987,11 @@ WOEID Parent ID Type Name Country
|
|
2889
2987
|
@cli.options = @cli.options.merge("file" => fixture_path + "/long.png")
|
2890
2988
|
stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2891
2989
|
end
|
2892
|
-
it "
|
2990
|
+
it "requests the correct resource" do
|
2893
2991
|
@cli.update("Testing")
|
2894
2992
|
expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
|
2895
2993
|
end
|
2896
|
-
it "
|
2994
|
+
it "has the correct output" do
|
2897
2995
|
@cli.update("Testing")
|
2898
2996
|
expect($stdout.string.split("\n").first).to eq "Tweet posted by @testcli."
|
2899
2997
|
end
|
@@ -2904,11 +3002,11 @@ WOEID Parent ID Type Name Country
|
|
2904
3002
|
before do
|
2905
3003
|
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2906
3004
|
end
|
2907
|
-
it "
|
3005
|
+
it "requests the correct resource" do
|
2908
3006
|
@cli.users("sferik", "pengwynn")
|
2909
3007
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
|
2910
3008
|
end
|
2911
|
-
it "
|
3009
|
+
it "has the correct output" do
|
2912
3010
|
@cli.users("sferik", "pengwynn")
|
2913
3011
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
2914
3012
|
end
|
@@ -2916,7 +3014,7 @@ WOEID Parent ID Type Name Country
|
|
2916
3014
|
before do
|
2917
3015
|
@cli.options = @cli.options.merge("csv" => true)
|
2918
3016
|
end
|
2919
|
-
it "
|
3017
|
+
it "outputs in CSV format" do
|
2920
3018
|
@cli.users("sferik", "pengwynn")
|
2921
3019
|
expect($stdout.string).to eq <<-eos
|
2922
3020
|
ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
|
@@ -2929,7 +3027,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
|
|
2929
3027
|
before do
|
2930
3028
|
@cli.options = @cli.options.merge("long" => true)
|
2931
3029
|
end
|
2932
|
-
it "
|
3030
|
+
it "outputs in long format" do
|
2933
3031
|
@cli.users("sferik", "pengwynn")
|
2934
3032
|
expect($stdout.string).to eq <<-eos
|
2935
3033
|
ID Since Last tweeted at Tweets Favorites Listed Following...
|
@@ -2942,7 +3040,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2942
3040
|
before do
|
2943
3041
|
@cli.options = @cli.options.merge("reverse" => true)
|
2944
3042
|
end
|
2945
|
-
it "
|
3043
|
+
it "reverses the order of the sort" do
|
2946
3044
|
@cli.users("sferik", "pengwynn")
|
2947
3045
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
2948
3046
|
end
|
@@ -2951,7 +3049,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2951
3049
|
before do
|
2952
3050
|
@cli.options = @cli.options.merge("sort" => "favorites")
|
2953
3051
|
end
|
2954
|
-
it "
|
3052
|
+
it "sorts by number of favorites" do
|
2955
3053
|
@cli.users("sferik", "pengwynn")
|
2956
3054
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
2957
3055
|
end
|
@@ -2960,7 +3058,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2960
3058
|
before do
|
2961
3059
|
@cli.options = @cli.options.merge("sort" => "followers")
|
2962
3060
|
end
|
2963
|
-
it "
|
3061
|
+
it "sorts by number of followers" do
|
2964
3062
|
@cli.users("sferik", "pengwynn")
|
2965
3063
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
2966
3064
|
end
|
@@ -2969,7 +3067,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2969
3067
|
before do
|
2970
3068
|
@cli.options = @cli.options.merge("sort" => "friends")
|
2971
3069
|
end
|
2972
|
-
it "
|
3070
|
+
it "sorts by number of friends" do
|
2973
3071
|
@cli.users("sferik", "pengwynn")
|
2974
3072
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
2975
3073
|
end
|
@@ -2979,7 +3077,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2979
3077
|
@cli.options = @cli.options.merge("id" => true)
|
2980
3078
|
stub_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"}).to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2981
3079
|
end
|
2982
|
-
it "
|
3080
|
+
it "requests the correct resource" do
|
2983
3081
|
@cli.users("7505382", "14100886")
|
2984
3082
|
expect(a_post("/1.1/users/lookup.json").with(:body => {:user_id => "7505382,14100886"})).to have_been_made
|
2985
3083
|
end
|
@@ -2988,7 +3086,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2988
3086
|
before do
|
2989
3087
|
@cli.options = @cli.options.merge("sort" => "listed")
|
2990
3088
|
end
|
2991
|
-
it "
|
3089
|
+
it "sorts by number of list memberships" do
|
2992
3090
|
@cli.users("sferik", "pengwynn")
|
2993
3091
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
2994
3092
|
end
|
@@ -2997,7 +3095,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2997
3095
|
before do
|
2998
3096
|
@cli.options = @cli.options.merge("sort" => "since")
|
2999
3097
|
end
|
3000
|
-
it "
|
3098
|
+
it "sorts by the time when Twitter acount was created" do
|
3001
3099
|
@cli.users("sferik", "pengwynn")
|
3002
3100
|
expect($stdout.string.chomp).to eq "sferik pengwynn"
|
3003
3101
|
end
|
@@ -3006,7 +3104,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
3006
3104
|
before do
|
3007
3105
|
@cli.options = @cli.options.merge("sort" => "tweets")
|
3008
3106
|
end
|
3009
|
-
it "
|
3107
|
+
it "sorts by number of Tweets" do
|
3010
3108
|
@cli.users("sferik", "pengwynn")
|
3011
3109
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
3012
3110
|
end
|
@@ -3015,7 +3113,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
3015
3113
|
before do
|
3016
3114
|
@cli.options = @cli.options.merge("sort" => "tweeted")
|
3017
3115
|
end
|
3018
|
-
it "
|
3116
|
+
it "sorts by the time of the last Tweet" do
|
3019
3117
|
@cli.users("sferik", "pengwynn")
|
3020
3118
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
3021
3119
|
end
|
@@ -3024,7 +3122,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
3024
3122
|
before do
|
3025
3123
|
@cli.options = @cli.options.merge("unsorted" => true)
|
3026
3124
|
end
|
3027
|
-
it "
|
3125
|
+
it "is not sorted" do
|
3028
3126
|
@cli.users("sferik", "pengwynn")
|
3029
3127
|
expect($stdout.string.chomp).to eq "pengwynn sferik"
|
3030
3128
|
end
|
@@ -3032,7 +3130,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
3032
3130
|
end
|
3033
3131
|
|
3034
3132
|
describe "#version" do
|
3035
|
-
it "
|
3133
|
+
it "has the correct output" do
|
3036
3134
|
@cli.version
|
3037
3135
|
expect($stdout.string.chomp).to eq T::Version.to_s
|
3038
3136
|
end
|
@@ -3042,11 +3140,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
3042
3140
|
before do
|
3043
3141
|
stub_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
3044
3142
|
end
|
3045
|
-
it "
|
3143
|
+
it "requests the correct resource" do
|
3046
3144
|
@cli.whois("sferik")
|
3047
3145
|
expect(a_get("/1.1/users/show.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
3048
3146
|
end
|
3049
|
-
it "
|
3147
|
+
it "has the correct output" do
|
3050
3148
|
@cli.whois("sferik")
|
3051
3149
|
expect($stdout.string).to eq <<-eos
|
3052
3150
|
ID 7505382
|
@@ -3068,7 +3166,7 @@ URL https://github.com/sferik
|
|
3068
3166
|
before do
|
3069
3167
|
@cli.options = @cli.options.merge("csv" => true)
|
3070
3168
|
end
|
3071
|
-
it "
|
3169
|
+
it "has the correct output" do
|
3072
3170
|
@cli.whois("sferik")
|
3073
3171
|
expect($stdout.string).to eq <<-eos
|
3074
3172
|
ID,Verified,Name,Screen name,Bio,Location,Following,Last update,Lasted updated at,Since,Tweets,Favorites,Listed,Following,Followers,URL
|
@@ -3081,7 +3179,7 @@ ID,Verified,Name,Screen name,Bio,Location,Following,Last update,Lasted updated a
|
|
3081
3179
|
@cli.options = @cli.options.merge("id" => true)
|
3082
3180
|
stub_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
3083
3181
|
end
|
3084
|
-
it "
|
3182
|
+
it "requests the correct resource" do
|
3085
3183
|
@cli.whois("7505382")
|
3086
3184
|
expect(a_get("/1.1/users/show.json").with(:query => {:user_id => "7505382"})).to have_been_made
|
3087
3185
|
end
|