t 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21fe202b12086232bb16595821aa4ac6a0b91ce8
4
- data.tar.gz: f2039d17a4b7906bb14c374755a58ca335f2d50a
3
+ metadata.gz: a36794a31632b69bee475211d077c05789f18b46
4
+ data.tar.gz: 29e6d1355b9beaac16d45070dcbd0f6ad7f59063
5
5
  SHA512:
6
- metadata.gz: 4c03e3b542d43a71f756e74389c43ba5ed6e29f0f84631ea69ac341e4adf4b2ff53a8c082d3e458edff9310ea36fb805d404685c0289eaac8a688e6076df7ca6
7
- data.tar.gz: 2aaf61577aeba5a14e9471fa4ba0e175a7830a27cdf1f4a14233560f651de713eff8bb5135c41d6a6d861d86fc7542bd706843af282e4d436b7da42863145fc8
6
+ metadata.gz: 17032a375d4e948ee86e8dc8edb334e0a1432719a2c578f5f68c743b663c35e5766e6550f68ff04736f708cca0dff0457e634dcd3bfa3784e5f46b9c94cd812c
7
+ data.tar.gz: 34e246d704562a5f0cbda8eb889fcc0e7e193af0fb2754a619873c90fdb85c7af21c236b270782b0b9f9bb34c38e134e4ef9f81eab67e0bcc8269fe9f6d2152e
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2013 Erik Michaels-Ober
1
+ Copyright (c) 2011-2014 Erik Michaels-Ober
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -112,8 +112,11 @@ TASK` to get help for a specific command.
112
112
 
113
113
  **Note**: If your tweet includes special characters (e.g. `!`), make sure to
114
114
  wrap it in single quotes instead of double quotes, so those characters are not
115
- interpreted by your shell. (However, if you use single quotes, your Tweet
116
- obviously can't contain any apostrophes.)
115
+ interpreted by your shell.
116
+ If you use single quotes, your Tweet obviously can't contain any
117
+ apostrophes unless you prefix them with a backslash `\`:
118
+
119
+ t update 'I\'m tweeting from the command line. Isn\'t that special?'
117
120
 
118
121
  #### Retrieve detailed information about a Twitter user
119
122
  t whois @sferik
@@ -151,6 +154,9 @@ example, here's how to send a user a direct message only if they already follow
151
154
  #### List all your leaders (people you follow who don't follow you back)
152
155
  t leaders -l --sort=followers
153
156
 
157
+ #### Mute everyone you follow
158
+ t followings | xargs t mute
159
+
154
160
  #### Unfollow everyone you follow who doesn't follow you back
155
161
  t leaders | xargs t unfollow
156
162
 
@@ -301,7 +307,7 @@ If you are running t on a remote computer you can use the flag --display-uri dur
301
307
  t authorize --display-uri
302
308
 
303
309
  ## Copyright
304
- Copyright (c) 2011-2013 Erik Michaels-Ober. See [LICENSE][] for details.
310
+ Copyright (c) 2011-2014 Erik Michaels-Ober. See [LICENSE][] for details.
305
311
  Application icon by [@nvk][nvk].
306
312
 
307
313
  [license]: https://github.com/sferik/t/blob/master/LICENSE.md
data/bin/t CHANGED
@@ -36,7 +36,7 @@ rescue Twitter::Error::Forbidden, Twitter::Error::Unauthorized => error
36
36
  require 'thor'
37
37
  Thor::Shell::Basic.new.ask 'Press [Enter] to open the Twitter Developer site.'
38
38
  require 'launchy'
39
- Launchy.open('https://dev.twitter.com/apps') { |u, o, e| $stderr.puts "Manually open #{u}" }
39
+ Launchy.open('https://dev.twitter.com/apps') { |u, _, _| $stderr.puts "Manually open #{u}" }
40
40
  else
41
41
  pute error.message
42
42
  end
data/lib/t/cli.rb CHANGED
@@ -44,7 +44,7 @@ module T
44
44
  @rcfile.profiles.each do |profile|
45
45
  say profile[0]
46
46
  profile[1].keys.each do |key|
47
- say " #{key}#{@rcfile.active_profile[0] == profile[0] && @rcfile.active_profile[1] == key ? " (active)" : nil}"
47
+ say " #{key}#{@rcfile.active_profile[0] == profile[0] && @rcfile.active_profile[1] == key ? ' (active)' : nil}"
48
48
  end
49
49
  end
50
50
  end
@@ -413,10 +413,10 @@ module T
413
413
  end
414
414
  follower_ids = Thread.new { client.follower_ids(user).to_a }
415
415
  following_ids = Thread.new { client.friend_ids(user).to_a }
416
- disciple_ids = (follower_ids.value - following_ids.value)
416
+ groupie_ids = (follower_ids.value - following_ids.value)
417
417
  require 'retryable'
418
418
  users = retryable(:tries => 3, :on => Twitter::Error, :sleep => 0) do
419
- client.users(disciple_ids)
419
+ client.users(groupie_ids)
420
420
  end
421
421
  print_users(users)
422
422
  end
@@ -525,6 +525,17 @@ module T
525
525
  end
526
526
  map %w[replies] => :mentions
527
527
 
528
+ desc 'mute USER [USER...]', 'Mute users.'
529
+ method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify input as Twitter user IDs instead of screen names.'
530
+ def mute(user, *users)
531
+ muted_users, number = fetch_users(users.unshift(user), options) do |users_to_mute|
532
+ client.mute(users_to_mute)
533
+ end
534
+ say "@#{@rcfile.active_profile[0]} muted #{pluralize(number, 'user')}."
535
+ say
536
+ say "Run `#{File.basename($PROGRAM_NAME)} delete mute #{muted_users.collect { |muted_user| "@#{muted_user.screen_name}" }.join(' ')}` to unmute."
537
+ end
538
+
528
539
  desc 'open USER', "Opens that user's profile in a web browser."
529
540
  method_option 'display-uri', :aliases => '-d', :type => :boolean, :desc => 'Display the requested URL instead of attempting to open it.'
530
541
  method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify user via ID instead of screen name.'
@@ -543,6 +554,27 @@ module T
543
554
  end
544
555
  end
545
556
 
557
+ desc 'reach TWEET_ID', 'Shows the maximum number of people who may have seen the specified tweet in their timeline.'
558
+ def reach(tweet_id)
559
+ require 't/core_ext/string'
560
+ require 'set'
561
+ status_thread = Thread.new { client.status(tweet_id.to_i, :include_my_retweet => false) }
562
+ threads = []
563
+ client.retweeters_ids(tweet_id.to_i).each do |retweeter_id|
564
+ threads << Thread.new(retweeter_id) do |user_id|
565
+ client.follower_ids(user_id).to_a
566
+ end
567
+ end
568
+ status = status_thread.value
569
+ threads << Thread.new(status.user.id) do |user_id|
570
+ client.follower_ids(user_id).to_a
571
+ end
572
+ reach = ::Set.new
573
+ threads.each { |thread| reach += thread.value }
574
+ reach.delete(status.user.id)
575
+ say number_with_delimiter(reach.size)
576
+ end
577
+
546
578
  desc 'reply TWEET_ID MESSAGE', 'Post your Tweet as a reply directed at another person.'
547
579
  method_option 'all', :aliases => '-a', :type => :boolean, :desc => 'Reply to all users mentioned in the Tweet.'
548
580
  method_option 'location', :aliases => '-l', :type => :string, :default => nil, :desc => "Add location information. If the optional 'latitude,longitude' parameter is not supplied, looks up location by IP address."
@@ -585,7 +617,7 @@ module T
585
617
  number = retweets.length
586
618
  say "@#{@rcfile.active_profile[0]} retweeted #{pluralize(number, 'tweet')}."
587
619
  say
588
- say "Run `#{File.basename($PROGRAM_NAME)} delete status #{retweets.collect { |tweet| tweet.retweeted_status.id }.join(' ')}` to undo."
620
+ say "Run `#{File.basename($PROGRAM_NAME)} delete status #{retweets.collect(&:id).join(' ')}` to undo."
589
621
  end
590
622
  map %w[rt] => :retweet
591
623
 
@@ -619,12 +651,11 @@ module T
619
651
  desc 'retweets_of_me', "Returns the #{DEFAULT_NUM_RESULTS} most recent Tweets of the authenticated user that have been retweeted by others."
620
652
  method_option 'csv', :aliases => '-c', :type => :boolean, :desc => 'Output in CSV format.'
621
653
  method_option 'decode_uris', :aliases => '-d', :type => :boolean, :desc => 'Decodes t.co URLs into their original form.'
622
- method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify user via ID instead of screen name.'
623
654
  method_option 'long', :aliases => '-l', :type => :boolean, :desc => 'Output in long format.'
624
655
  method_option 'number', :aliases => '-n', :type => :numeric, :default => DEFAULT_NUM_RESULTS, :desc => 'Limit the number of results.'
625
656
  method_option 'relative_dates', :aliases => '-a', :type => :boolean, :desc => 'Show relative dates.'
626
657
  method_option 'reverse', :aliases => '-r', :type => :boolean, :desc => 'Reverse the order of the sort.'
627
- def retweets_of_me(user = nil)
658
+ def retweets_of_me
628
659
  count = options['number'] || DEFAULT_NUM_RESULTS
629
660
  opts = {}
630
661
  opts[:include_entities] = !!options['decode_uris']
@@ -850,7 +881,7 @@ module T
850
881
  array << ['Since', "#{ls_formatted_time(user, :created_at, false)} (#{time_ago_in_words(user.created_at)} ago)"]
851
882
  array << ['Last update', "#{decode_full_text(user.status, options['decode_uris']).gsub(/\n+/, ' ')} (#{time_ago_in_words(user.status.created_at)} ago)"] unless user.status.nil?
852
883
  array << ['Screen name', "@#{user.screen_name}"]
853
- array << [user.verified ? 'Name (Verified)' : 'Name', user.name] unless user.name.nil? # rubocop:disable BlockNesting
884
+ array << [user.verified? ? 'Name (Verified)' : 'Name', user.name] unless user.name.nil? # rubocop:disable BlockNesting
854
885
  array << ['Tweets', number_with_delimiter(user.statuses_count)]
855
886
  array << ['Favorites', number_with_delimiter(user.favorites_count)]
856
887
  array << ['Listed', number_with_delimiter(user.listed_count)]
@@ -902,7 +933,7 @@ module T
902
933
 
903
934
  return [] if text !~ at_signs
904
935
 
905
- text.to_s.scan(valid_mentions).collect do |before, at, screen_name|
936
+ text.to_s.scan(valid_mentions).collect do |_, _, screen_name|
906
937
  screen_name
907
938
  end
908
939
  end
data/lib/t/collectable.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  require 'twitter'
2
2
  require 'retryable'
3
+ require 'set'
3
4
 
4
5
  module T
5
6
  module Collectable
6
7
  MAX_NUM_RESULTS = 200
8
+ MAX_PAGE = 51
7
9
 
8
10
  def collect_with_max_id(collection = [], max_id = nil, &block)
9
11
  tweets = retryable(:tries => 3, :on => Twitter::Error, :sleep => 0) do
@@ -28,13 +30,13 @@ module T
28
30
  end.flatten.compact
29
31
  end
30
32
 
31
- def collect_with_page(collection = [], page = 1, &block)
33
+ def collect_with_page(collection = ::Set.new, page = 1, previous = nil, &block) # rubocop:disable ParameterLists
32
34
  tweets = retryable(:tries => 3, :on => Twitter::Error, :sleep => 0) do
33
- yield page
35
+ block.call(page)
34
36
  end
35
- return collection if tweets.nil?
37
+ return collection if tweets.nil? || tweets == previous || page >= MAX_PAGE
36
38
  collection += tweets
37
- tweets.empty? ? collection.flatten.uniq : collect_with_page(collection, page + 1, &block)
39
+ tweets.empty? ? collection.flatten : collect_with_page(collection, page + 1, tweets, &block)
38
40
  end
39
41
  end
40
42
  end
@@ -7,7 +7,7 @@ module Kernel
7
7
  Integer(arg, base)
8
8
  end
9
9
 
10
- def NilClass(arg) # rubocop:disable MethodName
10
+ def NilClass(_) # rubocop:disable MethodName
11
11
  nil
12
12
  end
13
13
  end
data/lib/t/delete.rb CHANGED
@@ -88,6 +88,18 @@ module T
88
88
  say "@#{@rcfile.active_profile[0]} deleted the list \"#{list.name}\"."
89
89
  end
90
90
 
91
+ desc 'mute USER [USER...]', 'Unmute users.'
92
+ method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify input as Twitter user IDs instead of screen names.'
93
+ method_option 'force', :aliases => '-f', :type => :boolean
94
+ def mute(user, *users)
95
+ unmuted_users, number = fetch_users(users.unshift(user), options) do |users_to_unmute|
96
+ client.unmute(users_to_unmute)
97
+ end
98
+ say "@#{@rcfile.active_profile[0]} unmuted #{pluralize(number, 'user')}."
99
+ say
100
+ say "Run `#{File.basename($PROGRAM_NAME)} mute #{unmuted_users.collect { |unmuted_user| "@#{unmuted_user.screen_name}" }.join(' ')}` to mute."
101
+ end
102
+
91
103
  desc 'status TWEET_ID [TWEET_ID...]', 'Delete Tweets.'
92
104
  method_option 'force', :aliases => '-f', :type => :boolean
93
105
  def status(status_id, *status_ids)
data/lib/t/list.rb CHANGED
@@ -67,7 +67,7 @@ module T
67
67
  array << ['Created at', "#{ls_formatted_time(list, :created_at, false)} (#{time_ago_in_words(list.created_at)} ago)"]
68
68
  array << ['Members', number_with_delimiter(list.member_count)]
69
69
  array << ['Subscribers', number_with_delimiter(list.subscriber_count)]
70
- array << ['Status', list.following ? 'Following' : 'Not following']
70
+ array << ['Status', list.following? ? 'Following' : 'Not following']
71
71
  array << ['Mode', list.mode]
72
72
  array << ['URL', list.uri]
73
73
  print_table(array)
data/lib/t/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module T
2
2
  class Version
3
3
  MAJOR = 2
4
- MINOR = 5
4
+ MINOR = 6
5
5
  PATCH = 0
6
6
  PRE = nil
7
7
 
data/spec/cli_spec.rb CHANGED
@@ -47,19 +47,14 @@ testcli
47
47
  @cli.options = @cli.options.merge('profile' => project_path + '/tmp/authorize', 'display-uri' => true)
48
48
  stub_post('/oauth/request_token').to_return(:body => fixture('request_token'))
49
49
  stub_post('/oauth/access_token').to_return(:body => fixture('access_token'))
50
- stub_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'}).to_return(:body => fixture('sferik.json'))
50
+ 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'})
51
51
  end
52
52
  it 'requests the correct resource' do
53
- expect($stdout).to receive(:print)
54
- expect($stdin).to receive(:gets).and_return("\n")
55
- expect($stdout).to receive(:print).with('Enter your API key: ')
56
- expect($stdin).to receive(:gets).and_return('abc123')
57
- expect($stdout).to receive(:print).with('Enter your API secret: ')
58
- expect($stdin).to receive(:gets).and_return('asdfasd223sd2')
59
- expect($stdout).to receive(:print).with('Press [Enter] to open the Twitter app authorization page. ')
60
- expect($stdin).to receive(:gets).and_return("\n")
61
- expect($stdout).to receive(:print).with('Enter the supplied PIN: ')
62
- expect($stdin).to receive(:gets).and_return('1234567890')
53
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter Developer site. ', true).and_return("\n")
54
+ expect(Readline).to receive(:readline).with('Enter your API key: ', true).and_return('abc123')
55
+ expect(Readline).to receive(:readline).with('Enter your API secret: ', true).and_return('asdfasd223sd2')
56
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter app authorization page. ', true).and_return("\n")
57
+ expect(Readline).to receive(:readline).with('Enter the supplied PIN: ', true).and_return('1234567890')
63
58
  @cli.authorize
64
59
  expect(a_post('/oauth/request_token')).to have_been_made
65
60
  expect(a_post('/oauth/access_token')).to have_been_made
@@ -67,16 +62,11 @@ testcli
67
62
  end
68
63
  it 'does not raise error' do
69
64
  expect do
70
- expect($stdout).to receive(:print)
71
- expect($stdin).to receive(:gets).and_return("\n")
72
- expect($stdout).to receive(:print).with('Enter your API key: ')
73
- expect($stdin).to receive(:gets).and_return('abc123')
74
- expect($stdout).to receive(:print).with('Enter your API secret: ')
75
- expect($stdin).to receive(:gets).and_return('asdfasd223sd2')
76
- expect($stdout).to receive(:print).with('Press [Enter] to open the Twitter app authorization page. ')
77
- expect($stdin).to receive(:gets).and_return("\n")
78
- expect($stdout).to receive(:print).with('Enter the supplied PIN: ')
79
- expect($stdin).to receive(:gets).and_return('1234567890')
65
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter Developer site. ', true).and_return("\n")
66
+ expect(Readline).to receive(:readline).with('Enter your API key: ', true).and_return('abc123')
67
+ expect(Readline).to receive(:readline).with('Enter your API secret: ', true).and_return('asdfasd223sd2')
68
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter app authorization page. ', true).and_return("\n")
69
+ expect(Readline).to receive(:readline).with('Enter the supplied PIN: ', true).and_return('1234567890')
80
70
  @cli.authorize
81
71
  end.not_to raise_error
82
72
  end
@@ -88,16 +78,11 @@ testcli
88
78
  File.delete(project_path + '/tmp/empty')
89
79
  end
90
80
  it 'requests the correct resource' do
91
- expect($stdout).to receive(:print)
92
- expect($stdin).to receive(:gets).and_return("\n")
93
- expect($stdout).to receive(:print).with('Enter your API key: ')
94
- expect($stdin).to receive(:gets).and_return('abc123')
95
- expect($stdout).to receive(:print).with('Enter your API secret: ')
96
- expect($stdin).to receive(:gets).and_return('asdfasd223sd2')
97
- expect($stdout).to receive(:print).with('Press [Enter] to open the Twitter app authorization page. ')
98
- expect($stdin).to receive(:gets).and_return("\n")
99
- expect($stdout).to receive(:print).with('Enter the supplied PIN: ')
100
- expect($stdin).to receive(:gets).and_return('1234567890')
81
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter Developer site. ', true).and_return("\n")
82
+ expect(Readline).to receive(:readline).with('Enter your API key: ', true).and_return('abc123')
83
+ expect(Readline).to receive(:readline).with('Enter your API secret: ', true).and_return('asdfasd223sd2')
84
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter app authorization page. ', true).and_return("\n")
85
+ expect(Readline).to receive(:readline).with('Enter the supplied PIN: ', true).and_return('1234567890')
101
86
  @cli.authorize
102
87
  expect(a_post('/oauth/request_token')).to have_been_made
103
88
  expect(a_post('/oauth/access_token')).to have_been_made
@@ -105,16 +90,11 @@ testcli
105
90
  end
106
91
  it 'does not raise error' do
107
92
  expect do
108
- expect($stdout).to receive(:print)
109
- expect($stdin).to receive(:gets).and_return("\n")
110
- expect($stdout).to receive(:print).with('Enter your API key: ')
111
- expect($stdin).to receive(:gets).and_return('abc123')
112
- expect($stdout).to receive(:print).with('Enter your API secret: ')
113
- expect($stdin).to receive(:gets).and_return('asdfasd223sd2')
114
- expect($stdout).to receive(:print).with('Press [Enter] to open the Twitter app authorization page. ')
115
- expect($stdin).to receive(:gets).and_return("\n")
116
- expect($stdout).to receive(:print).with('Enter the supplied PIN: ')
117
- expect($stdin).to receive(:gets).and_return('1234567890')
93
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter Developer site. ', true).and_return("\n")
94
+ expect(Readline).to receive(:readline).with('Enter your API key: ', true).and_return('abc123')
95
+ expect(Readline).to receive(:readline).with('Enter your API secret: ', true).and_return('asdfasd223sd2')
96
+ expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter app authorization page. ', true).and_return("\n")
97
+ expect(Readline).to receive(:readline).with('Enter the supplied PIN: ', true).and_return('1234567890')
118
98
  @cli.authorize
119
99
  end.not_to raise_error
120
100
  end
@@ -124,7 +104,7 @@ testcli
124
104
  describe '#block' do
125
105
  before do
126
106
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
127
- stub_post('/1.1/blocks/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
107
+ 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'})
128
108
  end
129
109
  it 'requests the correct resource' do
130
110
  @cli.block('sferik')
@@ -137,7 +117,7 @@ testcli
137
117
  context '--id' do
138
118
  before do
139
119
  @cli.options = @cli.options.merge('id' => true)
140
- stub_post('/1.1/blocks/create.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'))
120
+ 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'})
141
121
  end
142
122
  it 'requests the correct resource' do
143
123
  @cli.block('7505382')
@@ -148,8 +128,8 @@ testcli
148
128
 
149
129
  describe '#direct_messages' do
150
130
  before do
151
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
152
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
131
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
132
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
153
133
  end
154
134
  it 'requests the correct resource' do
155
135
  @cli.direct_messages
@@ -220,8 +200,8 @@ ID,Posted at,Screen name,Text
220
200
  context '--decode-uris' do
221
201
  before do
222
202
  @cli.options = @cli.options.merge('decode_uris' => true)
223
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('direct_messages.json'))
224
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
203
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '20', :include_entities => 'true'}).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 => '10', :max_id => '1624782205', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
225
205
  end
226
206
  it 'requests the correct resource' do
227
207
  @cli.direct_messages
@@ -251,9 +231,9 @@ ID Posted at Screen name Text
251
231
  end
252
232
  context '--number' do
253
233
  before do
254
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
255
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_direct_messages.json'))
256
- stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
234
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
235
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
236
+ stub_get('/1.1/direct_messages.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
257
237
  end
258
238
  it 'limits the number of results to 1' do
259
239
  @cli.options = @cli.options.merge('number' => 1)
@@ -317,8 +297,8 @@ ID Posted at Screen name Text
317
297
 
318
298
  describe '#direct_messages_sent' do
319
299
  before do
320
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
321
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
300
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
301
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
322
302
  end
323
303
  it 'requests the correct resource' do
324
304
  @cli.direct_messages_sent
@@ -389,8 +369,8 @@ ID,Posted at,Screen name,Text
389
369
  context '--decode-uris' do
390
370
  before do
391
371
  @cli.options = @cli.options.merge('decode_uris' => true)
392
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('direct_messages.json'))
393
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
372
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
373
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '10', :max_id => '1624782205', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
394
374
  end
395
375
  it 'requests the correct resource' do
396
376
  @cli.direct_messages_sent
@@ -420,9 +400,9 @@ ID Posted at Screen name Text
420
400
  end
421
401
  context '--number' do
422
402
  before do
423
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
424
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_direct_messages.json'))
425
- stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'))
403
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
404
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
405
+ stub_get('/1.1/direct_messages/sent.json').with(:query => {:count => '1', :max_id => '235851563443306495', :include_entities => 'false'}).to_return(:body => fixture('direct_messages.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
426
406
  end
427
407
  it 'limits the number of results 1' do
428
408
  @cli.options = @cli.options.merge('number' => 1)
@@ -487,7 +467,7 @@ ID Posted at Screen name Text
487
467
  describe '#dm' do
488
468
  before do
489
469
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
490
- 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'))
470
+ 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'})
491
471
  end
492
472
  it 'requests the correct resource' do
493
473
  @cli.dm('pengwynn', 'Creating a fixture for the Twitter gem')
@@ -500,7 +480,7 @@ ID Posted at Screen name Text
500
480
  context '--id' do
501
481
  before do
502
482
  @cli.options = @cli.options.merge('id' => true)
503
- 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'))
483
+ 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'})
504
484
  end
505
485
  it 'requests the correct resource' do
506
486
  @cli.dm('14100886', 'Creating a fixture for the Twitter gem')
@@ -512,7 +492,7 @@ ID Posted at Screen name Text
512
492
  describe '#does_contain' do
513
493
  before do
514
494
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
515
- 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'))
495
+ 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'})
516
496
  end
517
497
  it 'requests the correct resource' do
518
498
  @cli.does_contain('presidents')
@@ -525,8 +505,8 @@ ID Posted at Screen name Text
525
505
  context '--id' do
526
506
  before do
527
507
  @cli.options = @cli.options.merge('id' => true)
528
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'))
529
- 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'))
508
+ 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'})
509
+ 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'})
530
510
  end
531
511
  it 'requests the correct resource' do
532
512
  @cli.does_contain('presidents', '7505382')
@@ -542,8 +522,8 @@ ID Posted at Screen name Text
542
522
  context '--id' do
543
523
  before do
544
524
  @cli.options = @cli.options.merge('id' => true)
545
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'))
546
- stub_get('/1.1/lists/members/show.json').with(:query => {:owner_id => '7505382', :screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture('list.json'))
525
+ 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'})
526
+ 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'})
547
527
  end
548
528
  it 'requests the correct resource' do
549
529
  @cli.does_contain('7505382/presidents', '7505382')
@@ -560,7 +540,7 @@ ID Posted at Screen name Text
560
540
  end
561
541
  context 'false' do
562
542
  before do
563
- 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)
543
+ 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'})
564
544
  end
565
545
  it 'exits' do
566
546
  expect do
@@ -574,7 +554,7 @@ ID Posted at Screen name Text
574
554
  describe '#does_follow' do
575
555
  before do
576
556
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
577
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'ev', :target_screen_name => 'testcli'}).to_return(:body => fixture('following.json'))
557
+ 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'})
578
558
  end
579
559
  it 'requests the correct resource' do
580
560
  @cli.does_follow('ev')
@@ -587,8 +567,8 @@ ID Posted at Screen name Text
587
567
  context '--id' do
588
568
  before do
589
569
  @cli.options = @cli.options.merge('id' => true)
590
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '20'}).to_return(:body => fixture('sferik.json'))
591
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'testcli'}).to_return(:body => fixture('following.json'))
570
+ 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'})
571
+ 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'})
592
572
  end
593
573
  it 'requests the correct resource' do
594
574
  @cli.does_follow('20')
@@ -602,7 +582,7 @@ ID Posted at Screen name Text
602
582
  end
603
583
  context 'with a user passed' do
604
584
  before do
605
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'ev', :target_screen_name => 'sferik'}).to_return(:body => fixture('following.json'))
585
+ 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'})
606
586
  end
607
587
  it 'requests the correct resource' do
608
588
  @cli.does_follow('ev', 'sferik')
@@ -615,9 +595,9 @@ ID Posted at Screen name Text
615
595
  context '--id' do
616
596
  before do
617
597
  @cli.options = @cli.options.merge('id' => true)
618
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '20'}).to_return(:body => fixture('sferik.json'))
619
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '428004849'}).to_return(:body => fixture('sferik.json'))
620
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'sferik'}).to_return(:body => fixture('following.json'))
598
+ 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'})
599
+ 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'})
600
+ 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'})
621
601
  end
622
602
  it 'requests the correct resource' do
623
603
  @cli.does_follow('20', '428004849')
@@ -633,7 +613,7 @@ ID Posted at Screen name Text
633
613
  end
634
614
  context 'false' do
635
615
  before do
636
- stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'ev', :target_screen_name => 'testcli'}).to_return(:body => fixture('not_following.json'))
616
+ 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'})
637
617
  end
638
618
  it 'exits' do
639
619
  expect do
@@ -647,7 +627,7 @@ ID Posted at Screen name Text
647
627
  describe '#favorite' do
648
628
  before do
649
629
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
650
- stub_post('/1.1/favorites/create.json').with(:body => {:id => '26755176471724032'}).to_return(:body => fixture('status.json'))
630
+ 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'})
651
631
  end
652
632
  it 'requests the correct resource' do
653
633
  @cli.favorite('26755176471724032')
@@ -661,7 +641,7 @@ ID Posted at Screen name Text
661
641
 
662
642
  describe '#favorites' do
663
643
  before do
664
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
644
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
665
645
  end
666
646
  it 'requests the correct resource' do
667
647
  @cli.favorites
@@ -781,7 +761,7 @@ ID,Posted at,Screen name,Text
781
761
  context '--decode-uris' do
782
762
  before do
783
763
  @cli.options = @cli.options.merge('decode_uris' => true)
784
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
764
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
785
765
  end
786
766
  it 'requests the correct resource' do
787
767
  @cli.favorites
@@ -857,7 +837,7 @@ ID Posted at Screen name Text
857
837
  context '--max-id' do
858
838
  before do
859
839
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
860
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
840
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
861
841
  end
862
842
  it 'requests the correct resource' do
863
843
  @cli.favorites
@@ -866,9 +846,9 @@ ID Posted at Screen name Text
866
846
  end
867
847
  context '--number' do
868
848
  before do
869
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
870
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
871
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
849
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
850
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
851
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
872
852
  end
873
853
  it 'limits the number of results to 1' do
874
854
  @cli.options = @cli.options.merge('number' => 1)
@@ -885,7 +865,7 @@ ID Posted at Screen name Text
885
865
  context '--since-id' do
886
866
  before do
887
867
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
888
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
868
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
889
869
  end
890
870
  it 'requests the correct resource' do
891
871
  @cli.favorites
@@ -894,7 +874,7 @@ ID Posted at Screen name Text
894
874
  end
895
875
  context 'with a user passed' do
896
876
  before do
897
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
877
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
898
878
  end
899
879
  it 'requests the correct resource' do
900
880
  @cli.favorites('sferik')
@@ -903,7 +883,7 @@ ID Posted at Screen name Text
903
883
  context '--id' do
904
884
  before do
905
885
  @cli.options = @cli.options.merge('id' => true)
906
- stub_get('/1.1/favorites/list.json').with(:query => {:user_id => '7505382', :count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
886
+ stub_get('/1.1/favorites/list.json').with(:query => {:user_id => '7505382', :count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
907
887
  end
908
888
  it 'requests the correct resource' do
909
889
  @cli.favorites('7505382')
@@ -913,7 +893,7 @@ ID Posted at Screen name Text
913
893
  context '--max-id' do
914
894
  before do
915
895
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
916
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
896
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
917
897
  end
918
898
  it 'requests the correct resource' do
919
899
  @cli.favorites('sferik')
@@ -922,9 +902,9 @@ ID Posted at Screen name Text
922
902
  end
923
903
  context '--number' do
924
904
  before do
925
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
926
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
927
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
905
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
906
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
907
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
928
908
  end
929
909
  it 'limits the number of results to 1' do
930
910
  @cli.options = @cli.options.merge('number' => 1)
@@ -941,7 +921,7 @@ ID Posted at Screen name Text
941
921
  context '--since-id' do
942
922
  before do
943
923
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
944
- stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
924
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
945
925
  end
946
926
  it 'requests the correct resource' do
947
927
  @cli.favorites('sferik')
@@ -957,15 +937,15 @@ ID Posted at Screen name Text
957
937
  end
958
938
  context 'one user' do
959
939
  before do
960
- stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
961
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
962
- stub_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('users.json'))
963
- stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'}).to_return(:body => fixture('sferik.json'))
940
+ 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'})
941
+ 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'})
942
+ 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'})
943
+ 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'})
964
944
  end
965
945
  it 'requests the correct resource' do
966
946
  @cli.follow('sferik', 'pengwynn')
967
- expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
968
- expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
947
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
948
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
969
949
  expect(a_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'})).to have_been_made
970
950
  expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'})).to have_been_made
971
951
  end
@@ -976,26 +956,26 @@ ID Posted at Screen name Text
976
956
  context '--id' do
977
957
  before do
978
958
  @cli.options = @cli.options.merge('id' => true)
979
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
980
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382,14100886'}).to_return(:body => fixture('users.json'))
981
- stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'}).to_return(:body => fixture('sferik.json'))
959
+ 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'})
960
+ 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'})
961
+ 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'})
982
962
  end
983
963
  it 'requests the correct resource' do
984
964
  @cli.follow('7505382', '14100886')
985
- expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
965
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
986
966
  expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382,14100886'})).to have_been_made
987
967
  expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'})).to have_been_made
988
968
  end
989
969
  end
990
970
  context 'Twitter is down' do
991
971
  it 'retries 3 times and then raise an error' do
992
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
993
- stub_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('users.json'))
994
- stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'}).to_return(:status => 502)
972
+ 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'})
973
+ 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'})
974
+ stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'}).to_return(:status => 502, :headers => {:content_type => 'application/json; charset=utf-8'})
995
975
  expect do
996
976
  @cli.follow('sferik', 'pengwynn')
997
977
  end.to raise_error(Twitter::Error::BadGateway)
998
- expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made.times(3)
978
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made.times(3)
999
979
  expect(a_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'})).to have_been_made.times(3)
1000
980
  expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'})).to have_been_made.times(3)
1001
981
  end
@@ -1005,14 +985,14 @@ ID Posted at Screen name Text
1005
985
 
1006
986
  describe '#followings' do
1007
987
  before do
1008
- stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
1009
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1010
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
988
+ 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'})
989
+ 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'})
990
+ 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'})
1011
991
  end
1012
992
  it 'requests the correct resource' do
1013
993
  @cli.followings
1014
- expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
1015
- expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
994
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
995
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
1016
996
  expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
1017
997
  end
1018
998
  it 'has the correct output' do
@@ -1128,7 +1108,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1128
1108
  end
1129
1109
  context 'with a user passed' do
1130
1110
  before do
1131
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1111
+ 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'})
1132
1112
  end
1133
1113
  it 'requests the correct resource' do
1134
1114
  @cli.followings('sferik')
@@ -1139,7 +1119,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1139
1119
  context '--id' do
1140
1120
  before do
1141
1121
  @cli.options = @cli.options.merge('id' => true)
1142
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1122
+ 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'})
1143
1123
  end
1144
1124
  it 'requests the correct resource' do
1145
1125
  @cli.followings('7505382')
@@ -1151,9 +1131,9 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1151
1131
 
1152
1132
  describe '#followings_following' do
1153
1133
  before do
1154
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('friends_ids.json'))
1155
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1156
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
1134
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1135
+ 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'})
1136
+ 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'})
1157
1137
  end
1158
1138
  it 'requests the correct resource' do
1159
1139
  @cli.followings_following('sferik')
@@ -1274,8 +1254,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1274
1254
  end
1275
1255
  context 'with two users passed' do
1276
1256
  before do
1277
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'}).to_return(:body => fixture('friends_ids.json'))
1278
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1257
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1258
+ 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'})
1279
1259
  end
1280
1260
  it 'requests the correct resource' do
1281
1261
  @cli.followings_following('sferik', 'pengwynn')
@@ -1286,8 +1266,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1286
1266
  context '--id' do
1287
1267
  before do
1288
1268
  @cli.options = @cli.options.merge('id' => true)
1289
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('friends_ids.json'))
1290
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1269
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1270
+ 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'})
1291
1271
  end
1292
1272
  it 'requests the correct resource' do
1293
1273
  @cli.followings_following('7505382', '14100886')
@@ -1301,14 +1281,14 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1301
1281
 
1302
1282
  describe '#followers' do
1303
1283
  before do
1304
- stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
1305
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1306
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
1284
+ 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'})
1285
+ 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'})
1286
+ 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'})
1307
1287
  end
1308
1288
  it 'requests the correct resource' do
1309
1289
  @cli.followers
1310
- expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
1311
- expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
1290
+ expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:include_entities => 'false', :skip_status => 'true'})).to have_been_made
1291
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
1312
1292
  expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
1313
1293
  end
1314
1294
  it 'has the correct output' do
@@ -1424,8 +1404,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1424
1404
  end
1425
1405
  context 'with a user passed' do
1426
1406
  before do
1427
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1428
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
1407
+ 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'})
1408
+ 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'})
1429
1409
  end
1430
1410
  it 'requests the correct resource' do
1431
1411
  @cli.followers('sferik')
@@ -1435,7 +1415,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1435
1415
  context '--id' do
1436
1416
  before do
1437
1417
  @cli.options = @cli.options.merge('id' => true)
1438
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1418
+ 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'})
1439
1419
  end
1440
1420
  it 'requests the correct resource' do
1441
1421
  @cli.followers('7505382')
@@ -1448,10 +1428,10 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1448
1428
 
1449
1429
  describe '#friends' do
1450
1430
  before do
1451
- stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
1452
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1453
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1454
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
1431
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1432
+ 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'})
1433
+ 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'})
1434
+ 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'})
1455
1435
  end
1456
1436
  it 'requests the correct resource' do
1457
1437
  @cli.friends
@@ -1573,8 +1553,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1573
1553
  end
1574
1554
  context 'with a user passed' do
1575
1555
  before do
1576
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1577
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1556
+ 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'})
1557
+ 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'})
1578
1558
  end
1579
1559
  it 'requests the correct resource' do
1580
1560
  @cli.friends('sferik')
@@ -1585,8 +1565,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1585
1565
  context '--id' do
1586
1566
  before do
1587
1567
  @cli.options = @cli.options.merge('id' => true)
1588
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1589
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1568
+ 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'})
1569
+ 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'})
1590
1570
  end
1591
1571
  it 'requests the correct resource' do
1592
1572
  @cli.friends('7505382')
@@ -1600,10 +1580,10 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1600
1580
 
1601
1581
  describe '#groupies' do
1602
1582
  before do
1603
- stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
1604
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
1605
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1606
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
1583
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1584
+ 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'})
1585
+ 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'})
1586
+ 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'})
1607
1587
  end
1608
1588
  it 'requests the correct resource' do
1609
1589
  @cli.groupies
@@ -1725,8 +1705,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1725
1705
  end
1726
1706
  context 'with a user passed' do
1727
1707
  before do
1728
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
1729
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1708
+ 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'})
1709
+ 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'})
1730
1710
  end
1731
1711
  it 'requests the correct resource' do
1732
1712
  @cli.groupies('sferik')
@@ -1737,8 +1717,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1737
1717
  context '--id' do
1738
1718
  before do
1739
1719
  @cli.options = @cli.options.merge('id' => true)
1740
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('followers_ids.json'))
1741
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1720
+ 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'})
1721
+ 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'})
1742
1722
  end
1743
1723
  it 'requests the correct resource' do
1744
1724
  @cli.groupies('7505382')
@@ -1753,9 +1733,9 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1753
1733
  describe '#intersection' do
1754
1734
  before do
1755
1735
  @cli.options = @cli.options.merge('type' => 'followings')
1756
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('friends_ids.json'))
1757
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1758
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
1736
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1737
+ 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'})
1738
+ 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'})
1759
1739
  end
1760
1740
  it 'requests the correct resource' do
1761
1741
  @cli.intersection('sferik')
@@ -1868,9 +1848,9 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1868
1848
  context '--type=followers' do
1869
1849
  before do
1870
1850
  @cli.options = @cli.options.merge('type' => 'followers')
1871
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('followers_ids.json'))
1872
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
1873
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '213747670,428004849'}).to_return(:body => fixture('users.json'))
1851
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'testcli'}).to_return(:body => fixture('followers_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1852
+ 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'})
1853
+ 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'})
1874
1854
  end
1875
1855
  it 'requests the correct resource' do
1876
1856
  @cli.intersection('sferik')
@@ -1894,8 +1874,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1894
1874
  end
1895
1875
  context 'with two users passed' do
1896
1876
  before do
1897
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'}).to_return(:body => fixture('friends_ids.json'))
1898
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1877
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'pengwynn'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1878
+ 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'})
1899
1879
  end
1900
1880
  it 'requests the correct resource' do
1901
1881
  @cli.intersection('sferik', 'pengwynn')
@@ -1906,8 +1886,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1906
1886
  context '--id' do
1907
1887
  before do
1908
1888
  @cli.options = @cli.options.merge('id' => true)
1909
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('friends_ids.json'))
1910
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
1889
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1890
+ 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'})
1911
1891
  end
1912
1892
  it 'requests the correct resource' do
1913
1893
  @cli.intersection('7505382', '14100886')
@@ -1921,10 +1901,10 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1921
1901
 
1922
1902
  describe '#leaders' do
1923
1903
  before do
1924
- stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'))
1925
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
1926
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
1927
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'))
1904
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
1905
+ 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'})
1906
+ 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'})
1907
+ 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'})
1928
1908
  end
1929
1909
  it 'requests the correct resource' do
1930
1910
  @cli.leaders
@@ -2046,8 +2026,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
2046
2026
  end
2047
2027
  context 'with a user passed' do
2048
2028
  before do
2049
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_ids.json'))
2050
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_ids.json'))
2029
+ 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'})
2030
+ 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'})
2051
2031
  end
2052
2032
  it 'requests the correct resource' do
2053
2033
  @cli.leaders('sferik')
@@ -2058,8 +2038,8 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
2058
2038
  context '--id' do
2059
2039
  before do
2060
2040
  @cli.options = @cli.options.merge('id' => true)
2061
- stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'))
2062
- stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('followers_ids.json'))
2041
+ 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'})
2042
+ 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'})
2063
2043
  end
2064
2044
  it 'requests the correct resource' do
2065
2045
  @cli.leaders('7505382')
@@ -2073,7 +2053,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
2073
2053
 
2074
2054
  describe '#lists' do
2075
2055
  before do
2076
- stub_get('/1.1/lists/list.json').to_return(:body => fixture('lists.json'))
2056
+ stub_get('/1.1/lists/list.json').to_return(:body => fixture('lists.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2077
2057
  end
2078
2058
  it 'requests the correct resource' do
2079
2059
  @cli.lists
@@ -2167,7 +2147,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2167
2147
  end
2168
2148
  context 'with a user passed' do
2169
2149
  before do
2170
- stub_get('/1.1/lists/list.json').with(:query => {:screen_name => 'sferik'}).to_return(:body => fixture('lists.json'))
2150
+ 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'})
2171
2151
  end
2172
2152
  it 'requests the correct resource' do
2173
2153
  @cli.lists('sferik')
@@ -2176,7 +2156,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2176
2156
  context '--id' do
2177
2157
  before do
2178
2158
  @cli.options = @cli.options.merge('id' => true)
2179
- stub_get('/1.1/lists/list.json').with(:query => {:user_id => '7505382'}).to_return(:body => fixture('lists.json'))
2159
+ 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'})
2180
2160
  end
2181
2161
  it 'requests the correct resource' do
2182
2162
  @cli.lists('7505382')
@@ -2188,8 +2168,8 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2188
2168
 
2189
2169
  describe '#matrix' do
2190
2170
  before do
2191
- stub_get('/1.1/search/tweets.json').with(:query => {:q => 'lang:ja', :count => 100, :include_entities => 'false'}).to_return(:body => fixture('matrix.json'))
2192
- stub_get('/1.1/search/tweets.json').with(:query => {:q => 'lang:ja', :count => 100, :max_id => '434642935557021697'}).to_return(:body => fixture('empty_cursor.json'))
2171
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'lang:ja', :count => 100, :include_entities => 'false'}).to_return(:body => fixture('matrix.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2172
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'lang:ja', :count => 100, :max_id => '434642935557021697'}).to_return(:body => fixture('empty_cursor.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2193
2173
  end
2194
2174
  it 'requests the correct resource' do
2195
2175
  @cli.matrix
@@ -2204,7 +2184,7 @@ ID Created at Screen name Slug Members Subscribers Mode ...
2204
2184
 
2205
2185
  describe '#mentions' do
2206
2186
  before do
2207
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2187
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2208
2188
  end
2209
2189
  it 'requests the correct resource' do
2210
2190
  @cli.mentions
@@ -2324,7 +2304,7 @@ ID,Posted at,Screen name,Text
2324
2304
  context '--decode-uris' do
2325
2305
  before do
2326
2306
  @cli.options = @cli.options.merge('decode_uris' => true)
2327
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2307
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2328
2308
  end
2329
2309
  it 'requests the correct resource' do
2330
2310
  @cli.mentions
@@ -2399,9 +2379,9 @@ ID Posted at Screen name Text
2399
2379
  end
2400
2380
  context '--number' do
2401
2381
  before do
2402
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2403
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
2404
- stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2382
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2383
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2384
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2405
2385
  end
2406
2386
  it 'limits the number of results to 1' do
2407
2387
  @cli.options = @cli.options.merge('number' => 1)
@@ -2417,6 +2397,31 @@ ID Posted at Screen name Text
2417
2397
  end
2418
2398
  end
2419
2399
 
2400
+ describe '#mute' do
2401
+ before do
2402
+ @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
2403
+ stub_post('/1.1/mutes/users/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2404
+ end
2405
+ it 'requests the correct resource' do
2406
+ @cli.mute('sferik')
2407
+ expect(a_post('/1.1/mutes/users/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
2408
+ end
2409
+ it 'has the correct output' do
2410
+ @cli.mute('sferik')
2411
+ expect($stdout.string).to match(/^@testcli muted 1 user/)
2412
+ end
2413
+ context '--id' do
2414
+ before do
2415
+ @cli.options = @cli.options.merge('id' => true)
2416
+ stub_post('/1.1/mutes/users/create.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2417
+ end
2418
+ it 'requests the correct resource' do
2419
+ @cli.mute('7505382')
2420
+ expect(a_post('/1.1/mutes/users/create.json').with(:body => {:user_id => '7505382'})).to have_been_made
2421
+ end
2422
+ end
2423
+ end
2424
+
2420
2425
  describe '#open' do
2421
2426
  before do
2422
2427
  @cli.options = @cli.options.merge('display-uri' => true)
@@ -2429,7 +2434,7 @@ ID Posted at Screen name Text
2429
2434
  context '--id' do
2430
2435
  before do
2431
2436
  @cli.options = @cli.options.merge('id' => true)
2432
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '420'}).to_return(:body => fixture('sferik.json'))
2437
+ 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'})
2433
2438
  end
2434
2439
  it 'requests the correct resource' do
2435
2440
  @cli.open('420')
@@ -2439,7 +2444,7 @@ ID Posted at Screen name Text
2439
2444
  context '--status' do
2440
2445
  before do
2441
2446
  @cli.options = @cli.options.merge('status' => true)
2442
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status.json'))
2447
+ 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'})
2443
2448
  end
2444
2449
  it 'requests the correct resource' do
2445
2450
  @cli.open('55709764298092545')
@@ -2453,11 +2458,35 @@ ID Posted at Screen name Text
2453
2458
  end
2454
2459
  end
2455
2460
 
2461
+ describe '#reach' do
2462
+ before do
2463
+ 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'})
2464
+ stub_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '55709764298092545', :cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2465
+ stub_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '55709764298092545', :cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2466
+ 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'})
2467
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '20009713'}).to_return(:body => fixture('followers_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2468
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'}).to_return(:body => fixture('followers_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2469
+ end
2470
+ it 'requests the correct resources' do
2471
+ @cli.reach('55709764298092545')
2472
+ expect(a_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false'})).to have_been_made
2473
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '55709764298092545', :cursor => '-1'})).to have_been_made
2474
+ expect(a_get('/1.1/statuses/retweeters/ids.json').with(:query => {:id => '55709764298092545', :cursor => '1305102810874389703'})).to have_been_made
2475
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
2476
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '20009713'})).to have_been_made
2477
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '14100886'})).to have_been_made
2478
+ end
2479
+ it 'has the correct output' do
2480
+ @cli.reach('55709764298092545')
2481
+ expect($stdout.string.split("\n").first).to eq '2'
2482
+ end
2483
+ end
2484
+
2456
2485
  describe '#reply' do
2457
2486
  before do
2458
2487
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc', 'location' => nil)
2459
- stub_get('/1.1/statuses/show/263813522369159169.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_with_mention.json'))
2460
- stub_post('/1.1/statuses/update.json').with(:body => {:in_reply_to_status_id => '263813522369159169', :status => '@joshfrench Testing', :trim_user => 'true'}).to_return(:body => fixture('status.json'))
2488
+ 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'})
2489
+ stub_post('/1.1/statuses/update.json').with(:body => {:in_reply_to_status_id => '263813522369159169', :status => '@joshfrench Testing', :trim_user => 'true'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2461
2490
  stub_request(:get, 'http://checkip.dyndns.org/').to_return(:body => fixture('checkip.html'), :headers => {:content_type => 'text/html'})
2462
2491
  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'})
2463
2492
  end
@@ -2475,7 +2504,7 @@ ID Posted at Screen name Text
2475
2504
  context '--all' do
2476
2505
  before do
2477
2506
  @cli.options = @cli.options.merge('all' => true)
2478
- stub_post('/1.1/statuses/update.json').with(:body => {:in_reply_to_status_id => '263813522369159169', :status => '@joshfrench @sferik Testing', :trim_user => 'true'}).to_return(:body => fixture('status.json'))
2507
+ stub_post('/1.1/statuses/update.json').with(:body => {:in_reply_to_status_id => '263813522369159169', :status => '@joshfrench @sferik Testing', :trim_user => 'true'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2479
2508
  end
2480
2509
  it 'requests the correct resource' do
2481
2510
  @cli.reply('263813522369159169', 'Testing')
@@ -2492,8 +2521,8 @@ ID Posted at Screen name Text
2492
2521
  context '--location' do
2493
2522
  before do
2494
2523
  @cli.options = @cli.options.merge('location' => 'location')
2495
- stub_get('/1.1/statuses/show/263813522369159169.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_with_mention.json'))
2496
- 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'))
2524
+ 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'})
2525
+ 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'})
2497
2526
  end
2498
2527
  it 'requests the correct resource' do
2499
2528
  @cli.reply('263813522369159169', 'Testing')
@@ -2510,8 +2539,8 @@ ID Posted at Screen name Text
2510
2539
  context "--location 'latitude,longitude'" do
2511
2540
  before do
2512
2541
  @cli.options = @cli.options.merge('location' => '41.03132,28.9869')
2513
- stub_get('/1.1/statuses/show/263813522369159169.json').with(:query => {:include_my_retweet => 'false'}).to_return(:body => fixture('status_with_mention.json'))
2514
- stub_post('/1.1/statuses/update.json').with(:body => {:in_reply_to_status_id => '263813522369159169', :status => '@joshfrench Testing', :lat => '41.03132', :long => '28.9869', :trim_user => 'true'}).to_return(:body => fixture('status.json'))
2542
+ 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'})
2543
+ stub_post('/1.1/statuses/update.json').with(:body => {:in_reply_to_status_id => '263813522369159169', :status => '@joshfrench Testing', :lat => '41.03132', :long => '28.9869', :trim_user => 'true'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2515
2544
  end
2516
2545
  it 'requests the correct resource' do
2517
2546
  @cli.reply('263813522369159169', 'Testing')
@@ -2530,7 +2559,7 @@ ID Posted at Screen name Text
2530
2559
  describe '#report_spam' do
2531
2560
  before do
2532
2561
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
2533
- stub_post('/1.1/users/report_spam.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
2562
+ stub_post('/1.1/users/report_spam.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2534
2563
  end
2535
2564
  it 'requests the correct resource' do
2536
2565
  @cli.report_spam('sferik')
@@ -2543,7 +2572,7 @@ ID Posted at Screen name Text
2543
2572
  context '--id' do
2544
2573
  before do
2545
2574
  @cli.options = @cli.options.merge('id' => true)
2546
- stub_post('/1.1/users/report_spam.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'))
2575
+ stub_post('/1.1/users/report_spam.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2547
2576
  end
2548
2577
  it 'requests the correct resource' do
2549
2578
  @cli.report_spam('7505382')
@@ -2555,7 +2584,7 @@ ID Posted at Screen name Text
2555
2584
  describe '#retweet' do
2556
2585
  before do
2557
2586
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
2558
- stub_post('/1.1/statuses/retweet/26755176471724032.json').to_return(:body => fixture('retweet.json'))
2587
+ stub_post('/1.1/statuses/retweet/26755176471724032.json').to_return(:body => fixture('retweet.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2559
2588
  end
2560
2589
  it 'requests the correct resource' do
2561
2590
  @cli.retweet('26755176471724032')
@@ -2569,8 +2598,8 @@ ID Posted at Screen name Text
2569
2598
 
2570
2599
  describe '#retweets' do
2571
2600
  before do
2572
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2573
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2601
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2602
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2574
2603
  end
2575
2604
  context 'without arguments' do
2576
2605
  it 'requests the correct resource' do
@@ -2698,8 +2727,8 @@ ID,Posted at,Screen name,Text
2698
2727
  context '--decode-uris' do
2699
2728
  before do
2700
2729
  @cli.options = @cli.options.merge('decode_uris' => true)
2701
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2702
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2730
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2731
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2703
2732
  end
2704
2733
  it 'requests the correct resource' do
2705
2734
  @cli.retweets
@@ -2771,8 +2800,8 @@ ID Posted at Screen name Text
2771
2800
  end
2772
2801
  context '--number' do
2773
2802
  before do
2774
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2775
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244107823733174271', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2803
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2804
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244107823733174271', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2776
2805
  end
2777
2806
  it 'limits the number of results to 1' do
2778
2807
  @cli.options = @cli.options.merge('number' => 1)
@@ -2788,8 +2817,8 @@ ID Posted at Screen name Text
2788
2817
  end
2789
2818
  context 'with a user passed' do
2790
2819
  before do
2791
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2792
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2820
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2821
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2793
2822
  end
2794
2823
  it 'requests the correct resource' do
2795
2824
  @cli.retweets('sferik')
@@ -2799,8 +2828,8 @@ ID Posted at Screen name Text
2799
2828
  context '--id' do
2800
2829
  before do
2801
2830
  @cli.options = @cli.options.merge('id' => true)
2802
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2803
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2831
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2832
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2804
2833
  end
2805
2834
  it 'requests the correct resource' do
2806
2835
  @cli.retweets('7505382')
@@ -2813,7 +2842,7 @@ ID Posted at Screen name Text
2813
2842
 
2814
2843
  describe '#retweets_of_me' do
2815
2844
  before do
2816
- stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
2845
+ stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2817
2846
  end
2818
2847
  context 'without arguments' do
2819
2848
  it 'requests the correct resource' do
@@ -2935,7 +2964,7 @@ ID,Posted at,Screen name,Text
2935
2964
  context '--decode-uris' do
2936
2965
  before do
2937
2966
  @cli.options = @cli.options.merge('decode_uris' => true)
2938
- stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
2967
+ stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
2939
2968
  end
2940
2969
  it 'requests the correct resource' do
2941
2970
  @cli.retweets_of_me
@@ -3006,10 +3035,10 @@ ID Posted at Screen name Text
3006
3035
  end
3007
3036
  context '--number' do
3008
3037
  before do
3009
- stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3010
- stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3038
+ stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3039
+ stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3011
3040
  (1..181).step(20) do |count|
3012
- stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => count, :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3041
+ stub_get('/1.1/statuses/retweets_of_me.json').with(:query => {:count => count, :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3013
3042
  end
3014
3043
  end
3015
3044
  it 'limits the number of results to 1' do
@@ -3048,7 +3077,7 @@ ID Posted at Screen name Text
3048
3077
 
3049
3078
  describe '#status' do
3050
3079
  before do
3051
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status.json'))
3080
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3052
3081
  end
3053
3082
  it 'requests the correct resources' do
3054
3083
  @cli.status('55709764298092545')
@@ -3081,7 +3110,7 @@ ID,Posted at,Screen name,Text,Retweets,Favorites,Source,Location
3081
3110
  end
3082
3111
  context 'with no street address' do
3083
3112
  before do
3084
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_street_address.json'))
3113
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_street_address.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3085
3114
  end
3086
3115
  it 'has the correct output' do
3087
3116
  @cli.status('55709764298092545')
@@ -3099,7 +3128,7 @@ Location Blowfish Sushi To Die For, San Francisco, California, United States
3099
3128
  end
3100
3129
  context 'with no locality' do
3101
3130
  before do
3102
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_locality.json'))
3131
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_locality.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3103
3132
  end
3104
3133
  it 'has the correct output' do
3105
3134
  @cli.status('55709764298092545')
@@ -3117,7 +3146,7 @@ Location Blowfish Sushi To Die For, San Francisco, California, United States
3117
3146
  end
3118
3147
  context 'with no attributes' do
3119
3148
  before do
3120
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_attributes.json'))
3149
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_attributes.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3121
3150
  end
3122
3151
  it 'has the correct output' do
3123
3152
  @cli.status('55709764298092545')
@@ -3135,7 +3164,7 @@ Location Blowfish Sushi To Die For, San Francisco, United States
3135
3164
  end
3136
3165
  context 'with no country' do
3137
3166
  before do
3138
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_country.json'))
3167
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_country.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3139
3168
  end
3140
3169
  it 'has the correct output' do
3141
3170
  @cli.status('55709764298092545')
@@ -3153,7 +3182,7 @@ Location Blowfish Sushi To Die For, San Francisco
3153
3182
  end
3154
3183
  context 'with no full name' do
3155
3184
  before do
3156
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_full_name.json'))
3185
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_full_name.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3157
3186
  end
3158
3187
  it 'has the correct output' do
3159
3188
  @cli.status('55709764298092545')
@@ -3171,7 +3200,7 @@ Location Blowfish Sushi To Die For
3171
3200
  end
3172
3201
  context 'with no place' do
3173
3202
  before do
3174
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'))
3203
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3175
3204
  stub_request(:get, 'http://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
3176
3205
  end
3177
3206
  it 'has the correct output' do
@@ -3189,7 +3218,7 @@ Location San Francisco, CA, United States
3189
3218
  end
3190
3219
  context 'with no city' do
3191
3220
  before do
3192
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'))
3221
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3193
3222
  stub_request(:get, 'http://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo_no_city.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
3194
3223
  end
3195
3224
  it 'has the correct output' do
@@ -3208,7 +3237,7 @@ Location CA, United States
3208
3237
  end
3209
3238
  context 'with no state' do
3210
3239
  before do
3211
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'))
3240
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3212
3241
  stub_request(:get, 'http://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo_no_state.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
3213
3242
  end
3214
3243
  it 'has the correct output' do
@@ -3240,8 +3269,8 @@ ID Posted at Screen name Text ...
3240
3269
  end
3241
3270
  describe '--relative-dates' do
3242
3271
  before do
3243
- stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status.json'))
3244
- stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
3272
+ stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3273
+ stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3245
3274
  @cli.options = @cli.options.merge('relative_dates' => true)
3246
3275
  end
3247
3276
  it 'status has the correct output (absolute and relative date together)' do
@@ -3304,7 +3333,7 @@ ID Posted at Screen name Text ...
3304
3333
 
3305
3334
  describe '#timeline' do
3306
3335
  before do
3307
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3336
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3308
3337
  end
3309
3338
  context 'without user' do
3310
3339
  it 'requests the correct resource' do
@@ -3426,7 +3455,7 @@ ID,Posted at,Screen name,Text
3426
3455
  context '--decode-uris' do
3427
3456
  before do
3428
3457
  @cli.options = @cli.options.merge('decode_uris' => true)
3429
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
3458
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3430
3459
  end
3431
3460
  it 'requests the correct resource' do
3432
3461
  @cli.timeline
@@ -3440,7 +3469,7 @@ ID,Posted at,Screen name,Text
3440
3469
  context '--exclude=replies' do
3441
3470
  before do
3442
3471
  @cli.options = @cli.options.merge('exclude' => 'replies')
3443
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :exclude_replies => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3472
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :exclude_replies => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3444
3473
  end
3445
3474
  it 'excludes replies' do
3446
3475
  @cli.timeline
@@ -3450,7 +3479,7 @@ ID,Posted at,Screen name,Text
3450
3479
  context '--exclude=retweets' do
3451
3480
  before do
3452
3481
  @cli.options = @cli.options.merge('exclude' => 'retweets')
3453
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_rts => 'false', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3482
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :include_rts => 'false', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3454
3483
  end
3455
3484
  it 'excludes retweets' do
3456
3485
  @cli.timeline
@@ -3522,7 +3551,7 @@ ID Posted at Screen name Text
3522
3551
  context '--max-id' do
3523
3552
  before do
3524
3553
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
3525
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3554
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3526
3555
  end
3527
3556
  it 'requests the correct resource' do
3528
3557
  @cli.timeline
@@ -3531,9 +3560,9 @@ ID Posted at Screen name Text
3531
3560
  end
3532
3561
  context '--number' do
3533
3562
  before do
3534
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3535
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
3536
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3563
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3564
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3565
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '1', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3537
3566
  end
3538
3567
  it 'limits the number of results to 1' do
3539
3568
  @cli.options = @cli.options.merge('number' => 1)
@@ -3550,7 +3579,7 @@ ID Posted at Screen name Text
3550
3579
  context '--since-id' do
3551
3580
  before do
3552
3581
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
3553
- stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3582
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '20', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3554
3583
  end
3555
3584
  it 'requests the correct resource' do
3556
3585
  @cli.timeline
@@ -3559,7 +3588,7 @@ ID Posted at Screen name Text
3559
3588
  end
3560
3589
  context 'with a user passed' do
3561
3590
  before do
3562
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3591
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3563
3592
  end
3564
3593
  it 'requests the correct resource' do
3565
3594
  @cli.timeline('sferik')
@@ -3568,7 +3597,7 @@ ID Posted at Screen name Text
3568
3597
  context '--id' do
3569
3598
  before do
3570
3599
  @cli.options = @cli.options.merge('id' => true)
3571
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3600
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3572
3601
  end
3573
3602
  it 'requests the correct resource' do
3574
3603
  @cli.timeline('7505382')
@@ -3578,7 +3607,7 @@ ID Posted at Screen name Text
3578
3607
  context '--max-id' do
3579
3608
  before do
3580
3609
  @cli.options = @cli.options.merge('max_id' => 244_104_558_433_951_744)
3581
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3610
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3582
3611
  end
3583
3612
  it 'requests the correct resource' do
3584
3613
  @cli.timeline('sferik')
@@ -3587,9 +3616,9 @@ ID Posted at Screen name Text
3587
3616
  end
3588
3617
  context '--number' do
3589
3618
  before do
3590
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3591
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
3592
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3619
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3620
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3621
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '1', :screen_name => 'sferik', :max_id => '265500541700956160', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3593
3622
  end
3594
3623
  it 'limits the number of results to 1' do
3595
3624
  @cli.options = @cli.options.merge('number' => 1)
@@ -3606,7 +3635,7 @@ ID Posted at Screen name Text
3606
3635
  context '--since-id' do
3607
3636
  before do
3608
3637
  @cli.options = @cli.options.merge('since_id' => 244_104_558_433_951_744)
3609
- stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
3638
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '20', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3610
3639
  end
3611
3640
  it 'requests the correct resource' do
3612
3641
  @cli.timeline('sferik')
@@ -3618,7 +3647,7 @@ ID Posted at Screen name Text
3618
3647
 
3619
3648
  describe '#trends' do
3620
3649
  before do
3621
- stub_get('/1.1/trends/place.json').with(:query => {:id => '1'}).to_return(:body => fixture('trends.json'))
3650
+ 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'})
3622
3651
  end
3623
3652
  it 'requests the correct resource' do
3624
3653
  @cli.trends
@@ -3631,7 +3660,7 @@ ID Posted at Screen name Text
3631
3660
  context '--exclude-hashtags' do
3632
3661
  before do
3633
3662
  @cli.options = @cli.options.merge('exclude-hashtags' => true)
3634
- stub_get('/1.1/trends/place.json').with(:query => {:id => '1', :exclude => 'hashtags'}).to_return(:body => fixture('trends.json'))
3663
+ 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'})
3635
3664
  end
3636
3665
  it 'requests the correct resource' do
3637
3666
  @cli.trends
@@ -3644,7 +3673,7 @@ ID Posted at Screen name Text
3644
3673
  end
3645
3674
  context 'with a WOEID passed' do
3646
3675
  before do
3647
- stub_get('/1.1/trends/place.json').with(:query => {:id => '2487956'}).to_return(:body => fixture('trends.json'))
3676
+ 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'})
3648
3677
  end
3649
3678
  it 'requests the correct resource' do
3650
3679
  @cli.trends('2487956')
@@ -3659,7 +3688,7 @@ ID Posted at Screen name Text
3659
3688
 
3660
3689
  describe '#trend_locations' do
3661
3690
  before do
3662
- stub_get('/1.1/trends/available.json').to_return(:body => fixture('locations.json'))
3691
+ stub_get('/1.1/trends/available.json').to_return(:body => fixture('locations.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3663
3692
  end
3664
3693
  it 'requests the correct resource' do
3665
3694
  @cli.trend_locations
@@ -3761,19 +3790,19 @@ WOEID Parent ID Type Name Country
3761
3790
  end
3762
3791
  context 'one user' do
3763
3792
  it 'requests the correct resource' do
3764
- stub_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
3793
+ 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'})
3765
3794
  @cli.unfollow('sferik')
3766
3795
  expect(a_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
3767
3796
  end
3768
3797
  it 'has the correct output' do
3769
- stub_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'))
3798
+ 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'})
3770
3799
  @cli.unfollow('sferik')
3771
3800
  expect($stdout.string).to match(/^@testcli is no longer following 1 user\.$/)
3772
3801
  end
3773
3802
  context '--id' do
3774
3803
  before do
3775
3804
  @cli.options = @cli.options.merge('id' => true)
3776
- stub_post('/1.1/friendships/destroy.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'))
3805
+ 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'})
3777
3806
  end
3778
3807
  it 'requests the correct resource' do
3779
3808
  @cli.unfollow('7505382')
@@ -3782,7 +3811,7 @@ WOEID Parent ID Type Name Country
3782
3811
  end
3783
3812
  context 'Twitter is down' do
3784
3813
  it 'retries 3 times and then raise an error' do
3785
- stub_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'}).to_return(:status => 502)
3814
+ stub_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'}).to_return(:status => 502, :headers => {:content_type => 'application/json; charset=utf-8'})
3786
3815
  expect do
3787
3816
  @cli.unfollow('sferik')
3788
3817
  end.to raise_error(Twitter::Error::BadGateway)
@@ -3795,7 +3824,7 @@ WOEID Parent ID Type Name Country
3795
3824
  describe '#update' do
3796
3825
  before do
3797
3826
  @cli.options = @cli.options.merge('profile' => fixture_path + '/.trc')
3798
- stub_post('/1.1/statuses/update.json').with(:body => {:status => 'Testing', :trim_user => 'true'}).to_return(:body => fixture('status.json'))
3827
+ stub_post('/1.1/statuses/update.json').with(:body => {:status => 'Testing', :trim_user => 'true'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3799
3828
  stub_request(:get, 'http://checkip.dyndns.org/').to_return(:body => fixture('checkip.html'), :headers => {:content_type => 'text/html'})
3800
3829
  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'})
3801
3830
  end
@@ -3812,7 +3841,7 @@ WOEID Parent ID Type Name Country
3812
3841
  context 'with file' do
3813
3842
  before do
3814
3843
  @cli.options = @cli.options.merge('file' => fixture_path + '/long.png')
3815
- stub_post('/1.1/statuses/update_with_media.json').to_return(:body => fixture('status.json'))
3844
+ stub_post('/1.1/statuses/update_with_media.json').to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3816
3845
  end
3817
3846
  it 'requests the correct resource' do
3818
3847
  @cli.update('Testing')
@@ -3826,7 +3855,7 @@ WOEID Parent ID Type Name Country
3826
3855
  context '--location' do
3827
3856
  before do
3828
3857
  @cli.options = @cli.options.merge('location' => 'location')
3829
- stub_post('/1.1/statuses/update.json').with(:body => {:status => 'Testing', :lat => '37.76969909668', :long => '-122.39330291748', :trim_user => 'true'}).to_return(:body => fixture('status.json'))
3858
+ stub_post('/1.1/statuses/update.json').with(:body => {:status => 'Testing', :lat => '37.76969909668', :long => '-122.39330291748', :trim_user => 'true'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3830
3859
  end
3831
3860
  it 'requests the correct resource' do
3832
3861
  @cli.update('Testing')
@@ -3842,7 +3871,7 @@ WOEID Parent ID Type Name Country
3842
3871
  context "--location 'latitude,longitude'" do
3843
3872
  before do
3844
3873
  @cli.options = @cli.options.merge('location' => '41.03132,28.9869')
3845
- stub_post('/1.1/statuses/update.json').with(:body => {:status => 'Testing', :lat => '41.03132', :long => '28.9869', :trim_user => 'true'}).to_return(:body => fixture('status.json'))
3874
+ stub_post('/1.1/statuses/update.json').with(:body => {:status => 'Testing', :lat => '41.03132', :long => '28.9869', :trim_user => 'true'}).to_return(:body => fixture('status.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
3846
3875
  end
3847
3876
  it 'requests the correct resource' do
3848
3877
  @cli.update('Testing')
@@ -3859,7 +3888,7 @@ WOEID Parent ID Type Name Country
3859
3888
 
3860
3889
  describe '#users' do
3861
3890
  before do
3862
- stub_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('users.json'))
3891
+ 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'})
3863
3892
  end
3864
3893
  it 'requests the correct resource' do
3865
3894
  @cli.users('sferik', 'pengwynn')
@@ -3934,7 +3963,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3934
3963
  context '--id' do
3935
3964
  before do
3936
3965
  @cli.options = @cli.options.merge('id' => true)
3937
- stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382,14100886'}).to_return(:body => fixture('users.json'))
3966
+ 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'})
3938
3967
  end
3939
3968
  it 'requests the correct resource' do
3940
3969
  @cli.users('7505382', '14100886')
@@ -3997,7 +4026,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
3997
4026
 
3998
4027
  describe '#whois' do
3999
4028
  before do
4000
- stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
4029
+ stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
4001
4030
  end
4002
4031
  it 'requests the correct resource' do
4003
4032
  @cli.whois('sferik')
@@ -4036,7 +4065,7 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
4036
4065
  context '--id' do
4037
4066
  before do
4038
4067
  @cli.options = @cli.options.merge('id' => true)
4039
- stub_get('/1.1/users/show.json').with(:query => {:user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
4068
+ stub_get('/1.1/users/show.json').with(:query => {:user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
4040
4069
  end
4041
4070
  it 'requests the correct resource' do
4042
4071
  @cli.whois('7505382')
@@ -4059,7 +4088,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following ...
4059
4088
 
4060
4089
  describe '#whoami' do
4061
4090
  before do
4062
- stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'testcli', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'))
4091
+ stub_get('/1.1/users/show.json').with(:query => {:screen_name => 'testcli', :include_entities => 'false'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
4063
4092
  end
4064
4093
  it 'requests the correct resource' do
4065
4094
  @cli.whoami