twitter 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/README.md +11 -9
  3. data/lib/twitter/api.rb +3 -5
  4. data/lib/twitter/base.rb +1 -4
  5. data/lib/twitter/geo/point.rb +2 -2
  6. data/lib/twitter/request/multipart_with_file.rb +1 -1
  7. data/lib/twitter/tweet.rb +9 -1
  8. data/lib/twitter/user.rb +2 -0
  9. data/lib/twitter/version.rb +1 -1
  10. data/spec/fixtures/status.json +1 -1
  11. data/spec/helper.rb +6 -0
  12. data/spec/twitter/action/favorite_spec.rb +6 -6
  13. data/spec/twitter/action/follow_spec.rb +6 -6
  14. data/spec/twitter/action/list_member_added_spec.rb +9 -9
  15. data/spec/twitter/action/mention_spec.rb +11 -11
  16. data/spec/twitter/action/reply_spec.rb +9 -9
  17. data/spec/twitter/action/retweet_spec.rb +9 -9
  18. data/spec/twitter/action_factory_spec.rb +7 -9
  19. data/spec/twitter/action_spec.rb +2 -2
  20. data/spec/twitter/api/account_spec.rb +38 -66
  21. data/spec/twitter/api/activity_spec.rb +6 -10
  22. data/spec/twitter/api/blocks_spec.rb +38 -83
  23. data/spec/twitter/api/direct_messages_spec.rb +33 -55
  24. data/spec/twitter/api/friendships_spec.rb +124 -266
  25. data/spec/twitter/api/geo_spec.rb +18 -36
  26. data/spec/twitter/api/help_spec.rb +15 -23
  27. data/spec/twitter/api/lists_spec.rb +172 -402
  28. data/spec/twitter/api/report_spam_spec.rb +5 -9
  29. data/spec/twitter/api/saved_searches_spec.rb +23 -35
  30. data/spec/twitter/api/search_spec.rb +15 -25
  31. data/spec/twitter/api/statuses_spec.rb +137 -235
  32. data/spec/twitter/api/trends_spec.rb +17 -29
  33. data/spec/twitter/api/users_spec.rb +90 -181
  34. data/spec/twitter/base_spec.rb +38 -40
  35. data/spec/twitter/basic_user_spec.rb +3 -3
  36. data/spec/twitter/client_spec.rb +28 -46
  37. data/spec/twitter/configuration_spec.rb +3 -3
  38. data/spec/twitter/cursor_spec.rb +16 -32
  39. data/spec/twitter/direct_message_spec.rb +9 -9
  40. data/spec/twitter/error/client_error_spec.rb +4 -12
  41. data/spec/twitter/error/server_error_spec.rb +2 -6
  42. data/spec/twitter/error_spec.rb +2 -2
  43. data/spec/twitter/geo/point_spec.rb +6 -6
  44. data/spec/twitter/geo/polygon_spec.rb +4 -4
  45. data/spec/twitter/geo_factory_spec.rb +3 -5
  46. data/spec/twitter/geo_spec.rb +4 -4
  47. data/spec/twitter/identifiable_spec.rb +9 -13
  48. data/spec/twitter/list_spec.rb +7 -7
  49. data/spec/twitter/media/photo_spec.rb +6 -6
  50. data/spec/twitter/media_factory_spec.rb +2 -4
  51. data/spec/twitter/oembed_spec.rb +24 -24
  52. data/spec/twitter/place_spec.rb +13 -13
  53. data/spec/twitter/rate_limit_spec.rb +16 -16
  54. data/spec/twitter/relationship_spec.rb +5 -5
  55. data/spec/twitter/saved_search_spec.rb +5 -5
  56. data/spec/twitter/search_results_spec.rb +21 -21
  57. data/spec/twitter/settings_spec.rb +2 -2
  58. data/spec/twitter/size_spec.rb +6 -6
  59. data/spec/twitter/source_user_spec.rb +3 -3
  60. data/spec/twitter/suggestion_spec.rb +9 -9
  61. data/spec/twitter/target_user_spec.rb +3 -3
  62. data/spec/twitter/trend_spec.rb +6 -6
  63. data/spec/twitter/tweet_spec.rb +69 -69
  64. data/spec/twitter/user_spec.rb +43 -43
  65. data/spec/twitter_spec.rb +12 -16
  66. metadata +2 -2
@@ -8,133 +8,111 @@ describe Twitter::API do
8
8
 
9
9
  describe "#direct_messages_received" do
10
10
  before do
11
- stub_get("/1.1/direct_messages.json").
12
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
11
+ stub_get("/1.1/direct_messages.json").to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
13
12
  end
14
13
  it "requests the correct resource" do
15
14
  @client.direct_messages_received
16
- a_get("/1.1/direct_messages.json").
17
- should have_been_made
15
+ expect(a_get("/1.1/direct_messages.json")).to have_been_made
18
16
  end
19
17
  it "returns the 20 most recent direct messages sent to the authenticating user" do
20
18
  direct_messages = @client.direct_messages_received
21
- direct_messages.should be_an Array
22
- direct_messages.first.should be_a Twitter::DirectMessage
23
- direct_messages.first.sender.id.should eq 7505382
19
+ expect(direct_messages).to be_an Array
20
+ expect(direct_messages.first).to be_a Twitter::DirectMessage
21
+ expect(direct_messages.first.sender.id).to eq 7505382
24
22
  end
25
23
  end
26
24
 
27
25
  describe "#direct_messages_sent" do
28
26
  before do
29
- stub_get("/1.1/direct_messages/sent.json").
30
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
27
+ stub_get("/1.1/direct_messages/sent.json").to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
31
28
  end
32
29
  it "requests the correct resource" do
33
30
  @client.direct_messages_sent
34
- a_get("/1.1/direct_messages/sent.json").
35
- should have_been_made
31
+ expect(a_get("/1.1/direct_messages/sent.json")).to have_been_made
36
32
  end
37
33
  it "returns the 20 most recent direct messages sent by the authenticating user" do
38
34
  direct_messages = @client.direct_messages_sent
39
- direct_messages.should be_an Array
40
- direct_messages.first.should be_a Twitter::DirectMessage
41
- direct_messages.first.sender.id.should eq 7505382
35
+ expect(direct_messages).to be_an Array
36
+ expect(direct_messages.first).to be_a Twitter::DirectMessage
37
+ expect(direct_messages.first.sender.id).to eq 7505382
42
38
  end
43
39
  end
44
40
 
45
41
  describe "#direct_message_destroy" do
46
42
  before do
47
- stub_post("/1.1/direct_messages/destroy.json").
48
- with(:body => {:id => "1825785544"}).
49
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
43
+ stub_post("/1.1/direct_messages/destroy.json").with(:body => {:id => "1825785544"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
50
44
  end
51
45
  it "requests the correct resource" do
52
46
  @client.direct_message_destroy(1825785544)
53
- a_post("/1.1/direct_messages/destroy.json").
54
- with(:body => {:id => "1825785544"}).
55
- should have_been_made
47
+ expect(a_post("/1.1/direct_messages/destroy.json").with(:body => {:id => "1825785544"})).to have_been_made
56
48
  end
57
49
  it "returns an array of deleted messages" do
58
50
  direct_messages = @client.direct_message_destroy(1825785544)
59
- direct_messages.should be_an Array
60
- direct_messages.first.should be_a Twitter::DirectMessage
61
- direct_messages.first.sender.id.should eq 7505382
51
+ expect(direct_messages).to be_an Array
52
+ expect(direct_messages.first).to be_a Twitter::DirectMessage
53
+ expect(direct_messages.first.sender.id).to eq 7505382
62
54
  end
63
55
  end
64
56
 
65
57
  describe "#direct_message_create" do
66
58
  before do
67
- stub_post("/1.1/direct_messages/new.json").
68
- with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
69
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
59
+ 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"})
70
60
  end
71
61
  it "requests the correct resource" do
72
62
  @client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem")
73
- a_post("/1.1/direct_messages/new.json").
74
- with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
75
- should have_been_made
63
+ expect(a_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
76
64
  end
77
65
  it "returns the sent message" do
78
66
  direct_message = @client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem")
79
- direct_message.should be_a Twitter::DirectMessage
80
- direct_message.text.should eq "Creating a fixture for the Twitter gem"
67
+ expect(direct_message).to be_a Twitter::DirectMessage
68
+ expect(direct_message.text).to eq "Creating a fixture for the Twitter gem"
81
69
  end
82
70
  end
83
71
 
84
72
  describe "#direct_message" do
85
73
  before do
86
- stub_get("/1.1/direct_messages/show.json").
87
- with(:query => {:id => "1825786345"}).
88
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
74
+ stub_get("/1.1/direct_messages/show.json").with(:query => {:id => "1825786345"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
89
75
  end
90
76
  it "requests the correct resource" do
91
77
  @client.direct_message(1825786345)
92
- a_get("/1.1/direct_messages/show.json").
93
- with(:query => {:id => "1825786345"}).
94
- should have_been_made
78
+ expect(a_get("/1.1/direct_messages/show.json").with(:query => {:id => "1825786345"})).to have_been_made
95
79
  end
96
80
  it "returns the specified direct message" do
97
81
  direct_message = @client.direct_message(1825786345)
98
- direct_message.should be_a Twitter::DirectMessage
99
- direct_message.sender.id.should eq 7505382
82
+ expect(direct_message).to be_a Twitter::DirectMessage
83
+ expect(direct_message.sender.id).to eq 7505382
100
84
  end
101
85
  end
102
86
 
103
87
  describe "#direct_messages" do
104
88
  context "with ids passed" do
105
89
  before do
106
- stub_get("/1.1/direct_messages/show.json").
107
- with(:query => {:id => "1825786345"}).
108
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
90
+ stub_get("/1.1/direct_messages/show.json").with(:query => {:id => "1825786345"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
109
91
  end
110
92
  it "requests the correct resource" do
111
93
  @client.direct_messages(1825786345)
112
- a_get("/1.1/direct_messages/show.json").
113
- with(:query => {:id => "1825786345"}).
114
- should have_been_made
94
+ expect(a_get("/1.1/direct_messages/show.json").with(:query => {:id => "1825786345"})).to have_been_made
115
95
  end
116
96
  it "returns an array of direct messages" do
117
97
  direct_messages = @client.direct_messages(1825786345)
118
- direct_messages.should be_an Array
119
- direct_messages.first.should be_a Twitter::DirectMessage
120
- direct_messages.first.sender.id.should eq 7505382
98
+ expect(direct_messages).to be_an Array
99
+ expect(direct_messages.first).to be_a Twitter::DirectMessage
100
+ expect(direct_messages.first.sender.id).to eq 7505382
121
101
  end
122
102
  end
123
103
  context "without ids passed" do
124
104
  before do
125
- stub_get("/1.1/direct_messages.json").
126
- to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
105
+ stub_get("/1.1/direct_messages.json").to_return(:body => fixture("direct_messages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
127
106
  end
128
107
  it "requests the correct resource" do
129
108
  @client.direct_messages
130
- a_get("/1.1/direct_messages.json").
131
- should have_been_made
109
+ expect(a_get("/1.1/direct_messages.json")).to have_been_made
132
110
  end
133
111
  it "returns the 20 most recent direct messages sent to the authenticating user" do
134
112
  direct_messages = @client.direct_messages
135
- direct_messages.should be_an Array
136
- direct_messages.first.should be_a Twitter::DirectMessage
137
- direct_messages.first.sender.id.should eq 7505382
113
+ expect(direct_messages).to be_an Array
114
+ expect(direct_messages.first).to be_a Twitter::DirectMessage
115
+ expect(direct_messages.first.sender.id).to eq 7505382
138
116
  end
139
117
  end
140
118
  end
@@ -9,40 +9,32 @@ describe Twitter::API do
9
9
  describe "#follower_ids" do
10
10
  context "with a screen_name passed" do
11
11
  before do
12
- stub_get("/1.1/followers/ids.json").
13
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
14
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ 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"})
15
13
  end
16
14
  it "requests the correct resource" do
17
15
  @client.follower_ids("sferik")
18
- a_get("/1.1/followers/ids.json").
19
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
20
- should have_been_made
16
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
21
17
  end
22
18
  it "returns an array of numeric IDs for every user following the specified user" do
23
19
  follower_ids = @client.follower_ids("sferik")
24
- follower_ids.should be_a Twitter::Cursor
25
- follower_ids.ids.should be_an Array
26
- follower_ids.ids.first.should eq 14100886
20
+ expect(follower_ids).to be_a Twitter::Cursor
21
+ expect(follower_ids.ids).to be_an Array
22
+ expect(follower_ids.ids.first).to eq 14100886
27
23
  end
28
24
  end
29
25
  context "without arguments passed" do
30
26
  before do
31
- stub_get("/1.1/followers/ids.json").
32
- with(:query => {:cursor => "-1"}).
33
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
27
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
34
28
  end
35
29
  it "requests the correct resource" do
36
30
  @client.follower_ids
37
- a_get("/1.1/followers/ids.json").
38
- with(:query => {:cursor => "-1"}).
39
- should have_been_made
31
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
40
32
  end
41
33
  it "returns an array of numeric IDs for every user following the specified user" do
42
34
  follower_ids = @client.follower_ids
43
- follower_ids.should be_a Twitter::Cursor
44
- follower_ids.ids.should be_an Array
45
- follower_ids.ids.first.should eq 14100886
35
+ expect(follower_ids).to be_a Twitter::Cursor
36
+ expect(follower_ids.ids).to be_an Array
37
+ expect(follower_ids.ids.first).to eq 14100886
46
38
  end
47
39
  end
48
40
  end
@@ -50,40 +42,32 @@ describe Twitter::API do
50
42
  describe "#friend_ids" do
51
43
  context "with a screen_name passed" do
52
44
  before do
53
- stub_get("/1.1/friends/ids.json").
54
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
55
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
45
+ 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"})
56
46
  end
57
47
  it "requests the correct resource" do
58
48
  @client.friend_ids("sferik")
59
- a_get("/1.1/friends/ids.json").
60
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
61
- should have_been_made
49
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
62
50
  end
63
51
  it "returns an array of numeric IDs for every user the specified user is following" do
64
52
  friend_ids = @client.friend_ids("sferik")
65
- friend_ids.should be_a Twitter::Cursor
66
- friend_ids.ids.should be_an Array
67
- friend_ids.ids.first.should eq 14100886
53
+ expect(friend_ids).to be_a Twitter::Cursor
54
+ expect(friend_ids.ids).to be_an Array
55
+ expect(friend_ids.ids.first).to eq 14100886
68
56
  end
69
57
  end
70
58
  context "without arguments passed" do
71
59
  before do
72
- stub_get("/1.1/friends/ids.json").
73
- with(:query => {:cursor => "-1"}).
74
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
60
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
75
61
  end
76
62
  it "requests the correct resource" do
77
63
  @client.friend_ids
78
- a_get("/1.1/friends/ids.json").
79
- with(:query => {:cursor => "-1"}).
80
- should have_been_made
64
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
81
65
  end
82
66
  it "returns an array of numeric IDs for every user the specified user is following" do
83
67
  friend_ids = @client.friend_ids
84
- friend_ids.should be_a Twitter::Cursor
85
- friend_ids.ids.should be_an Array
86
- friend_ids.ids.first.should eq 14100886
68
+ expect(friend_ids).to be_a Twitter::Cursor
69
+ expect(friend_ids.ids).to be_an Array
70
+ expect(friend_ids.ids.first).to eq 14100886
87
71
  end
88
72
  end
89
73
  end
@@ -91,156 +75,118 @@ describe Twitter::API do
91
75
  describe "#friendship?" do
92
76
  context "with screen names passed" do
93
77
  before do
94
- stub_get("/1.1/friendships/show.json").
95
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).
96
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
97
- stub_get("/1.1/friendships/show.json").
98
- with(:query => {:source_screen_name => "pengwynn", :target_screen_name => "sferik"}).
99
- to_return(:body => fixture("not_following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
78
+ 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"})
79
+ 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"})
100
80
  end
101
81
  it "requests the correct resource" do
102
82
  @client.friendship?("sferik", "pengwynn")
103
- a_get("/1.1/friendships/show.json").
104
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).
105
- should have_been_made
83
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
106
84
  end
107
85
  it "returns true if user A follows user B" do
108
86
  friendship = @client.friendship?("sferik", "pengwynn")
109
- friendship.should be_true
87
+ expect(friendship).to be_true
110
88
  end
111
89
  it "returns false if user A does not follow user B" do
112
90
  friendship = @client.friendship?("pengwynn", "sferik")
113
- friendship.should be_false
91
+ expect(friendship).to be_false
114
92
  end
115
93
  end
116
94
  context "with user IDs passed" do
117
95
  before do
118
- stub_get("/1.1/friendships/show.json").
119
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
120
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
96
+ 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"})
121
97
  end
122
98
  it "requests the correct resource" do
123
99
  @client.friendship?(7505382, 14100886)
124
- a_get("/1.1/friendships/show.json").
125
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
126
- should have_been_made
100
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
127
101
  end
128
102
  end
129
103
  context "with user objects passed" do
130
104
  before do
131
- stub_get("/1.1/friendships/show.json").
132
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
133
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
105
+ 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"})
134
106
  end
135
107
  it "requests the correct resource" do
136
108
  user1 = Twitter::User.new(:id => '7505382')
137
109
  user2 = Twitter::User.new(:id => '14100886')
138
110
  @client.friendship?(user1, user2)
139
- a_get("/1.1/friendships/show.json").
140
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
141
- should have_been_made
111
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
142
112
  end
143
113
  end
144
114
  end
145
115
 
146
116
  describe "#friendships_incoming" do
147
117
  before do
148
- stub_get("/1.1/friendships/incoming.json").
149
- with(:query => {:cursor => "-1"}).
150
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
118
+ 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"})
151
119
  end
152
120
  it "requests the correct resource" do
153
121
  @client.friendships_incoming
154
- a_get("/1.1/friendships/incoming.json").
155
- with(:query => {:cursor => "-1"}).
156
- should have_been_made
122
+ expect(a_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "-1"})).to have_been_made
157
123
  end
158
124
  it "returns an array of numeric IDs for every user who has a pending request to follow the authenticating user" do
159
125
  friendships_incoming = @client.friendships_incoming
160
- friendships_incoming.should be_a Twitter::Cursor
161
- friendships_incoming.ids.should be_an Array
162
- friendships_incoming.ids.first.should eq 14100886
126
+ expect(friendships_incoming).to be_a Twitter::Cursor
127
+ expect(friendships_incoming.ids).to be_an Array
128
+ expect(friendships_incoming.ids.first).to eq 14100886
163
129
  end
164
130
  end
165
131
 
166
132
  describe "#friendships_outgoing" do
167
133
  before do
168
- stub_get("/1.1/friendships/outgoing.json").
169
- with(:query => {:cursor => "-1"}).
170
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
134
+ 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"})
171
135
  end
172
136
  it "requests the correct resource" do
173
137
  @client.friendships_outgoing
174
- a_get("/1.1/friendships/outgoing.json").
175
- with(:query => {:cursor => "-1"}).
176
- should have_been_made
138
+ expect(a_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "-1"})).to have_been_made
177
139
  end
178
140
  it "returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request" do
179
141
  friendships_outgoing = @client.friendships_outgoing
180
- friendships_outgoing.should be_a Twitter::Cursor
181
- friendships_outgoing.ids.should be_an Array
182
- friendships_outgoing.ids.first.should eq 14100886
142
+ expect(friendships_outgoing).to be_a Twitter::Cursor
143
+ expect(friendships_outgoing.ids).to be_an Array
144
+ expect(friendships_outgoing.ids.first).to eq 14100886
183
145
  end
184
146
  end
185
147
 
186
148
  describe "#friendship" do
187
149
  context "with screen names passed" do
188
150
  before do
189
- stub_get("/1.1/friendships/show.json").
190
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).
191
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
151
+ 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"})
192
152
  end
193
153
  it "requests the correct resource" do
194
154
  @client.friendship("sferik", "pengwynn")
195
- a_get("/1.1/friendships/show.json").
196
- with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).
197
- should have_been_made
155
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
198
156
  end
199
157
  it "returns detailed information about the relationship between two users" do
200
158
  relationship = @client.friendship("sferik", "pengwynn")
201
- relationship.should be_a Twitter::Relationship
202
- relationship.source.id.should eq 7505382
159
+ expect(relationship).to be_a Twitter::Relationship
160
+ expect(relationship.source.id).to eq 7505382
203
161
  end
204
162
  end
205
163
  context "with numeric screen names passed" do
206
164
  before do
207
- stub_get("/1.1/friendships/show.json").
208
- with(:query => {:source_screen_name => "0", :target_screen_name => "311"}).
209
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
165
+ 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"})
210
166
  end
211
167
  it "requests the correct resource" do
212
168
  @client.friendship("0", "311")
213
- a_get("/1.1/friendships/show.json").
214
- with(:query => {:source_screen_name => "0", :target_screen_name => "311"}).
215
- should have_been_made
169
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "0", :target_screen_name => "311"})).to have_been_made
216
170
  end
217
171
  end
218
172
  context "with user IDs passed" do
219
173
  before do
220
- stub_get("/1.1/friendships/show.json").
221
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
222
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
174
+ 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"})
223
175
  end
224
176
  it "requests the correct resource" do
225
177
  @client.friendship(7505382, 14100886)
226
- a_get("/1.1/friendships/show.json").
227
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
228
- should have_been_made
178
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
229
179
  end
230
180
  end
231
181
  context "with user objects passed" do
232
182
  before do
233
- stub_get("/1.1/friendships/show.json").
234
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
235
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
183
+ 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"})
236
184
  end
237
185
  it "requests the correct resource" do
238
186
  user1 = Twitter::User.new(:id => '7505382')
239
187
  user2 = Twitter::User.new(:id => '14100886')
240
188
  @client.friendship(user1, user2)
241
- a_get("/1.1/friendships/show.json").
242
- with(:query => {:source_id => "7505382", :target_id => "14100886"}).
243
- should have_been_made
189
+ expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
244
190
  end
245
191
  end
246
192
  end
@@ -248,95 +194,59 @@ describe Twitter::API do
248
194
  describe "#follow" do
249
195
  context "with :follow => true passed" do
250
196
  before do
251
- stub_get("/1.1/friends/ids.json").
252
- with(:query => {:cursor => "-1"}).
253
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
254
- stub_post("/1.1/users/lookup.json").
255
- with(:body => {:screen_name => "sferik,pengwynn"}).
256
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
257
- stub_post("/1.1/friendships/create.json").
258
- with(:body => {:user_id => "7505382", :follow => "true"}).
259
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
197
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
198
+ 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"})
199
+ stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382", :follow => "true"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
260
200
  end
261
201
  it "requests the correct resource" do
262
202
  @client.follow("sferik", "pengwynn", :follow => true)
263
- a_get("/1.1/friends/ids.json").
264
- with(:query => {:cursor => "-1"}).
265
- should have_been_made
266
- a_post("/1.1/users/lookup.json").
267
- with(:body => {:screen_name => "sferik,pengwynn"}).
268
- should have_been_made
269
- a_post("/1.1/friendships/create.json").
270
- with(:body => {:user_id => "7505382", :follow => "true"}).
271
- should have_been_made
203
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
204
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
205
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382", :follow => "true"})).to have_been_made
272
206
  end
273
207
  it "returns an array of befriended users" do
274
208
  users = @client.follow("sferik", "pengwynn", :follow => true)
275
- users.should be_an Array
276
- users.first.should be_a Twitter::User
277
- users.first.id.should eq 7505382
209
+ expect(users).to be_an Array
210
+ expect(users.first).to be_a Twitter::User
211
+ expect(users.first.id).to eq 7505382
278
212
  end
279
213
  end
280
214
  context "with :follow => false passed" do
281
215
  before do
282
- stub_get("/1.1/friends/ids.json").
283
- with(:query => {:cursor => "-1"}).
284
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
285
- stub_post("/1.1/users/lookup.json").
286
- with(:body => {:screen_name => "sferik,pengwynn"}).
287
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
288
- stub_post("/1.1/friendships/create.json").
289
- with(:body => {:user_id => "7505382"}).
290
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
216
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
217
+ 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"})
218
+ 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"})
291
219
  end
292
220
  it "requests the correct resource" do
293
221
  @client.follow("sferik", "pengwynn", :follow => false)
294
- a_get("/1.1/friends/ids.json").
295
- with(:query => {:cursor => "-1"}).
296
- should have_been_made
297
- a_post("/1.1/users/lookup.json").
298
- with(:body => {:screen_name => "sferik,pengwynn"}).
299
- should have_been_made
300
- a_post("/1.1/friendships/create.json").
301
- with(:body => {:user_id => "7505382"}).
302
- should have_been_made
222
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
223
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
224
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
303
225
  end
304
226
  it "returns an array of befriended users" do
305
227
  users = @client.follow("sferik", "pengwynn", :follow => false)
306
- users.should be_an Array
307
- users.first.should be_a Twitter::User
308
- users.first.id.should eq 7505382
228
+ expect(users).to be_an Array
229
+ expect(users.first).to be_a Twitter::User
230
+ expect(users.first.id).to eq 7505382
309
231
  end
310
232
  end
311
233
  context "without :follow passed" do
312
234
  before do
313
- stub_get("/1.1/friends/ids.json").
314
- with(:query => {:cursor => "-1"}).
315
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
316
- stub_post("/1.1/users/lookup.json").
317
- with(:body => {:screen_name => "sferik,pengwynn"}).
318
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
319
- stub_post("/1.1/friendships/create.json").
320
- with(:body => {:user_id => "7505382"}).
321
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
235
+ stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
236
+ 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"})
237
+ 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"})
322
238
  end
323
239
  it "requests the correct resource" do
324
240
  @client.follow("sferik", "pengwynn")
325
- a_get("/1.1/friends/ids.json").
326
- with(:query => {:cursor => "-1"}).
327
- should have_been_made
328
- a_post("/1.1/users/lookup.json").
329
- with(:body => {:screen_name => "sferik,pengwynn"}).
330
- should have_been_made
331
- a_post("/1.1/friendships/create.json").
332
- with(:body => {:user_id => "7505382"}).
333
- should have_been_made
241
+ expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1"})).to have_been_made
242
+ expect(a_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"})).to have_been_made
243
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
334
244
  end
335
245
  it "returns an array of befriended users" do
336
246
  users = @client.follow("sferik", "pengwynn")
337
- users.should be_an Array
338
- users.first.should be_a Twitter::User
339
- users.first.id.should eq 7505382
247
+ expect(users).to be_an Array
248
+ expect(users.first).to be_a Twitter::User
249
+ expect(users.first.id).to eq 7505382
340
250
  end
341
251
  end
342
252
  end
@@ -344,141 +254,109 @@ describe Twitter::API do
344
254
  describe "#follow!" do
345
255
  context "with :follow => true passed" do
346
256
  before do
347
- stub_post("/1.1/friendships/create.json").
348
- with(:body => {:screen_name => "sferik", :follow => "true"}).
349
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
257
+ stub_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik", :follow => "true"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
350
258
  end
351
259
  it "requests the correct resource" do
352
260
  @client.follow!("sferik", :follow => true)
353
- a_post("/1.1/friendships/create.json").
354
- with(:body => {:screen_name => "sferik", :follow => "true"}).
355
- should have_been_made
261
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik", :follow => "true"})).to have_been_made
356
262
  end
357
263
  it "returns an array of befriended users" do
358
264
  users = @client.follow!("sferik", :follow => true)
359
- users.should be_an Array
360
- users.first.should be_a Twitter::User
361
- users.first.id.should eq 7505382
265
+ expect(users).to be_an Array
266
+ expect(users.first).to be_a Twitter::User
267
+ expect(users.first.id).to eq 7505382
362
268
  end
363
269
  end
364
270
  context "with :follow => false passed" do
365
271
  before do
366
- stub_post("/1.1/friendships/create.json").
367
- with(:body => {:screen_name => "sferik"}).
368
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
272
+ 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"})
369
273
  end
370
274
  it "requests the correct resource" do
371
275
  @client.follow!("sferik", :follow => false)
372
- a_post("/1.1/friendships/create.json").
373
- with(:body => {:screen_name => "sferik"}).
374
- should have_been_made
276
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
375
277
  end
376
278
  it "returns an array of befriended users" do
377
279
  users = @client.follow!("sferik", :follow => false)
378
- users.should be_an Array
379
- users.first.should be_a Twitter::User
380
- users.first.id.should eq 7505382
280
+ expect(users).to be_an Array
281
+ expect(users.first).to be_a Twitter::User
282
+ expect(users.first.id).to eq 7505382
381
283
  end
382
284
  end
383
285
  context "without :follow passed" do
384
286
  before do
385
- stub_post("/1.1/friendships/create.json").
386
- with(:body => {:screen_name => "sferik"}).
387
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
287
+ 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"})
388
288
  end
389
289
  it "requests the correct resource" do
390
290
  @client.follow!("sferik")
391
- a_post("/1.1/friendships/create.json").
392
- with(:body => {:screen_name => "sferik"}).
393
- should have_been_made
291
+ expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
394
292
  end
395
293
  it "returns an array of befriended users" do
396
294
  users = @client.follow!("sferik")
397
- users.should be_an Array
398
- users.first.should be_a Twitter::User
399
- users.first.id.should eq 7505382
295
+ expect(users).to be_an Array
296
+ expect(users.first).to be_a Twitter::User
297
+ expect(users.first.id).to eq 7505382
400
298
  end
401
299
  end
402
300
  end
403
301
 
404
302
  describe "#unfollow" do
405
303
  before do
406
- stub_post("/1.1/friendships/destroy.json").
407
- with(:body => {:screen_name => "sferik"}).
408
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
304
+ 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"})
409
305
  end
410
306
  it "requests the correct resource" do
411
307
  @client.unfollow("sferik")
412
- a_post("/1.1/friendships/destroy.json").
413
- with(:body => {:screen_name => "sferik"}).
414
- should have_been_made
308
+ expect(a_post("/1.1/friendships/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made
415
309
  end
416
310
  it "returns an array of unfollowed users" do
417
311
  users = @client.friendship_destroy("sferik")
418
- users.should be_an Array
419
- users.first.should be_a Twitter::User
420
- users.first.id.should eq 7505382
312
+ expect(users).to be_an Array
313
+ expect(users.first).to be_a Twitter::User
314
+ expect(users.first.id).to eq 7505382
421
315
  end
422
316
  end
423
317
 
424
318
  describe "#friendships" do
425
319
  context "with screen names passed" do
426
320
  before do
427
- stub_get("/1.1/friendships/lookup.json").
428
- with(:query => {:screen_name => "sferik,pengwynn"}).
429
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
321
+ 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"})
430
322
  end
431
323
  it "requests the correct resource" do
432
324
  @client.friendships("sferik", "pengwynn")
433
- a_get("/1.1/friendships/lookup.json").
434
- with(:query => {:screen_name => "sferik,pengwynn"}).
435
- should have_been_made
325
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik,pengwynn"})).to have_been_made
436
326
  end
437
327
  it "returns up to 100 users worth of extended information" do
438
328
  friendships = @client.friendships("sferik", "pengwynn")
439
- friendships.should be_an Array
440
- friendships.first.should be_a Twitter::User
441
- friendships.first.id.should eq 7505382
442
- friendships.first.connections.should eq ["none"]
329
+ expect(friendships).to be_an Array
330
+ expect(friendships.first).to be_a Twitter::User
331
+ expect(friendships.first.id).to eq 7505382
332
+ expect(friendships.first.connections).to eq ["none"]
443
333
  end
444
334
  end
445
335
  context "with numeric screen names passed" do
446
336
  before do
447
- stub_get("/1.1/friendships/lookup.json").
448
- with(:query => {:screen_name => "0,311"}).
449
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
337
+ 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"})
450
338
  end
451
339
  it "requests the correct resource" do
452
340
  @client.friendships("0", "311")
453
- a_get("/1.1/friendships/lookup.json").
454
- with(:query => {:screen_name => "0,311"}).
455
- should have_been_made
341
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "0,311"})).to have_been_made
456
342
  end
457
343
  end
458
344
  context "with user IDs passed" do
459
345
  before do
460
- stub_get("/1.1/friendships/lookup.json").
461
- with(:query => {:user_id => "7505382,14100886"}).
462
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
346
+ 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"})
463
347
  end
464
348
  it "requests the correct resource" do
465
349
  @client.friendships(7505382, 14100886)
466
- a_get("/1.1/friendships/lookup.json").
467
- with(:query => {:user_id => "7505382,14100886"}).
468
- should have_been_made
350
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:user_id => "7505382,14100886"})).to have_been_made
469
351
  end
470
352
  end
471
353
  context "with both screen names and user IDs passed" do
472
354
  before do
473
- stub_get("/1.1/friendships/lookup.json").
474
- with(:query => {:screen_name => "sferik", :user_id => "14100886"}).
475
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
355
+ 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"})
476
356
  end
477
357
  it "requests the correct resource" do
478
358
  @client.friendships("sferik", 14100886)
479
- a_get("/1.1/friendships/lookup.json").
480
- with(:query => {:screen_name => "sferik", :user_id => "14100886"}).
481
- should have_been_made
359
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik", :user_id => "14100886"})).to have_been_made
482
360
  end
483
361
  end
484
362
  end
@@ -486,81 +364,61 @@ describe Twitter::API do
486
364
  describe "#friendships" do
487
365
  context "with screen names passed" do
488
366
  before do
489
- stub_get("/1.1/friendships/lookup.json").
490
- with(:query => {:screen_name => "sferik,pengwynn"}).
491
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
367
+ 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"})
492
368
  end
493
369
  it "requests the correct resource" do
494
370
  @client.friendships("sferik", "pengwynn")
495
- a_get("/1.1/friendships/lookup.json").
496
- with(:query => {:screen_name => "sferik,pengwynn"}).
497
- should have_been_made
371
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik,pengwynn"})).to have_been_made
498
372
  end
499
373
  it "returns up to 100 users worth of extended information" do
500
374
  friendships = @client.friendships("sferik", "pengwynn")
501
- friendships.should be_an Array
502
- friendships.first.should be_a Twitter::User
503
- friendships.first.id.should eq 7505382
504
- friendships.first.connections.should eq ["none"]
375
+ expect(friendships).to be_an Array
376
+ expect(friendships.first).to be_a Twitter::User
377
+ expect(friendships.first.id).to eq 7505382
378
+ expect(friendships.first.connections).to eq ["none"]
505
379
  end
506
380
  end
507
381
  context "with numeric screen names passed" do
508
382
  before do
509
- stub_get("/1.1/friendships/lookup.json").
510
- with(:query => {:screen_name => "0,311"}).
511
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
383
+ 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"})
512
384
  end
513
385
  it "requests the correct resource" do
514
386
  @client.friendships("0", "311")
515
- a_get("/1.1/friendships/lookup.json").
516
- with(:query => {:screen_name => "0,311"}).
517
- should have_been_made
387
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "0,311"})).to have_been_made
518
388
  end
519
389
  end
520
390
  context "with user IDs passed" do
521
391
  before do
522
- stub_get("/1.1/friendships/lookup.json").
523
- with(:query => {:user_id => "7505382,14100886"}).
524
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
392
+ 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"})
525
393
  end
526
394
  it "requests the correct resource" do
527
395
  @client.friendships(7505382, 14100886)
528
- a_get("/1.1/friendships/lookup.json").
529
- with(:query => {:user_id => "7505382,14100886"}).
530
- should have_been_made
396
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:user_id => "7505382,14100886"})).to have_been_made
531
397
  end
532
398
  end
533
399
  context "with both screen names and user IDs passed" do
534
400
  before do
535
- stub_get("/1.1/friendships/lookup.json").
536
- with(:query => {:screen_name => "sferik", :user_id => "14100886"}).
537
- to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
401
+ 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"})
538
402
  end
539
403
  it "requests the correct resource" do
540
404
  @client.friendships("sferik", 14100886)
541
- a_get("/1.1/friendships/lookup.json").
542
- with(:query => {:screen_name => "sferik", :user_id => "14100886"}).
543
- should have_been_made
405
+ expect(a_get("/1.1/friendships/lookup.json").with(:query => {:screen_name => "sferik", :user_id => "14100886"})).to have_been_made
544
406
  end
545
407
  end
546
408
  end
547
409
 
548
410
  describe "#friendship_update" do
549
411
  before do
550
- stub_post("/1.1/friendships/update.json").
551
- with(:body => {:screen_name => "sferik", :retweets => "true"}).
552
- to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
412
+ 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"})
553
413
  end
554
414
  it "requests the correct resource" do
555
415
  @client.friendship_update("sferik", :retweets => true)
556
- a_post("/1.1/friendships/update.json").
557
- with(:body => {:screen_name => "sferik", :retweets => "true"}).
558
- should have_been_made
416
+ expect(a_post("/1.1/friendships/update.json").with(:body => {:screen_name => "sferik", :retweets => "true"})).to have_been_made
559
417
  end
560
418
  it "returns detailed information about the relationship between two users" do
561
419
  relationship = @client.friendship_update("sferik", :retweets => true)
562
- relationship.should be_a Twitter::Relationship
563
- relationship.source.id.should eq 7505382
420
+ expect(relationship).to be_a Twitter::Relationship
421
+ expect(relationship.source.id).to eq 7505382
564
422
  end
565
423
  end
566
424