twitter 5.0.0 → 5.4.1

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.
Files changed (145) hide show
  1. data/.yardopts +4 -0
  2. data/CHANGELOG.md +47 -0
  3. data/CONTRIBUTING.md +5 -5
  4. data/README.md +57 -56
  5. data/Rakefile +26 -5
  6. data/lib/twitter/arguments.rb +1 -2
  7. data/lib/twitter/base.rb +15 -18
  8. data/lib/twitter/basic_user.rb +3 -3
  9. data/lib/twitter/client.rb +9 -10
  10. data/lib/twitter/configuration.rb +5 -5
  11. data/lib/twitter/creatable.rb +0 -1
  12. data/lib/twitter/cursor.rb +9 -36
  13. data/lib/twitter/direct_message.rb +1 -1
  14. data/lib/twitter/entity/uri.rb +2 -2
  15. data/lib/twitter/enumerable.rb +10 -1
  16. data/lib/twitter/error/already_favorited.rb +1 -1
  17. data/lib/twitter/error/already_posted.rb +1 -1
  18. data/lib/twitter/error/already_retweeted.rb +1 -1
  19. data/lib/twitter/error/too_many_requests.rb +2 -2
  20. data/lib/twitter/error.rb +6 -6
  21. data/lib/twitter/factory.rb +2 -6
  22. data/lib/twitter/geo/point.rb +3 -5
  23. data/lib/twitter/geo.rb +1 -1
  24. data/lib/twitter/geo_factory.rb +1 -5
  25. data/lib/twitter/geo_results.rb +5 -8
  26. data/lib/twitter/identity.rb +1 -2
  27. data/lib/twitter/list.rb +10 -11
  28. data/lib/twitter/media/photo.rb +1 -2
  29. data/lib/twitter/media_factory.rb +1 -5
  30. data/lib/twitter/null_object.rb +4 -6
  31. data/lib/twitter/oembed.rb +1 -1
  32. data/lib/twitter/place.rb +17 -6
  33. data/lib/twitter/profile_banner.rb +1 -3
  34. data/lib/twitter/rate_limit.rb +1 -3
  35. data/lib/twitter/relationship.rb +1 -2
  36. data/lib/twitter/rest/api/direct_messages.rb +15 -15
  37. data/lib/twitter/rest/api/favorites.rb +15 -15
  38. data/lib/twitter/rest/api/friends_and_followers.rb +37 -42
  39. data/lib/twitter/rest/api/help.rb +8 -9
  40. data/lib/twitter/rest/api/lists.rb +69 -69
  41. data/lib/twitter/rest/api/oauth.rb +3 -4
  42. data/lib/twitter/rest/api/places_and_geo.rb +9 -10
  43. data/lib/twitter/rest/api/saved_searches.rb +8 -8
  44. data/lib/twitter/rest/api/search.rb +10 -2
  45. data/lib/twitter/rest/api/spam_reporting.rb +1 -2
  46. data/lib/twitter/rest/api/suggested_users.rb +4 -5
  47. data/lib/twitter/rest/api/timelines.rb +17 -18
  48. data/lib/twitter/rest/api/trends.rb +10 -11
  49. data/lib/twitter/rest/api/tweets.rb +31 -20
  50. data/lib/twitter/rest/api/undocumented.rb +6 -7
  51. data/lib/twitter/rest/api/users.rb +53 -54
  52. data/lib/twitter/rest/api/utils.rb +28 -34
  53. data/lib/twitter/rest/client.rb +8 -9
  54. data/lib/twitter/rest/request/multipart_with_file.rb +7 -5
  55. data/lib/twitter/rest/response/parse_error_json.rb +0 -2
  56. data/lib/twitter/rest/response/parse_json.rb +2 -2
  57. data/lib/twitter/rest/response/raise_error.rb +1 -3
  58. data/lib/twitter/search_results.rb +38 -56
  59. data/lib/twitter/settings.rb +2 -2
  60. data/lib/twitter/size.rb +2 -2
  61. data/lib/twitter/source_user.rb +1 -1
  62. data/lib/twitter/streaming/client.rb +69 -18
  63. data/lib/twitter/streaming/connection.rb +1 -3
  64. data/lib/twitter/streaming/deleted_tweet.rb +8 -0
  65. data/lib/twitter/streaming/event.rb +8 -8
  66. data/lib/twitter/streaming/friend_list.rb +2 -9
  67. data/lib/twitter/streaming/message_parser.rb +13 -3
  68. data/lib/twitter/streaming/response.rb +0 -2
  69. data/lib/twitter/streaming/stall_warning.rb +7 -0
  70. data/lib/twitter/suggestion.rb +0 -1
  71. data/lib/twitter/token.rb +2 -3
  72. data/lib/twitter/trend_results.rb +5 -8
  73. data/lib/twitter/tweet.rb +17 -18
  74. data/lib/twitter/user.rb +33 -35
  75. data/lib/twitter/utils.rb +14 -0
  76. data/lib/twitter/version.rb +2 -5
  77. data/lib/twitter.rb +1 -1
  78. data/spec/fixtures/forbidden.json +1 -0
  79. data/spec/fixtures/search.json +1 -1
  80. data/spec/fixtures/search2.json +1 -0
  81. data/spec/fixtures/track_streaming_user.json +2 -1
  82. data/spec/helper.rb +6 -2
  83. data/spec/twitter/base_spec.rb +9 -9
  84. data/spec/twitter/basic_user_spec.rb +6 -6
  85. data/spec/twitter/configuration_spec.rb +4 -4
  86. data/spec/twitter/cursor_spec.rb +13 -51
  87. data/spec/twitter/direct_message_spec.rb +36 -36
  88. data/spec/twitter/entity/uri_spec.rb +29 -29
  89. data/spec/twitter/error_spec.rb +21 -21
  90. data/spec/twitter/geo/point_spec.rb +9 -9
  91. data/spec/twitter/geo/polygon_spec.rb +5 -5
  92. data/spec/twitter/geo_factory_spec.rb +7 -7
  93. data/spec/twitter/geo_results_spec.rb +11 -11
  94. data/spec/twitter/geo_spec.rb +5 -5
  95. data/spec/twitter/identifiable_spec.rb +9 -9
  96. data/spec/twitter/list_spec.rb +38 -38
  97. data/spec/twitter/media/photo_spec.rb +58 -58
  98. data/spec/twitter/media_factory_spec.rb +5 -5
  99. data/spec/twitter/null_object_spec.rb +6 -6
  100. data/spec/twitter/oembed_spec.rb +68 -68
  101. data/spec/twitter/place_spec.rb +91 -62
  102. data/spec/twitter/profile_banner_spec.rb +3 -3
  103. data/spec/twitter/rate_limit_spec.rb +18 -18
  104. data/spec/twitter/relationship_spec.rb +16 -16
  105. data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
  106. data/spec/twitter/rest/api/favorites_spec.rb +93 -93
  107. data/spec/twitter/rest/api/friends_and_followers_spec.rb +357 -349
  108. data/spec/twitter/rest/api/geo_spec.rb +33 -33
  109. data/spec/twitter/rest/api/help_spec.rb +24 -24
  110. data/spec/twitter/rest/api/lists_spec.rb +487 -487
  111. data/spec/twitter/rest/api/oauth_spec.rb +30 -30
  112. data/spec/twitter/rest/api/saved_searches_spec.rb +50 -40
  113. data/spec/twitter/rest/api/search_spec.rb +27 -26
  114. data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
  115. data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
  116. data/spec/twitter/rest/api/timelines_spec.rb +58 -58
  117. data/spec/twitter/rest/api/trends_spec.rb +26 -26
  118. data/spec/twitter/rest/api/tweets_spec.rb +304 -266
  119. data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
  120. data/spec/twitter/rest/api/users_spec.rb +360 -360
  121. data/spec/twitter/rest/client_spec.rb +99 -103
  122. data/spec/twitter/saved_search_spec.rb +16 -16
  123. data/spec/twitter/search_results_spec.rb +14 -110
  124. data/spec/twitter/settings_spec.rb +8 -8
  125. data/spec/twitter/size_spec.rb +5 -5
  126. data/spec/twitter/source_user_spec.rb +6 -6
  127. data/spec/twitter/streaming/client_spec.rb +85 -54
  128. data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
  129. data/spec/twitter/streaming/event_spec.rb +20 -22
  130. data/spec/twitter/streaming/friend_list_spec.rb +11 -0
  131. data/spec/twitter/streaming/message_parser_spec.rb +54 -0
  132. data/spec/twitter/suggestion_spec.rb +11 -11
  133. data/spec/twitter/target_user_spec.rb +6 -6
  134. data/spec/twitter/token_spec.rb +4 -4
  135. data/spec/twitter/trend_results_spec.rb +30 -30
  136. data/spec/twitter/trend_spec.rb +21 -21
  137. data/spec/twitter/tweet_spec.rb +178 -164
  138. data/spec/twitter/user_spec.rb +190 -190
  139. data/twitter.gemspec +6 -6
  140. data.tar.gz.sig +0 -0
  141. metadata +44 -16
  142. metadata.gz.sig +0 -0
  143. data/lib/twitter/core_ext/enumerable.rb +0 -10
  144. data/lib/twitter/core_ext/kernel.rb +0 -10
  145. data/spec/twitter_spec.rb +0 -0
@@ -3,653 +3,661 @@ require 'helper'
3
3
  describe Twitter::REST::API::FriendsAndFollowers do
4
4
 
5
5
  before do
6
- @client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
6
+ @client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
7
7
  end
8
8
 
9
- describe "#friend_ids" do
10
- context "with a screen name passed" do
9
+ describe '#friend_ids' do
10
+ context 'with a screen name passed' do
11
11
  before do
12
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
13
13
  end
14
- it "requests the correct resource" do
15
- @client.friend_ids("sferik")
16
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
14
+ it 'requests the correct resource' do
15
+ @client.friend_ids('sferik')
16
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
17
17
  end
18
- it "returns an array of numeric IDs for every user the specified user is following" do
19
- friend_ids = @client.friend_ids("sferik")
18
+ it 'returns an array of numeric IDs for every user the specified user is following' do
19
+ friend_ids = @client.friend_ids('sferik')
20
20
  expect(friend_ids).to be_a Twitter::Cursor
21
- expect(friend_ids.first).to eq(20009713)
21
+ expect(friend_ids.first).to eq(20_009_713)
22
22
  end
23
- context "with each" do
23
+ context 'with each' do
24
24
  before do
25
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
25
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
26
26
  end
27
- it "requests the correct resource" do
28
- @client.friend_ids("sferik").each{}
29
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
30
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
27
+ it 'requests the correct resource' do
28
+ @client.friend_ids('sferik').each {}
29
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
30
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'})).to have_been_made
31
31
  end
32
32
  end
33
33
  end
34
- context "with a user ID passed" do
34
+ context 'with a user ID passed' do
35
35
  before do
36
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
36
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
37
37
  end
38
- it "requests the correct resource" do
39
- @client.friend_ids(7505382)
40
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
38
+ it 'requests the correct resource' do
39
+ @client.friend_ids(7_505_382)
40
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
41
41
  end
42
- context "with each" do
42
+ context 'with each' do
43
43
  before do
44
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
44
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '1305102810874389703', :user_id => '7505382'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
45
45
  end
46
- it "requests the correct resource" do
47
- @client.friend_ids(7505382).each{}
48
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
49
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"})).to have_been_made
46
+ it 'requests the correct resource' do
47
+ @client.friend_ids(7_505_382).each {}
48
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
49
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '1305102810874389703', :user_id => '7505382'})).to have_been_made
50
50
  end
51
51
  end
52
52
  end
53
- context "without arguments passed" do
53
+ context 'without arguments passed' do
54
54
  before do
55
- stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
56
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
55
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
56
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
57
57
  end
58
- it "requests the correct resource" do
58
+ it 'requests the correct resource' do
59
59
  @client.friend_ids
60
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
61
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
60
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
61
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
62
62
  end
63
- it "returns an array of numeric IDs for every user the specified user is following" do
63
+ it 'returns an array of numeric IDs for every user the specified user is following' do
64
64
  friend_ids = @client.friend_ids
65
65
  expect(friend_ids).to be_a Twitter::Cursor
66
- expect(friend_ids.first).to eq(20009713)
66
+ expect(friend_ids.first).to eq(20_009_713)
67
67
  end
68
- context "with each" do
68
+ context 'with each' do
69
69
  before do
70
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
70
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
71
71
  end
72
- it "requests the correct resource" do
73
- @client.friend_ids.each{}
74
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
75
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
76
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
72
+ it 'requests the correct resource' do
73
+ @client.friend_ids.each {}
74
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
75
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
76
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'})).to have_been_made
77
77
  end
78
78
  end
79
79
  end
80
80
  end
81
81
 
82
- describe "#follower_ids" do
83
- context "with a screen name passed" do
82
+ describe '#follower_ids' do
83
+ context 'with a screen name passed' do
84
84
  before do
85
- stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
85
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
86
86
  end
87
- it "requests the correct resource" do
88
- @client.follower_ids("sferik")
89
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
87
+ it 'requests the correct resource' do
88
+ @client.follower_ids('sferik')
89
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
90
90
  end
91
- it "returns an array of numeric IDs for every user following the specified user" do
92
- follower_ids = @client.follower_ids("sferik")
91
+ it 'returns an array of numeric IDs for every user following the specified user' do
92
+ follower_ids = @client.follower_ids('sferik')
93
93
  expect(follower_ids).to be_a Twitter::Cursor
94
- expect(follower_ids.first).to eq(20009713)
94
+ expect(follower_ids.first).to eq(20_009_713)
95
95
  end
96
- context "with each" do
96
+ context 'with each' do
97
97
  before do
98
- stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
98
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
99
99
  end
100
- it "requests the correct resource" do
101
- @client.follower_ids("sferik").each{}
102
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
103
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
100
+ it 'requests the correct resource' do
101
+ @client.follower_ids('sferik').each {}
102
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
103
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'})).to have_been_made
104
104
  end
105
105
  end
106
106
  end
107
- context "with a user ID passed" do
107
+ context 'with a user ID passed' do
108
108
  before do
109
- stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
109
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
110
110
  end
111
- it "requests the correct resource" do
112
- @client.follower_ids(7505382)
113
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
111
+ it 'requests the correct resource' do
112
+ @client.follower_ids(7_505_382)
113
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
114
114
  end
115
- context "with each" do
115
+ context 'with each' do
116
116
  before do
117
- stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
117
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :user_id => '7505382'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
118
118
  end
119
- it "requests the correct resource" do
120
- @client.follower_ids(7505382).each{}
121
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
122
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"})).to have_been_made
119
+ it 'requests the correct resource' do
120
+ @client.follower_ids(7_505_382).each {}
121
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
122
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :user_id => '7505382'})).to have_been_made
123
123
  end
124
124
  end
125
125
  end
126
- context "without arguments passed" do
126
+ context 'without arguments passed' do
127
127
  before do
128
- stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
129
- stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
128
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
129
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
130
130
  end
131
- it "requests the correct resource" do
131
+ it 'requests the correct resource' do
132
132
  @client.follower_ids
133
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
134
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
133
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
134
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
135
135
  end
136
- it "returns an array of numeric IDs for every user following the specified user" do
136
+ it 'returns an array of numeric IDs for every user following the specified user' do
137
137
  follower_ids = @client.follower_ids
138
138
  expect(follower_ids).to be_a Twitter::Cursor
139
- expect(follower_ids.first).to eq(20009713)
139
+ expect(follower_ids.first).to eq(20_009_713)
140
140
  end
141
- context "with each" do
141
+ context 'with each' do
142
142
  before do
143
- stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
143
+ stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
144
144
  end
145
- it "requests the correct resource" do
146
- @client.follower_ids.each{}
147
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
148
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
149
- expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
145
+ it 'requests the correct resource' do
146
+ @client.follower_ids.each {}
147
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
148
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
149
+ expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '1305102810874389703', :screen_name => 'sferik'})).to have_been_made
150
150
  end
151
151
  end
152
152
  end
153
153
  end
154
154
 
155
- describe "#friendships" do
156
- context "with screen names passed" do
155
+ describe '#friendships' do
156
+ context 'with screen names passed' do
157
157
  before do
158
- stub_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
158
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
159
159
  end
160
- it "requests the correct resource" do
161
- @client.friendships("sferik", "pengwynn")
162
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik,pengwynn"})).to have_been_made
160
+ it 'requests the correct resource' do
161
+ @client.friendships('sferik', 'pengwynn')
162
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'})).to have_been_made
163
163
  end
164
- it "returns up to 100 users worth of extended information" do
165
- friendships = @client.friendships("sferik", "pengwynn")
164
+ it 'returns up to 100 users worth of extended information' do
165
+ friendships = @client.friendships('sferik', 'pengwynn')
166
166
  expect(friendships).to be_an Array
167
167
  expect(friendships.first).to be_a Twitter::User
168
- expect(friendships.first.id).to eq(7505382)
169
- expect(friendships.first.connections).to eq(["none"])
168
+ expect(friendships.first.id).to eq(7_505_382)
169
+ expect(friendships.first.connections).to eq(['none'])
170
170
  end
171
171
  end
172
- context "with numeric screen names passed" do
172
+ context 'with numeric screen names passed' do
173
173
  before do
174
- stub_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "0,311"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
174
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
175
175
  end
176
- it "requests the correct resource" do
177
- @client.friendships("0", "311")
178
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "0,311"})).to have_been_made
176
+ it 'requests the correct resource' do
177
+ @client.friendships('0', '311')
178
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'})).to have_been_made
179
179
  end
180
180
  end
181
- context "with user IDs passed" do
181
+ context 'with user IDs passed' do
182
182
  before do
183
- stub_get("/1.1/friendships/lookup.json").with(:query => {:user_id => "7505382,14100886"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
183
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
184
184
  end
185
- it "requests the correct resource" do
186
- @client.friendships(7505382, 14100886)
187
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:user_id => "7505382,14100886"})).to have_been_made
185
+ it 'requests the correct resource' do
186
+ @client.friendships(7_505_382, 14_100_886)
187
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'})).to have_been_made
188
188
  end
189
189
  end
190
- context "with both screen names and user IDs passed" do
190
+ context 'with both screen names and user IDs passed' do
191
191
  before do
192
- stub_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik", :user_id => "14100886"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
192
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
193
193
  end
194
- it "requests the correct resource" do
195
- @client.friendships("sferik", 14100886)
196
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik", :user_id => "14100886"})).to have_been_made
194
+ it 'requests the correct resource' do
195
+ @client.friendships('sferik', 14_100_886)
196
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'})).to have_been_made
197
197
  end
198
198
  end
199
199
  end
200
200
 
201
- describe "#friendships" do
202
- context "with screen names passed" do
201
+ describe '#friendships' do
202
+ context 'with screen names passed' do
203
203
  before do
204
- stub_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
204
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
205
205
  end
206
- it "requests the correct resource" do
207
- @client.friendships("sferik", "pengwynn")
208
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik,pengwynn"})).to have_been_made
206
+ it 'requests the correct resource' do
207
+ @client.friendships('sferik', 'pengwynn')
208
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik,pengwynn'})).to have_been_made
209
209
  end
210
- it "returns up to 100 users worth of extended information" do
211
- friendships = @client.friendships("sferik", "pengwynn")
210
+ it 'returns up to 100 users worth of extended information' do
211
+ friendships = @client.friendships('sferik', 'pengwynn')
212
212
  expect(friendships).to be_an Array
213
213
  expect(friendships.first).to be_a Twitter::User
214
- expect(friendships.first.id).to eq(7505382)
215
- expect(friendships.first.connections).to eq(["none"])
214
+ expect(friendships.first.id).to eq(7_505_382)
215
+ expect(friendships.first.connections).to eq(['none'])
216
216
  end
217
217
  end
218
- context "with numeric screen names passed" do
218
+ context 'with numeric screen names passed' do
219
219
  before do
220
- stub_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "0,311"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
220
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
221
221
  end
222
- it "requests the correct resource" do
223
- @client.friendships("0", "311")
224
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "0,311"})).to have_been_made
222
+ it 'requests the correct resource' do
223
+ @client.friendships('0', '311')
224
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => '0,311'})).to have_been_made
225
225
  end
226
226
  end
227
- context "with user IDs passed" do
227
+ context 'with user IDs passed' do
228
228
  before do
229
- stub_get("/1.1/friendships/lookup.json").with(:query => {:user_id => "7505382,14100886"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
229
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
230
230
  end
231
- it "requests the correct resource" do
232
- @client.friendships(7505382, 14100886)
233
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:user_id => "7505382,14100886"})).to have_been_made
231
+ it 'requests the correct resource' do
232
+ @client.friendships(7_505_382, 14_100_886)
233
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:user_id => '7505382,14100886'})).to have_been_made
234
234
  end
235
235
  end
236
- context "with both screen names and user IDs passed" do
236
+ context 'with both screen names and user IDs passed' do
237
237
  before do
238
- stub_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik", :user_id => "14100886"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
238
+ stub_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
239
239
  end
240
- it "requests the correct resource" do
241
- @client.friendships("sferik", 14100886)
242
- expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik", :user_id => "14100886"})).to have_been_made
240
+ it 'requests the correct resource' do
241
+ @client.friendships('sferik', 14_100_886)
242
+ expect(a_get('/1.1/friendships/lookup.json').with(:query => {:screen_name => 'sferik', :user_id => '14100886'})).to have_been_made
243
243
  end
244
244
  end
245
245
  end
246
246
 
247
- describe "#friendships_incoming" do
247
+ describe '#friendships_incoming' do
248
248
  before do
249
- stub_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
249
+ stub_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
250
250
  end
251
- it "requests the correct resource" do
251
+ it 'requests the correct resource' do
252
252
  @client.friendships_incoming
253
- expect(a_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "-1"})).to have_been_made
253
+ expect(a_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '-1'})).to have_been_made
254
254
  end
255
- it "returns an array of numeric IDs for every user who has a pending request to follow the authenticating user" do
255
+ it 'returns an array of numeric IDs for every user who has a pending request to follow the authenticating user' do
256
256
  friendships_incoming = @client.friendships_incoming
257
257
  expect(friendships_incoming).to be_a Twitter::Cursor
258
- expect(friendships_incoming.first).to eq(20009713)
258
+ expect(friendships_incoming.first).to eq(20_009_713)
259
259
  end
260
- context "with each" do
260
+ context 'with each' do
261
261
  before do
262
- stub_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
262
+ stub_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
263
263
  end
264
- it "requests the correct resource" do
265
- @client.friendships_incoming.each{}
266
- expect(a_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made
264
+ it 'requests the correct resource' do
265
+ @client.friendships_incoming.each {}
266
+ expect(a_get('/1.1/friendships/incoming.json').with(:query => {:cursor => '1305102810874389703'})).to have_been_made
267
267
  end
268
268
  end
269
269
  end
270
270
 
271
- describe "#friendships_outgoing" do
271
+ describe '#friendships_outgoing' do
272
272
  before do
273
- stub_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
273
+ stub_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '-1'}).to_return(:body => fixture('ids_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
274
274
  end
275
- it "requests the correct resource" do
275
+ it 'requests the correct resource' do
276
276
  @client.friendships_outgoing
277
- expect(a_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "-1"})).to have_been_made
277
+ expect(a_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '-1'})).to have_been_made
278
278
  end
279
- it "returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request" do
279
+ it 'returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request' do
280
280
  friendships_outgoing = @client.friendships_outgoing
281
281
  expect(friendships_outgoing).to be_a Twitter::Cursor
282
- expect(friendships_outgoing.first).to eq(20009713)
282
+ expect(friendships_outgoing.first).to eq(20_009_713)
283
283
  end
284
- context "with each" do
284
+ context 'with each' do
285
285
  before do
286
- stub_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
286
+ stub_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '1305102810874389703'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
287
287
  end
288
- it "requests the correct resource" do
289
- @client.friendships_outgoing.each{}
290
- expect(a_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made
288
+ it 'requests the correct resource' do
289
+ @client.friendships_outgoing.each {}
290
+ expect(a_get('/1.1/friendships/outgoing.json').with(:query => {:cursor => '1305102810874389703'})).to have_been_made
291
291
  end
292
292
  end
293
293
  end
294
294
 
295
- describe "#follow" do
295
+ describe '#follow' do
296
296
  before do
297
- stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
298
- stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
299
- stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
300
- stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
301
- end
302
- it "requests the correct resource" do
303
- @client.follow("sferik", "pengwynn")
304
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
305
- expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
306
- expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
307
- expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
297
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
298
+ stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('ids_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
299
+ stub_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('friendships.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
300
+ stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
301
+ end
302
+ it 'requests the correct resource' do
303
+ @client.follow('sferik', 'pengwynn')
304
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
305
+ expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
306
+ expect(a_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'})).to have_been_made
307
+ expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'})).to have_been_made
308
308
  end
309
309
  end
310
310
 
311
- describe "#follow!" do
311
+ describe '#follow!' do
312
312
  before do
313
- stub_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
313
+ stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
314
314
  end
315
- it "requests the correct resource" do
316
- @client.follow!("sferik")
317
- expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
315
+ it 'requests the correct resource' do
316
+ @client.follow!('sferik')
317
+ expect(a_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
318
318
  end
319
- it "returns an array of befriended users" do
320
- users = @client.follow!("sferik")
319
+ it 'returns an array of befriended users' do
320
+ users = @client.follow!('sferik')
321
321
  expect(users).to be_an Array
322
322
  expect(users.first).to be_a Twitter::User
323
- expect(users.first.id).to eq(7505382)
323
+ expect(users.first.id).to eq(7_505_382)
324
324
  end
325
325
  end
326
- context "with a user object passed" do
326
+ context 'with a user object passed' do
327
327
  before do
328
- stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
328
+ stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
329
329
  end
330
- it "requests the correct resources" do
331
- user = Twitter::User.new(:id => "7505382")
330
+ it 'requests the correct resources' do
331
+ user = Twitter::User.new(:id => '7505382')
332
332
  @client.follow!(user)
333
- expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
333
+ expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '7505382'})).to have_been_made
334
334
  end
335
335
  end
336
- context "with a URI object passed" do
336
+ context 'with a URI object passed' do
337
337
  before do
338
- stub_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
338
+ stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
339
339
  end
340
- it "requests the correct resource" do
341
- user = URI.parse("https://twitter.com/sferik")
340
+ it 'requests the correct resource' do
341
+ user = URI.parse('https://twitter.com/sferik')
342
342
  @client.follow!(user)
343
- expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
343
+ expect(a_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
344
344
  end
345
345
  end
346
- context "with a URI string passed" do
346
+ context 'with a URI string passed' do
347
347
  before do
348
- stub_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
348
+ stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
349
349
  end
350
- it "requests the correct resource" do
351
- @client.follow!("https://twitter.com/sferik")
352
- expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
350
+ it 'requests the correct resource' do
351
+ @client.follow!('https://twitter.com/sferik')
352
+ expect(a_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
353
+ end
354
+ end
355
+ context 'with a forbidden error' do
356
+ before do
357
+ stub_post('/1.1/friendships/create.json').with(:body => {:screen_name => 'sferik'}).to_return(:status => 403, :body => fixture('forbidden.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
358
+ end
359
+ it 'raises an exception' do
360
+ expect { @client.follow!('sferik') }.to raise_error(Twitter::Error::Forbidden)
353
361
  end
354
362
  end
355
363
 
356
- describe "#unfollow" do
364
+ describe '#unfollow' do
357
365
  before do
358
- 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"})
366
+ 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'})
359
367
  end
360
- it "requests the correct resource" do
361
- @client.unfollow("sferik")
362
- expect(a_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made
368
+ it 'requests the correct resource' do
369
+ @client.unfollow('sferik')
370
+ expect(a_post('/1.1/friendships/destroy.json').with(:body => {:screen_name => 'sferik'})).to have_been_made
363
371
  end
364
- it "returns an array of unfollowed users" do
365
- users = @client.unfollow("sferik")
372
+ it 'returns an array of unfollowed users' do
373
+ users = @client.unfollow('sferik')
366
374
  expect(users).to be_an Array
367
375
  expect(users.first).to be_a Twitter::User
368
- expect(users.first.id).to eq(7505382)
376
+ expect(users.first.id).to eq(7_505_382)
369
377
  end
370
378
  end
371
379
 
372
- describe "#friendship_update" do
380
+ describe '#friendship_update' do
373
381
  before do
374
- stub_post("/1.1/friendships/update.json").with(:body => {:screen_name => "sferik", :retweets => "true"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
382
+ stub_post('/1.1/friendships/update.json').with(:body => {:screen_name => 'sferik', :retweets => 'true'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
375
383
  end
376
- it "requests the correct resource" do
377
- @client.friendship_update("sferik", :retweets => true)
378
- expect(a_post("/1.1/friendships/update.json").with(:body => {:screen_name => "sferik", :retweets => "true"})).to have_been_made
384
+ it 'requests the correct resource' do
385
+ @client.friendship_update('sferik', :retweets => true)
386
+ expect(a_post('/1.1/friendships/update.json').with(:body => {:screen_name => 'sferik', :retweets => 'true'})).to have_been_made
379
387
  end
380
- it "returns detailed information about the relationship between two users" do
381
- relationship = @client.friendship_update("sferik", :retweets => true)
388
+ it 'returns detailed information about the relationship between two users' do
389
+ relationship = @client.friendship_update('sferik', :retweets => true)
382
390
  expect(relationship).to be_a Twitter::Relationship
383
- expect(relationship.source.id).to eq(7505382)
391
+ expect(relationship.source.id).to eq(7_505_382)
384
392
  end
385
393
  end
386
394
 
387
- describe "#friendship" do
388
- context "with screen names passed" do
395
+ describe '#friendship' do
396
+ context 'with screen names passed' do
389
397
  before do
390
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
398
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
391
399
  end
392
- it "requests the correct resource" do
393
- @client.friendship("sferik", "pengwynn")
394
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
400
+ it 'requests the correct resource' do
401
+ @client.friendship('sferik', 'pengwynn')
402
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
395
403
  end
396
- it "returns detailed information about the relationship between two users" do
397
- relationship = @client.friendship("sferik", "pengwynn")
404
+ it 'returns detailed information about the relationship between two users' do
405
+ relationship = @client.friendship('sferik', 'pengwynn')
398
406
  expect(relationship).to be_a Twitter::Relationship
399
- expect(relationship.source.id).to eq(7505382)
407
+ expect(relationship.source.id).to eq(7_505_382)
400
408
  end
401
409
  end
402
- context "with numeric screen names passed" do
410
+ context 'with numeric screen names passed' do
403
411
  before do
404
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "0", :target_screen_name => "311"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
412
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => '0', :target_screen_name => '311'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
405
413
  end
406
- it "requests the correct resource" do
407
- @client.friendship("0", "311")
408
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "0", :target_screen_name => "311"})).to have_been_made
414
+ it 'requests the correct resource' do
415
+ @client.friendship('0', '311')
416
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => '0', :target_screen_name => '311'})).to have_been_made
409
417
  end
410
418
  end
411
- context "with user IDs passed" do
419
+ context 'with user IDs passed' do
412
420
  before do
413
- stub_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
421
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
414
422
  end
415
- it "requests the correct resource" do
416
- @client.friendship(7505382, 14100886)
417
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
423
+ it 'requests the correct resource' do
424
+ @client.friendship(7_505_382, 14_100_886)
425
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
418
426
  end
419
427
  end
420
- context "with user objects passed" do
428
+ context 'with user objects passed' do
421
429
  before do
422
- stub_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
430
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
423
431
  end
424
- it "requests the correct resource" do
425
- user1 = Twitter::User.new(:id => "7505382")
426
- user2 = Twitter::User.new(:id => "14100886")
432
+ it 'requests the correct resource' do
433
+ user1 = Twitter::User.new(:id => '7505382')
434
+ user2 = Twitter::User.new(:id => '14100886')
427
435
  @client.friendship(user1, user2)
428
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
436
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
429
437
  end
430
438
  end
431
- context "with URI objects passed" do
439
+ context 'with URI objects passed' do
432
440
  before do
433
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
441
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
434
442
  end
435
- it "requests the correct resource" do
436
- user1 = URI.parse("https://twitter.com/sferik")
437
- user2 = URI.parse("https://twitter.com/pengwynn")
443
+ it 'requests the correct resource' do
444
+ user1 = URI.parse('https://twitter.com/sferik')
445
+ user2 = URI.parse('https://twitter.com/pengwynn')
438
446
  @client.friendship(user1, user2)
439
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
447
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
440
448
  end
441
449
  end
442
- context "with URI strings passed" do
450
+ context 'with URI strings passed' do
443
451
  before do
444
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
452
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
445
453
  end
446
- it "requests the correct resource" do
447
- @client.friendship("https://twitter.com/sferik", "https://twitter.com/pengwynn")
448
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
454
+ it 'requests the correct resource' do
455
+ @client.friendship('https://twitter.com/sferik', 'https://twitter.com/pengwynn')
456
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
449
457
  end
450
458
  end
451
459
  end
452
460
 
453
- describe "#friendship?" do
454
- context "with screen names passed" do
461
+ describe '#friendship?' do
462
+ context 'with screen names passed' do
455
463
  before do
456
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
457
- stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "pengwynn", :target_screen_name => "sferik"}).to_return(:body => fixture("not_following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
464
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
465
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'pengwynn', :target_screen_name => 'sferik'}).to_return(:body => fixture('not_following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
458
466
  end
459
- it "requests the correct resource" do
460
- @client.friendship?("sferik", "pengwynn")
461
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
467
+ it 'requests the correct resource' do
468
+ @client.friendship?('sferik', 'pengwynn')
469
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_screen_name => 'sferik', :target_screen_name => 'pengwynn'})).to have_been_made
462
470
  end
463
- it "returns true if user A follows user B" do
464
- friendship = @client.friendship?("sferik", "pengwynn")
471
+ it 'returns true if user A follows user B' do
472
+ friendship = @client.friendship?('sferik', 'pengwynn')
465
473
  expect(friendship).to be true
466
474
  end
467
- it "returns false if user A does not follow user B" do
468
- friendship = @client.friendship?("pengwynn", "sferik")
475
+ it 'returns false if user A does not follow user B' do
476
+ friendship = @client.friendship?('pengwynn', 'sferik')
469
477
  expect(friendship).to be false
470
478
  end
471
479
  end
472
- context "with user IDs passed" do
480
+ context 'with user IDs passed' do
473
481
  before do
474
- stub_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
482
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
475
483
  end
476
- it "requests the correct resource" do
477
- @client.friendship?(7505382, 14100886)
478
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
484
+ it 'requests the correct resource' do
485
+ @client.friendship?(7_505_382, 14_100_886)
486
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
479
487
  end
480
488
  end
481
- context "with user objects passed" do
489
+ context 'with user objects passed' do
482
490
  before do
483
- stub_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
491
+ stub_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'}).to_return(:body => fixture('following.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
484
492
  end
485
- it "requests the correct resource" do
486
- user1 = Twitter::User.new(:id => "7505382")
487
- user2 = Twitter::User.new(:id => "14100886")
493
+ it 'requests the correct resource' do
494
+ user1 = Twitter::User.new(:id => '7505382')
495
+ user2 = Twitter::User.new(:id => '14100886')
488
496
  @client.friendship?(user1, user2)
489
- expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
497
+ expect(a_get('/1.1/friendships/show.json').with(:query => {:source_id => '7505382', :target_id => '14100886'})).to have_been_made
490
498
  end
491
499
  end
492
500
  end
493
501
 
494
- describe "#followers" do
495
- context "with a screen_name passed" do
502
+ describe '#followers' do
503
+ context 'with a screen_name passed' do
496
504
  before do
497
- stub_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
505
+ stub_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
498
506
  end
499
- it "requests the correct resource" do
500
- @client.followers("sferik")
501
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
507
+ it 'requests the correct resource' do
508
+ @client.followers('sferik')
509
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
502
510
  end
503
- it "returns a cursor of followers with details for every user the specified user is followed by" do
504
- followers = @client.followers("sferik")
511
+ it 'returns a cursor of followers with details for every user the specified user is followed by' do
512
+ followers = @client.followers('sferik')
505
513
  expect(followers).to be_a Twitter::Cursor
506
514
  expect(followers.first).to be_a Twitter::User
507
515
  end
508
- context "with each" do
516
+ context 'with each' do
509
517
  before do
510
- stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
518
+ stub_get('/1.1/followers/list.json').with(:query => {:cursor => '1419103567112105362', :screen_name => 'sferik'}).to_return(:body => fixture('followers_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
511
519
  end
512
- it "requests the correct resource" do
513
- @client.followers("sferik").each{}
514
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
515
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"})).to have_been_made
520
+ it 'requests the correct resource' do
521
+ @client.followers('sferik').each {}
522
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
523
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '1419103567112105362', :screen_name => 'sferik'})).to have_been_made
516
524
  end
517
525
  end
518
526
  end
519
- context "with a user ID passed" do
527
+ context 'with a user ID passed' do
520
528
  before do
521
- stub_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("followers_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
529
+ stub_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('followers_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
522
530
  end
523
- it "requests the correct resource" do
524
- @client.followers(7505382)
525
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
531
+ it 'requests the correct resource' do
532
+ @client.followers(7_505_382)
533
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
526
534
  end
527
- context "with each" do
535
+ context 'with each' do
528
536
  before do
529
- stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :user_id => "7505382"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
537
+ stub_get('/1.1/followers/list.json').with(:query => {:cursor => '1419103567112105362', :user_id => '7505382'}).to_return(:body => fixture('followers_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
530
538
  end
531
- it "requests the correct resource" do
532
- @client.followers(7505382).each{}
533
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
534
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :user_id => "7505382"})).to have_been_made
539
+ it 'requests the correct resource' do
540
+ @client.followers(7_505_382).each {}
541
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
542
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '1419103567112105362', :user_id => '7505382'})).to have_been_made
535
543
  end
536
544
  end
537
545
  end
538
- context "without arguments passed" do
546
+ context 'without arguments passed' do
539
547
  before do
540
- stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
541
- stub_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("followers_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
548
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
549
+ stub_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('followers_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
542
550
  end
543
- it "requests the correct resource" do
551
+ it 'requests the correct resource' do
544
552
  @client.followers
545
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
546
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
553
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
554
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
547
555
  end
548
- it "returns a cursor of followers with details for every user the specified user is followed by" do
556
+ it 'returns a cursor of followers with details for every user the specified user is followed by' do
549
557
  followers = @client.followers
550
558
  expect(followers).to be_a Twitter::Cursor
551
559
  expect(followers.first).to be_a Twitter::User
552
560
  end
553
- context "with each" do
561
+ context 'with each' do
554
562
  before do
555
- stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
563
+ stub_get('/1.1/followers/list.json').with(:query => {:cursor => '1419103567112105362', :screen_name => 'sferik'}).to_return(:body => fixture('followers_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
556
564
  end
557
- it "requests the correct resource" do
558
- @client.followers.each{}
559
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
560
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
561
- expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"})).to have_been_made
565
+ it 'requests the correct resource' do
566
+ @client.followers.each {}
567
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
568
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
569
+ expect(a_get('/1.1/followers/list.json').with(:query => {:cursor => '1419103567112105362', :screen_name => 'sferik'})).to have_been_made
562
570
  end
563
571
  end
564
572
  end
565
573
  end
566
574
 
567
- describe "#friends" do
568
- context "with a screen_name passed" do
575
+ describe '#friends' do
576
+ context 'with a screen_name passed' do
569
577
  before do
570
- stub_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
578
+ stub_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
571
579
  end
572
- it "requests the correct resource" do
573
- @client.friends("sferik")
574
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
580
+ it 'requests the correct resource' do
581
+ @client.friends('sferik')
582
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
575
583
  end
576
- it "returns a cursor of friends with details for every user the specified user is following" do
577
- friends = @client.friends("sferik")
584
+ it 'returns a cursor of friends with details for every user the specified user is following' do
585
+ friends = @client.friends('sferik')
578
586
  expect(friends).to be_a Twitter::Cursor
579
587
  expect(friends.first).to be_a Twitter::User
580
588
  end
581
- context "with each" do
589
+ context 'with each' do
582
590
  before do
583
- stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
591
+ stub_get('/1.1/friends/list.json').with(:query => {:cursor => '1418947360875712729', :screen_name => 'sferik'}).to_return(:body => fixture('friends_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
584
592
  end
585
- it "requests the correct resource" do
586
- @client.friends("sferik").each{}
587
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
588
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"})).to have_been_made
593
+ it 'requests the correct resource' do
594
+ @client.friends('sferik').each {}
595
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
596
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '1418947360875712729', :screen_name => 'sferik'})).to have_been_made
589
597
  end
590
598
  end
591
599
  end
592
- context "with a user ID passed" do
600
+ context 'with a user ID passed' do
593
601
  before do
594
- stub_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"}).to_return(:body => fixture("friends_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
602
+ stub_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
595
603
  end
596
- it "requests the correct resource" do
597
- @client.friends(7505382)
598
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
604
+ it 'requests the correct resource' do
605
+ @client.friends(7_505_382)
606
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
599
607
  end
600
- context "with each" do
608
+ context 'with each' do
601
609
  before do
602
- stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :user_id => "7505382"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
610
+ stub_get('/1.1/friends/list.json').with(:query => {:cursor => '1418947360875712729', :user_id => '7505382'}).to_return(:body => fixture('friends_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
603
611
  end
604
- it "requests the correct resource" do
605
- @client.friends(7505382).each{}
606
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
607
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :user_id => "7505382"})).to have_been_made
612
+ it 'requests the correct resource' do
613
+ @client.friends(7_505_382).each {}
614
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
615
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '1418947360875712729', :user_id => '7505382'})).to have_been_made
608
616
  end
609
617
  end
610
618
  end
611
- context "without arguments passed" do
619
+ context 'without arguments passed' do
612
620
  before do
613
- stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
614
- stub_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("friends_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
621
+ stub_get('/1.1/account/verify_credentials.json').to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
622
+ stub_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'}).to_return(:body => fixture('friends_list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
615
623
  end
616
- it "requests the correct resource" do
624
+ it 'requests the correct resource' do
617
625
  @client.friends
618
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
619
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
626
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
627
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
620
628
  end
621
- it "returns a cursor of friends with details for every user the specified user is following" do
629
+ it 'returns a cursor of friends with details for every user the specified user is following' do
622
630
  friends = @client.friends
623
631
  expect(friends).to be_a Twitter::Cursor
624
632
  expect(friends.first).to be_a Twitter::User
625
633
  end
626
- context "with each" do
634
+ context 'with each' do
627
635
  before do
628
- stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
636
+ stub_get('/1.1/friends/list.json').with(:query => {:cursor => '1418947360875712729', :screen_name => 'sferik'}).to_return(:body => fixture('friends_list2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
629
637
  end
630
- it "requests the correct resource" do
631
- @client.friends.each{}
632
- expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
633
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
634
- expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"})).to have_been_made
638
+ it 'requests the correct resource' do
639
+ @client.friends.each {}
640
+ expect(a_get('/1.1/account/verify_credentials.json')).to have_been_made
641
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '-1', :screen_name => 'sferik'})).to have_been_made
642
+ expect(a_get('/1.1/friends/list.json').with(:query => {:cursor => '1418947360875712729', :screen_name => 'sferik'})).to have_been_made
635
643
  end
636
644
  end
637
645
  end
638
646
  end
639
647
 
640
- describe "#no_retweet_ids" do
648
+ describe '#no_retweet_ids' do
641
649
  before do
642
- stub_get("/1.1/friendships/no_retweets/ids.json").to_return(:body => fixture("ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
650
+ stub_get('/1.1/friendships/no_retweets/ids.json').to_return(:body => fixture('ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
643
651
  end
644
- it "requests the correct resource" do
652
+ it 'requests the correct resource' do
645
653
  @client.no_retweet_ids
646
- expect(a_get("/1.1/friendships/no_retweets/ids.json")).to have_been_made
654
+ expect(a_get('/1.1/friendships/no_retweets/ids.json')).to have_been_made
647
655
  end
648
- it "requests the correct resource when the alias is called" do
656
+ it 'requests the correct resource when the alias is called' do
649
657
  @client.no_retweets_ids
650
- expect(a_get("/1.1/friendships/no_retweets/ids.json")).to have_been_made
658
+ expect(a_get('/1.1/friendships/no_retweets/ids.json')).to have_been_made
651
659
  end
652
- it "returns users ids of those that do not wish to be retweeted" do
660
+ it 'returns users ids of those that do not wish to be retweeted' do
653
661
  no_retweet_ids = @client.no_retweet_ids
654
662
  expect(no_retweet_ids).to be_an Array
655
663
  expect(no_retweet_ids.first).to be_an Integer