twitter 4.1.0 → 4.1.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.
- data/CHANGELOG.md +5 -0
- data/README.md +11 -9
- data/lib/twitter/api.rb +3 -5
- data/lib/twitter/base.rb +1 -4
- data/lib/twitter/geo/point.rb +2 -2
- data/lib/twitter/request/multipart_with_file.rb +1 -1
- data/lib/twitter/tweet.rb +9 -1
- data/lib/twitter/user.rb +2 -0
- data/lib/twitter/version.rb +1 -1
- data/spec/fixtures/status.json +1 -1
- data/spec/helper.rb +6 -0
- data/spec/twitter/action/favorite_spec.rb +6 -6
- data/spec/twitter/action/follow_spec.rb +6 -6
- data/spec/twitter/action/list_member_added_spec.rb +9 -9
- data/spec/twitter/action/mention_spec.rb +11 -11
- data/spec/twitter/action/reply_spec.rb +9 -9
- data/spec/twitter/action/retweet_spec.rb +9 -9
- data/spec/twitter/action_factory_spec.rb +7 -9
- data/spec/twitter/action_spec.rb +2 -2
- data/spec/twitter/api/account_spec.rb +38 -66
- data/spec/twitter/api/activity_spec.rb +6 -10
- data/spec/twitter/api/blocks_spec.rb +38 -83
- data/spec/twitter/api/direct_messages_spec.rb +33 -55
- data/spec/twitter/api/friendships_spec.rb +124 -266
- data/spec/twitter/api/geo_spec.rb +18 -36
- data/spec/twitter/api/help_spec.rb +15 -23
- data/spec/twitter/api/lists_spec.rb +172 -402
- data/spec/twitter/api/report_spam_spec.rb +5 -9
- data/spec/twitter/api/saved_searches_spec.rb +23 -35
- data/spec/twitter/api/search_spec.rb +15 -25
- data/spec/twitter/api/statuses_spec.rb +137 -235
- data/spec/twitter/api/trends_spec.rb +17 -29
- data/spec/twitter/api/users_spec.rb +90 -181
- data/spec/twitter/base_spec.rb +38 -40
- data/spec/twitter/basic_user_spec.rb +3 -3
- data/spec/twitter/client_spec.rb +28 -46
- data/spec/twitter/configuration_spec.rb +3 -3
- data/spec/twitter/cursor_spec.rb +16 -32
- data/spec/twitter/direct_message_spec.rb +9 -9
- data/spec/twitter/error/client_error_spec.rb +4 -12
- data/spec/twitter/error/server_error_spec.rb +2 -6
- data/spec/twitter/error_spec.rb +2 -2
- data/spec/twitter/geo/point_spec.rb +6 -6
- data/spec/twitter/geo/polygon_spec.rb +4 -4
- data/spec/twitter/geo_factory_spec.rb +3 -5
- data/spec/twitter/geo_spec.rb +4 -4
- data/spec/twitter/identifiable_spec.rb +9 -13
- data/spec/twitter/list_spec.rb +7 -7
- data/spec/twitter/media/photo_spec.rb +6 -6
- data/spec/twitter/media_factory_spec.rb +2 -4
- data/spec/twitter/oembed_spec.rb +24 -24
- data/spec/twitter/place_spec.rb +13 -13
- data/spec/twitter/rate_limit_spec.rb +16 -16
- data/spec/twitter/relationship_spec.rb +5 -5
- data/spec/twitter/saved_search_spec.rb +5 -5
- data/spec/twitter/search_results_spec.rb +21 -21
- data/spec/twitter/settings_spec.rb +2 -2
- data/spec/twitter/size_spec.rb +6 -6
- data/spec/twitter/source_user_spec.rb +3 -3
- data/spec/twitter/suggestion_spec.rb +9 -9
- data/spec/twitter/target_user_spec.rb +3 -3
- data/spec/twitter/trend_spec.rb +6 -6
- data/spec/twitter/tweet_spec.rb +69 -69
- data/spec/twitter/user_spec.rb +43 -43
- data/spec/twitter_spec.rb +12 -16
- metadata +2 -2
@@ -8,21 +8,17 @@ describe Twitter::API do
|
|
8
8
|
|
9
9
|
describe "#report_spam" do
|
10
10
|
before do
|
11
|
-
stub_post("/1.1/report_spam.json").
|
12
|
-
with(:body => {:screen_name => "sferik"}).
|
13
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
11
|
+
stub_post("/1.1/report_spam.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
14
12
|
end
|
15
13
|
it "requests the correct resource" do
|
16
14
|
@client.report_spam("sferik")
|
17
|
-
a_post("/1.1/report_spam.json").
|
18
|
-
with(:body => {:screen_name => "sferik"}).
|
19
|
-
should have_been_made
|
15
|
+
expect(a_post("/1.1/report_spam.json").with(:body => {:screen_name => "sferik"})).to have_been_made
|
20
16
|
end
|
21
17
|
it "returns an array of users" do
|
22
18
|
users = @client.report_spam("sferik")
|
23
|
-
users.
|
24
|
-
users.first.
|
25
|
-
users.first.id.
|
19
|
+
expect(users).to be_an Array
|
20
|
+
expect(users.first).to be_a Twitter::User
|
21
|
+
expect(users.first.id).to eq 7505382
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
@@ -9,91 +9,79 @@ describe Twitter::API do
|
|
9
9
|
describe "#saved_searches" do
|
10
10
|
context "with ids passed" do
|
11
11
|
before do
|
12
|
-
stub_get("/1.1/saved_searches/show/16129012.json").
|
13
|
-
to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
12
|
+
stub_get("/1.1/saved_searches/show/16129012.json").to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
14
13
|
end
|
15
14
|
it "requests the correct resource" do
|
16
15
|
@client.saved_searches(16129012)
|
17
|
-
a_get("/1.1/saved_searches/show/16129012.json").
|
18
|
-
should have_been_made
|
16
|
+
expect(a_get("/1.1/saved_searches/show/16129012.json")).to have_been_made
|
19
17
|
end
|
20
18
|
it "returns an array of saved searches" do
|
21
19
|
saved_searches = @client.saved_searches(16129012)
|
22
|
-
saved_searches.
|
23
|
-
saved_searches.first.
|
24
|
-
saved_searches.first.name.
|
20
|
+
expect(saved_searches).to be_an Array
|
21
|
+
expect(saved_searches.first).to be_a Twitter::SavedSearch
|
22
|
+
expect(saved_searches.first.name).to eq "twitter"
|
25
23
|
end
|
26
24
|
end
|
27
25
|
context "without ids passed" do
|
28
26
|
before do
|
29
|
-
stub_get("/1.1/saved_searches/list.json").
|
30
|
-
to_return(:body => fixture("saved_searches.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
27
|
+
stub_get("/1.1/saved_searches/list.json").to_return(:body => fixture("saved_searches.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
31
28
|
end
|
32
29
|
it "requests the correct resource" do
|
33
30
|
@client.saved_searches
|
34
|
-
a_get("/1.1/saved_searches/list.json").
|
35
|
-
should have_been_made
|
31
|
+
expect(a_get("/1.1/saved_searches/list.json")).to have_been_made
|
36
32
|
end
|
37
33
|
it "returns the authenticated user's saved search queries" do
|
38
34
|
saved_searches = @client.saved_searches
|
39
|
-
saved_searches.
|
40
|
-
saved_searches.first.
|
41
|
-
saved_searches.first.name.
|
35
|
+
expect(saved_searches).to be_an Array
|
36
|
+
expect(saved_searches.first).to be_a Twitter::SavedSearch
|
37
|
+
expect(saved_searches.first.name).to eq "twitter"
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
45
41
|
|
46
42
|
describe "#saved_search" do
|
47
43
|
before do
|
48
|
-
stub_get("/1.1/saved_searches/show/16129012.json").
|
49
|
-
to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
44
|
+
stub_get("/1.1/saved_searches/show/16129012.json").to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
50
45
|
end
|
51
46
|
it "requests the correct resource" do
|
52
47
|
@client.saved_search(16129012)
|
53
|
-
a_get("/1.1/saved_searches/show/16129012.json").
|
54
|
-
should have_been_made
|
48
|
+
expect(a_get("/1.1/saved_searches/show/16129012.json")).to have_been_made
|
55
49
|
end
|
56
50
|
it "returns a saved search" do
|
57
51
|
saved_search = @client.saved_search(16129012)
|
58
|
-
saved_search.
|
59
|
-
saved_search.name.
|
52
|
+
expect(saved_search).to be_a Twitter::SavedSearch
|
53
|
+
expect(saved_search.name).to eq "twitter"
|
60
54
|
end
|
61
55
|
end
|
62
56
|
|
63
57
|
describe "#saved_search_create" do
|
64
58
|
before do
|
65
|
-
stub_post("/1.1/saved_searches/create.json").
|
66
|
-
with(:body => {:query => "twitter"}).
|
67
|
-
to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
59
|
+
stub_post("/1.1/saved_searches/create.json").with(:body => {:query => "twitter"}).to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
68
60
|
end
|
69
61
|
it "requests the correct resource" do
|
70
62
|
@client.saved_search_create("twitter")
|
71
|
-
a_post("/1.1/saved_searches/create.json").
|
72
|
-
with(:body => {:query => "twitter"}).
|
73
|
-
should have_been_made
|
63
|
+
expect(a_post("/1.1/saved_searches/create.json").with(:body => {:query => "twitter"})).to have_been_made
|
74
64
|
end
|
75
65
|
it "returns the created saved search" do
|
76
66
|
saved_search = @client.saved_search_create("twitter")
|
77
|
-
saved_search.
|
78
|
-
saved_search.name.
|
67
|
+
expect(saved_search).to be_a Twitter::SavedSearch
|
68
|
+
expect(saved_search.name).to eq "twitter"
|
79
69
|
end
|
80
70
|
end
|
81
71
|
|
82
72
|
describe "#saved_search_destroy" do
|
83
73
|
before do
|
84
|
-
stub_post("/1.1/saved_searches/destroy/16129012.json").
|
85
|
-
to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
74
|
+
stub_post("/1.1/saved_searches/destroy/16129012.json").to_return(:body => fixture("saved_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
86
75
|
end
|
87
76
|
it "requests the correct resource" do
|
88
77
|
@client.saved_search_destroy(16129012)
|
89
|
-
a_post("/1.1/saved_searches/destroy/16129012.json").
|
90
|
-
should have_been_made
|
78
|
+
expect(a_post("/1.1/saved_searches/destroy/16129012.json")).to have_been_made
|
91
79
|
end
|
92
80
|
it "returns an array of deleted saved searches" do
|
93
81
|
saved_searches = @client.saved_search_destroy(16129012)
|
94
|
-
saved_searches.
|
95
|
-
saved_searches.first.
|
96
|
-
saved_searches.first.name.
|
82
|
+
expect(saved_searches).to be_an Array
|
83
|
+
expect(saved_searches.first).to be_a Twitter::SavedSearch
|
84
|
+
expect(saved_searches.first.name).to eq "twitter"
|
97
85
|
end
|
98
86
|
end
|
99
87
|
|
@@ -8,60 +8,50 @@ describe Twitter::API do
|
|
8
8
|
|
9
9
|
describe "#search" do
|
10
10
|
before do
|
11
|
-
stub_get("/1.1/search/tweets.json").
|
12
|
-
with(:query => {:q => "twitter"}).
|
13
|
-
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
11
|
+
stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter"}).to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
14
12
|
end
|
15
13
|
it "requests the correct resource" do
|
16
14
|
@client.search('twitter')
|
17
|
-
a_get("/1.1/search/tweets.json").
|
18
|
-
with(:query => {:q => "twitter"}).
|
19
|
-
should have_been_made
|
15
|
+
expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter"})).to have_been_made
|
20
16
|
end
|
21
17
|
it "returns recent Tweets related to a query with images and videos embedded" do
|
22
18
|
search = @client.search('twitter')
|
23
|
-
search.
|
24
|
-
search.results.
|
25
|
-
search.results.first.
|
26
|
-
search.results.first.text.
|
19
|
+
expect(search).to be_a Twitter::SearchResults
|
20
|
+
expect(search.results).to be_an Array
|
21
|
+
expect(search.results.first).to be_a Twitter::Tweet
|
22
|
+
expect(search.results.first.text).to eq "Bubble Mailer #freebandnames"
|
27
23
|
end
|
28
24
|
it "returns the max_id value for a search result" do
|
29
25
|
search = @client.search('twitter')
|
30
|
-
search.max_id.
|
26
|
+
expect(search.max_id).to eq 250126199840518145
|
31
27
|
end
|
32
28
|
|
33
29
|
context "when search API responds a malformed result" do
|
34
30
|
before do
|
35
|
-
stub_get("/1.1/search/tweets.json").
|
36
|
-
with(:query => {:q => "twitter"}).
|
37
|
-
to_return(:body => fixture("/search_malformed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
31
|
+
stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter"}).to_return(:body => fixture("/search_malformed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
38
32
|
end
|
39
33
|
|
40
34
|
it "returns an empty array" do
|
41
35
|
search = @client.search('twitter')
|
42
|
-
search.results.
|
43
|
-
search.results.
|
36
|
+
expect(search.results).to be_an Array
|
37
|
+
expect(search.results).to be_empty
|
44
38
|
end
|
45
39
|
end
|
46
40
|
end
|
47
41
|
|
48
42
|
describe "#phoenix_search" do
|
49
43
|
before do
|
50
|
-
stub_get("/phoenix_search.phoenix").
|
51
|
-
with(:query => {:q => "twitter"}).
|
52
|
-
to_return(:body => fixture("phoenix_search.phoenix"), :headers => {:content_type => "application/json; charset=utf-8"})
|
44
|
+
stub_get("/phoenix_search.phoenix").with(:query => {:q => "twitter"}).to_return(:body => fixture("phoenix_search.phoenix"), :headers => {:content_type => "application/json; charset=utf-8"})
|
53
45
|
end
|
54
46
|
it "requests the correct resource" do
|
55
47
|
@client.phoenix_search('twitter')
|
56
|
-
a_get("/phoenix_search.phoenix").
|
57
|
-
with(:query => {:q => "twitter"}).
|
58
|
-
should have_been_made
|
48
|
+
expect(a_get("/phoenix_search.phoenix").with(:query => {:q => "twitter"})).to have_been_made
|
59
49
|
end
|
60
50
|
it "returns recent Tweets related to a query with images and videos embedded" do
|
61
51
|
search = @client.phoenix_search('twitter')
|
62
|
-
search.
|
63
|
-
search.first.
|
64
|
-
search.first.text.
|
52
|
+
expect(search).to be_an Array
|
53
|
+
expect(search.first).to be_a Twitter::Tweet
|
54
|
+
expect(search.first.text).to eq "looking at twitter trends just makes me realize how little i really understand about mankind."
|
65
55
|
end
|
66
56
|
end
|
67
57
|
|
@@ -9,251 +9,195 @@ describe Twitter::API do
|
|
9
9
|
describe "#favorites" do
|
10
10
|
context "with a screen name passed" do
|
11
11
|
before do
|
12
|
-
stub_get("/1.1/favorites/list.json").
|
13
|
-
with(:query => {:screen_name => "sferik"}).
|
14
|
-
to_return(:body => fixture("favorites.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
12
|
+
stub_get("/1.1/favorites/list.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("favorites.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
15
13
|
end
|
16
14
|
it "requests the correct resource" do
|
17
15
|
@client.favorites("sferik")
|
18
|
-
a_get("/1.1/favorites/list.json").
|
19
|
-
with(:query => {:screen_name => "sferik"}).
|
20
|
-
should have_been_made
|
16
|
+
expect(a_get("/1.1/favorites/list.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
21
17
|
end
|
22
18
|
it "returns the 20 most recent favorite Tweets for the authenticating user or user specified by the ID parameter" do
|
23
19
|
favorites = @client.favorites("sferik")
|
24
|
-
favorites.
|
25
|
-
favorites.first.
|
26
|
-
favorites.first.user.id.
|
20
|
+
expect(favorites).to be_an Array
|
21
|
+
expect(favorites.first).to be_a Twitter::Tweet
|
22
|
+
expect(favorites.first.user.id).to eq 2404341
|
27
23
|
end
|
28
24
|
end
|
29
25
|
context "without arguments passed" do
|
30
26
|
before do
|
31
|
-
stub_get("/1.1/favorites/list.json").
|
32
|
-
to_return(:body => fixture("favorites.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
27
|
+
stub_get("/1.1/favorites/list.json").to_return(:body => fixture("favorites.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
33
28
|
end
|
34
29
|
it "requests the correct resource" do
|
35
30
|
@client.favorites
|
36
|
-
a_get("/1.1/favorites/list.json").
|
37
|
-
should have_been_made
|
31
|
+
expect(a_get("/1.1/favorites/list.json")).to have_been_made
|
38
32
|
end
|
39
33
|
it "returns the 20 most recent favorite Tweets for the authenticating user or user specified by the ID parameter" do
|
40
34
|
favorites = @client.favorites
|
41
|
-
favorites.
|
42
|
-
favorites.first.
|
43
|
-
favorites.first.user.id.
|
35
|
+
expect(favorites).to be_an Array
|
36
|
+
expect(favorites.first).to be_a Twitter::Tweet
|
37
|
+
expect(favorites.first.user.id).to eq 2404341
|
44
38
|
end
|
45
39
|
end
|
46
40
|
end
|
47
41
|
|
48
42
|
describe "#favorite" do
|
49
43
|
before do
|
50
|
-
stub_post("/1.1/favorites/create.json").
|
51
|
-
with(:body => {:id => "25938088801"}).
|
52
|
-
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
44
|
+
stub_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
53
45
|
end
|
54
46
|
it "requests the correct resource" do
|
55
47
|
@client.favorite(25938088801)
|
56
|
-
a_post("/1.1/favorites/create.json").
|
57
|
-
with(:body => {:id => "25938088801"}).
|
58
|
-
should have_been_made
|
48
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
59
49
|
end
|
60
50
|
it "returns an array of favorited Tweets" do
|
61
51
|
tweets = @client.favorite(25938088801)
|
62
|
-
tweets.
|
63
|
-
tweets.first.
|
64
|
-
tweets.first.text.
|
52
|
+
expect(tweets).to be_an Array
|
53
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
54
|
+
expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do."
|
65
55
|
end
|
66
56
|
end
|
67
57
|
|
68
58
|
describe "#unfavorite" do
|
69
59
|
before do
|
70
|
-
stub_post("/1.1/favorites/destroy.json").
|
71
|
-
with(:body => {:id => "25938088801"}).
|
72
|
-
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
60
|
+
stub_post("/1.1/favorites/destroy.json").with(:body => {:id => "25938088801"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
73
61
|
end
|
74
62
|
it "requests the correct resource" do
|
75
63
|
@client.unfavorite(25938088801)
|
76
|
-
a_post("/1.1/favorites/destroy.json").
|
77
|
-
with(:body => {:id => "25938088801"}).
|
78
|
-
should have_been_made
|
64
|
+
expect(a_post("/1.1/favorites/destroy.json").with(:body => {:id => "25938088801"})).to have_been_made
|
79
65
|
end
|
80
66
|
it "returns an array of un-favorited Tweets" do
|
81
67
|
tweets = @client.unfavorite(25938088801)
|
82
|
-
tweets.
|
83
|
-
tweets.first.
|
84
|
-
tweets.first.text.
|
68
|
+
expect(tweets).to be_an Array
|
69
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
70
|
+
expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do."
|
85
71
|
end
|
86
72
|
end
|
87
73
|
|
88
74
|
describe "#home_timeline" do
|
89
75
|
before do
|
90
|
-
stub_get("/1.1/statuses/home_timeline.json").
|
91
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
76
|
+
stub_get("/1.1/statuses/home_timeline.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
92
77
|
end
|
93
78
|
it "requests the correct resource" do
|
94
79
|
@client.home_timeline
|
95
|
-
a_get("/1.1/statuses/home_timeline.json").
|
96
|
-
should have_been_made
|
80
|
+
expect(a_get("/1.1/statuses/home_timeline.json")).to have_been_made
|
97
81
|
end
|
98
82
|
it "returns the 20 most recent Tweets, including retweets if they exist, posted by the authenticating user and the user's they follow" do
|
99
83
|
tweets = @client.home_timeline
|
100
|
-
tweets.
|
101
|
-
tweets.first.
|
102
|
-
tweets.first.text.
|
84
|
+
expect(tweets).to be_an Array
|
85
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
86
|
+
expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!"
|
103
87
|
end
|
104
88
|
end
|
105
89
|
|
106
90
|
describe "#mentions_timeline" do
|
107
91
|
before do
|
108
|
-
stub_get("/1.1/statuses/mentions_timeline.json").
|
109
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
92
|
+
stub_get("/1.1/statuses/mentions_timeline.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
110
93
|
end
|
111
94
|
it "requests the correct resource" do
|
112
95
|
@client.mentions_timeline
|
113
|
-
a_get("/1.1/statuses/mentions_timeline.json").
|
114
|
-
should have_been_made
|
96
|
+
expect(a_get("/1.1/statuses/mentions_timeline.json")).to have_been_made
|
115
97
|
end
|
116
98
|
it "returns the 20 most recent mentions (status containing @username) for the authenticating user" do
|
117
99
|
tweets = @client.mentions_timeline
|
118
|
-
tweets.
|
119
|
-
tweets.first.
|
120
|
-
tweets.first.text.
|
100
|
+
expect(tweets).to be_an Array
|
101
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
102
|
+
expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!"
|
121
103
|
end
|
122
104
|
end
|
123
105
|
|
124
106
|
describe "#retweeted_by_user" do
|
125
107
|
before do
|
126
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
127
|
-
|
128
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
129
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
130
|
-
with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200", :max_id => "244102729860009983"}).
|
131
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
108
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
109
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
132
110
|
end
|
133
111
|
it "requests the correct resource" do
|
134
112
|
@client.retweeted_by_user("sferik")
|
135
|
-
a_get("/1.1/statuses/user_timeline.json").
|
136
|
-
|
137
|
-
should have_been_made
|
138
|
-
a_get("/1.1/statuses/user_timeline.json").
|
139
|
-
with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200", :max_id => "244102729860009983"}).
|
140
|
-
should have_been_made.times(3)
|
113
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200"})).to have_been_made
|
114
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :screen_name => "sferik", :count => "200", :max_id => "244102729860009983"})).to have_been_made.times(3)
|
141
115
|
end
|
142
116
|
it "returns the 20 most recent retweets posted by the authenticating user" do
|
143
117
|
tweets = @client.retweeted_by_user("sferik")
|
144
|
-
tweets.
|
145
|
-
tweets.first.
|
146
|
-
tweets.first.text.
|
118
|
+
expect(tweets).to be_an Array
|
119
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
120
|
+
expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k"
|
147
121
|
end
|
148
122
|
end
|
149
123
|
|
150
124
|
describe "#retweeted_by_me" do
|
151
125
|
before do
|
152
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
153
|
-
|
154
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
155
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
156
|
-
with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).
|
157
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
126
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
127
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
158
128
|
end
|
159
129
|
it "requests the correct resource" do
|
160
130
|
@client.retweeted_by_me
|
161
|
-
a_get("/1.1/statuses/user_timeline.json").
|
162
|
-
|
163
|
-
should have_been_made
|
164
|
-
a_get("/1.1/statuses/user_timeline.json").
|
165
|
-
with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).
|
166
|
-
should have_been_made.times(3)
|
131
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200"})).to have_been_made
|
132
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"})).to have_been_made.times(3)
|
167
133
|
end
|
168
134
|
it "returns the 20 most recent retweets posted by the authenticating user" do
|
169
135
|
tweets = @client.retweeted_by_me
|
170
|
-
tweets.
|
171
|
-
tweets.first.
|
172
|
-
tweets.first.text.
|
136
|
+
expect(tweets).to be_an Array
|
137
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
138
|
+
expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k"
|
173
139
|
end
|
174
140
|
end
|
175
141
|
|
176
142
|
describe "#retweeted_to_me" do
|
177
143
|
before do
|
178
|
-
stub_get("/1.1/statuses/home_timeline.json").
|
179
|
-
|
180
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
181
|
-
stub_get("/1.1/statuses/home_timeline.json").
|
182
|
-
with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).
|
183
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
144
|
+
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
145
|
+
stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
184
146
|
end
|
185
147
|
it "requests the correct resource" do
|
186
148
|
@client.retweeted_to_me
|
187
|
-
stub_get("/1.1/statuses/home_timeline.json").
|
188
|
-
|
189
|
-
should have_been_made
|
190
|
-
stub_get("/1.1/statuses/home_timeline.json").
|
191
|
-
with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"}).
|
192
|
-
should have_been_made.times(3)
|
149
|
+
expect(stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200"})).to have_been_made
|
150
|
+
expect(stub_get("/1.1/statuses/home_timeline.json").with(:query => {:include_rts => "true", :count => "200", :max_id => "244102729860009983"})).to have_been_made.times(3)
|
193
151
|
end
|
194
152
|
it "returns the 20 most recent retweets posted by users the authenticating user follow" do
|
195
153
|
tweets = @client.retweeted_to_me
|
196
|
-
tweets.
|
197
|
-
tweets.first.
|
198
|
-
tweets.first.text.
|
154
|
+
expect(tweets).to be_an Array
|
155
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
156
|
+
expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k"
|
199
157
|
end
|
200
158
|
end
|
201
159
|
|
202
160
|
describe "#retweets_of_me" do
|
203
161
|
before do
|
204
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
205
|
-
|
206
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
207
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
208
|
-
with(:query => {:include_rts => "false", :count => "200", :max_id => "244102490646278145"}).
|
209
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
162
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "false", :count => "200"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
163
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "false", :count => "200", :max_id => "244102490646278145"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
210
164
|
end
|
211
165
|
it "requests the correct resource" do
|
212
166
|
@client.retweets_of_me
|
213
|
-
a_get("/1.1/statuses/user_timeline.json").
|
214
|
-
|
215
|
-
should have_been_made
|
216
|
-
a_get("/1.1/statuses/user_timeline.json").
|
217
|
-
with(:query => {:include_rts => "false", :count => "200", :max_id => "244102490646278145"}).
|
218
|
-
should have_been_made
|
167
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "false", :count => "200"})).to have_been_made
|
168
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:include_rts => "false", :count => "200", :max_id => "244102490646278145"})).to have_been_made
|
219
169
|
end
|
220
170
|
it "returns the 20 most recent tweets of the authenticated user that have been retweeted by others" do
|
221
171
|
tweets = @client.retweets_of_me
|
222
|
-
tweets.
|
223
|
-
tweets.first.
|
224
|
-
tweets.first.text.
|
172
|
+
expect(tweets).to be_an Array
|
173
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
174
|
+
expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k"
|
225
175
|
end
|
226
176
|
end
|
227
177
|
|
228
178
|
describe "#user_timeline" do
|
229
179
|
context "with a screen name passed" do
|
230
180
|
before do
|
231
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
232
|
-
with(:query => {:screen_name => "sferik"}).
|
233
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
181
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
234
182
|
end
|
235
183
|
it "requests the correct resource" do
|
236
184
|
@client.user_timeline("sferik")
|
237
|
-
a_get("/1.1/statuses/user_timeline.json").
|
238
|
-
with(:query => {:screen_name => "sferik"}).
|
239
|
-
should have_been_made
|
185
|
+
expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
240
186
|
end
|
241
187
|
it "returns the 20 most recent Tweets posted by the user specified by screen name or user id" do
|
242
188
|
tweets = @client.user_timeline("sferik")
|
243
|
-
tweets.
|
244
|
-
tweets.first.
|
245
|
-
tweets.first.text.
|
189
|
+
expect(tweets).to be_an Array
|
190
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
191
|
+
expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!"
|
246
192
|
end
|
247
193
|
end
|
248
194
|
context "without a screen name passed" do
|
249
195
|
before do
|
250
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
251
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
196
|
+
stub_get("/1.1/statuses/user_timeline.json").to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
252
197
|
end
|
253
198
|
it "requests the correct resource" do
|
254
199
|
@client.user_timeline
|
255
|
-
a_get("/1.1/statuses/user_timeline.json").
|
256
|
-
should have_been_made
|
200
|
+
expect(a_get("/1.1/statuses/user_timeline.json")).to have_been_made
|
257
201
|
end
|
258
202
|
end
|
259
203
|
end
|
@@ -261,32 +205,26 @@ describe Twitter::API do
|
|
261
205
|
describe "#media_timeline" do
|
262
206
|
context "with a screen name passed" do
|
263
207
|
before do
|
264
|
-
stub_get("/1.1/statuses/media_timeline.json").
|
265
|
-
with(:query => {:screen_name => "sferik"}).
|
266
|
-
to_return(:body => fixture("media_timeline.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
208
|
+
stub_get("/1.1/statuses/media_timeline.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("media_timeline.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
267
209
|
end
|
268
210
|
it "requests the correct resource" do
|
269
211
|
@client.media_timeline("sferik")
|
270
|
-
a_get("/1.1/statuses/media_timeline.json").
|
271
|
-
with(:query => {:screen_name => "sferik"}).
|
272
|
-
should have_been_made
|
212
|
+
expect(a_get("/1.1/statuses/media_timeline.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
273
213
|
end
|
274
214
|
it "returns the 20 most recent images posted by the user specified by screen name or user id" do
|
275
215
|
tweets = @client.media_timeline("sferik")
|
276
|
-
tweets.
|
277
|
-
tweets.first.
|
278
|
-
tweets.first.text.
|
216
|
+
expect(tweets).to be_an Array
|
217
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
218
|
+
expect(tweets.first.text).to eq "Google is throwing up a question mark for Sunday's weather in Boston. At least they're being honest. http://t.co/Jh7bAhS"
|
279
219
|
end
|
280
220
|
end
|
281
221
|
context "without a screen name passed" do
|
282
222
|
before do
|
283
|
-
stub_get("/1.1/statuses/media_timeline.json").
|
284
|
-
to_return(:body => fixture("media_timeline.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
223
|
+
stub_get("/1.1/statuses/media_timeline.json").to_return(:body => fixture("media_timeline.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
285
224
|
end
|
286
225
|
it "requests the correct resource" do
|
287
226
|
@client.media_timeline
|
288
|
-
a_get("/1.1/statuses/media_timeline.json").
|
289
|
-
should have_been_made
|
227
|
+
expect(a_get("/1.1/statuses/media_timeline.json")).to have_been_made
|
290
228
|
end
|
291
229
|
end
|
292
230
|
end
|
@@ -294,265 +232,229 @@ describe Twitter::API do
|
|
294
232
|
describe "#retweeters_of" do
|
295
233
|
context "with ids_only passed" do
|
296
234
|
before do
|
297
|
-
stub_get("/1.1/statuses/retweets/28561922516.json").
|
298
|
-
to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
235
|
+
stub_get("/1.1/statuses/retweets/28561922516.json").to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
299
236
|
end
|
300
237
|
it "requests the correct resource" do
|
301
238
|
@client.retweeters_of(28561922516, :ids_only => true)
|
302
|
-
a_get("/1.1/statuses/retweets/28561922516.json").
|
303
|
-
should have_been_made
|
239
|
+
expect(a_get("/1.1/statuses/retweets/28561922516.json")).to have_been_made
|
304
240
|
end
|
305
241
|
it "returns an array of numeric user IDs of retweeters of a Tweet" do
|
306
242
|
ids = @client.retweeters_of(28561922516, :ids_only => true)
|
307
|
-
ids.
|
308
|
-
ids.first.
|
243
|
+
expect(ids).to be_an Array
|
244
|
+
expect(ids.first).to eq 7505382
|
309
245
|
end
|
310
246
|
end
|
311
247
|
context "without ids_only passed" do
|
312
248
|
before do
|
313
|
-
stub_get("/1.1/statuses/retweets/28561922516.json").
|
314
|
-
to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
249
|
+
stub_get("/1.1/statuses/retweets/28561922516.json").to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
315
250
|
end
|
316
251
|
it "requests the correct resource" do
|
317
252
|
@client.retweeters_of(28561922516)
|
318
|
-
a_get("/1.1/statuses/retweets/28561922516.json").
|
319
|
-
should have_been_made
|
253
|
+
expect(a_get("/1.1/statuses/retweets/28561922516.json")).to have_been_made
|
320
254
|
end
|
321
255
|
it "returns an array of user of retweeters of a Tweet" do
|
322
256
|
users = @client.retweeters_of(28561922516)
|
323
|
-
users.
|
324
|
-
users.first.
|
325
|
-
users.first.id.
|
257
|
+
expect(users).to be_an Array
|
258
|
+
expect(users.first).to be_a Twitter::User
|
259
|
+
expect(users.first.id).to eq 7505382
|
326
260
|
end
|
327
261
|
end
|
328
262
|
end
|
329
263
|
|
330
264
|
describe "#retweets" do
|
331
265
|
before do
|
332
|
-
stub_get("/1.1/statuses/retweets/28561922516.json").
|
333
|
-
to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
266
|
+
stub_get("/1.1/statuses/retweets/28561922516.json").to_return(:body => fixture("retweets.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
334
267
|
end
|
335
268
|
it "requests the correct resource" do
|
336
269
|
@client.retweets(28561922516)
|
337
|
-
a_get("/1.1/statuses/retweets/28561922516.json").
|
338
|
-
should have_been_made
|
270
|
+
expect(a_get("/1.1/statuses/retweets/28561922516.json")).to have_been_made
|
339
271
|
end
|
340
272
|
it "returns up to 100 of the first retweets of a given tweet" do
|
341
273
|
tweets = @client.retweets(28561922516)
|
342
|
-
tweets.
|
343
|
-
tweets.first.
|
344
|
-
tweets.first.text.
|
274
|
+
expect(tweets).to be_an Array
|
275
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
276
|
+
expect(tweets.first.text).to eq "RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush."
|
345
277
|
end
|
346
278
|
end
|
347
279
|
|
348
280
|
describe "#status" do
|
349
281
|
before do
|
350
|
-
stub_get("/1.1/statuses/show/25938088801.json").
|
351
|
-
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
282
|
+
stub_get("/1.1/statuses/show/25938088801.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
352
283
|
end
|
353
284
|
it "requests the correct resource" do
|
354
285
|
@client.status(25938088801)
|
355
|
-
a_get("/1.1/statuses/show/25938088801.json").
|
356
|
-
should have_been_made
|
286
|
+
expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
|
357
287
|
end
|
358
288
|
it "returns a Tweet" do
|
359
289
|
tweet = @client.status(25938088801)
|
360
|
-
tweet.
|
361
|
-
tweet.text.
|
290
|
+
expect(tweet).to be_a Twitter::Tweet
|
291
|
+
expect(tweet.text).to eq "The problem with your code is that it's doing exactly what you told it to do."
|
362
292
|
end
|
363
293
|
end
|
364
294
|
|
365
295
|
describe "#statuses" do
|
366
296
|
before do
|
367
|
-
stub_get("/1.1/statuses/show/25938088801.json").
|
368
|
-
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
297
|
+
stub_get("/1.1/statuses/show/25938088801.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
369
298
|
end
|
370
299
|
it "requests the correct resource" do
|
371
300
|
@client.statuses(25938088801)
|
372
|
-
a_get("/1.1/statuses/show/25938088801.json").
|
373
|
-
should have_been_made
|
301
|
+
expect(a_get("/1.1/statuses/show/25938088801.json")).to have_been_made
|
374
302
|
end
|
375
303
|
it "returns an array of Tweets" do
|
376
304
|
tweets = @client.statuses(25938088801)
|
377
|
-
tweets.
|
378
|
-
tweets.first.
|
379
|
-
tweets.first.text.
|
305
|
+
expect(tweets).to be_an Array
|
306
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
307
|
+
expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do."
|
380
308
|
end
|
381
309
|
end
|
382
310
|
|
383
311
|
describe "#status_activity" do
|
384
312
|
before do
|
385
|
-
stub_get("/i/statuses/25938088801/activity/summary.json").
|
386
|
-
to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
313
|
+
stub_get("/i/statuses/25938088801/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
387
314
|
end
|
388
315
|
it "requests the correct resource" do
|
389
316
|
@client.status_activity(25938088801)
|
390
|
-
a_get("/i/statuses/25938088801/activity/summary.json").
|
391
|
-
should have_been_made
|
317
|
+
expect(a_get("/i/statuses/25938088801/activity/summary.json")).to have_been_made
|
392
318
|
end
|
393
319
|
it "returns a Tweet" do
|
394
320
|
tweet = @client.status_activity(25938088801)
|
395
|
-
tweet.
|
396
|
-
tweet.retweeters_count.
|
321
|
+
expect(tweet).to be_a Twitter::Tweet
|
322
|
+
expect(tweet.retweeters_count).to eq 1
|
397
323
|
end
|
398
324
|
end
|
399
325
|
|
400
326
|
describe "#statuses_activity" do
|
401
327
|
before do
|
402
|
-
stub_get("/i/statuses/25938088801/activity/summary.json").
|
403
|
-
to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
328
|
+
stub_get("/i/statuses/25938088801/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
404
329
|
end
|
405
330
|
it "requests the correct resource" do
|
406
331
|
@client.statuses_activity(25938088801)
|
407
|
-
a_get("/i/statuses/25938088801/activity/summary.json").
|
408
|
-
should have_been_made
|
332
|
+
expect(a_get("/i/statuses/25938088801/activity/summary.json")).to have_been_made
|
409
333
|
end
|
410
334
|
it "returns an array of Tweets" do
|
411
335
|
tweets = @client.statuses_activity(25938088801)
|
412
|
-
tweets.
|
413
|
-
tweets.first.
|
414
|
-
tweets.first.retweeters_count.
|
336
|
+
expect(tweets).to be_an Array
|
337
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
338
|
+
expect(tweets.first.retweeters_count).to eq 1
|
415
339
|
end
|
416
340
|
end
|
417
341
|
|
418
342
|
describe "#status_destroy" do
|
419
343
|
before do
|
420
|
-
stub_post("/1.1/statuses/destroy/25938088801.json").
|
421
|
-
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
344
|
+
stub_post("/1.1/statuses/destroy/25938088801.json").to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
422
345
|
end
|
423
346
|
it "requests the correct resource" do
|
424
347
|
@client.status_destroy(25938088801)
|
425
|
-
a_post("/1.1/statuses/destroy/25938088801.json").
|
426
|
-
should have_been_made
|
348
|
+
expect(a_post("/1.1/statuses/destroy/25938088801.json")).to have_been_made
|
427
349
|
end
|
428
350
|
it "returns an array of Tweets" do
|
429
351
|
tweets = @client.status_destroy(25938088801)
|
430
|
-
tweets.
|
431
|
-
tweets.first.
|
432
|
-
tweets.first.text.
|
352
|
+
expect(tweets).to be_an Array
|
353
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
354
|
+
expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do."
|
433
355
|
end
|
434
356
|
end
|
435
357
|
|
436
358
|
describe "#retweet" do
|
437
359
|
before do
|
438
|
-
stub_post("/1.1/statuses/retweet/28561922516.json").
|
439
|
-
to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
360
|
+
stub_post("/1.1/statuses/retweet/28561922516.json").to_return(:body => fixture("retweet.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
440
361
|
end
|
441
362
|
it "requests the correct resource" do
|
442
363
|
@client.retweet(28561922516)
|
443
|
-
a_post("/1.1/statuses/retweet/28561922516.json").
|
444
|
-
should have_been_made
|
364
|
+
expect(a_post("/1.1/statuses/retweet/28561922516.json")).to have_been_made
|
445
365
|
end
|
446
366
|
it "returns an array of Tweets with retweet details embedded" do
|
447
367
|
tweets = @client.retweet(28561922516)
|
448
|
-
tweets.
|
449
|
-
tweets.first.
|
450
|
-
tweets.first.text.
|
451
|
-
tweets.first.retweeted_tweet.text.
|
452
|
-
tweets.first.retweeted_tweet.id.
|
368
|
+
expect(tweets).to be_an Array
|
369
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
370
|
+
expect(tweets.first.text).to eq "As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush."
|
371
|
+
expect(tweets.first.retweeted_tweet.text).to eq "RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush."
|
372
|
+
expect(tweets.first.retweeted_tweet.id).not_to eq tweets.first.id
|
453
373
|
end
|
454
374
|
end
|
455
375
|
|
456
376
|
describe "#tweet" do
|
457
377
|
before do
|
458
|
-
stub_post("/1.1/statuses/update.json").
|
459
|
-
with(:body => {:status => "@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!"}).
|
460
|
-
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
378
|
+
stub_post("/1.1/statuses/update.json").with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
461
379
|
end
|
462
380
|
it "requests the correct resource" do
|
463
|
-
@client.update("
|
464
|
-
a_post("/1.1/statuses/update.json").
|
465
|
-
with(:body => {:status => "@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!"}).
|
466
|
-
should have_been_made
|
381
|
+
@client.update("The problem with your code is that it's doing exactly what you told it to do.")
|
382
|
+
expect(a_post("/1.1/statuses/update.json").with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."})).to have_been_made
|
467
383
|
end
|
468
384
|
it "returns a Tweet" do
|
469
|
-
tweet = @client.update("
|
470
|
-
tweet.
|
471
|
-
tweet.text.
|
385
|
+
tweet = @client.update("The problem with your code is that it's doing exactly what you told it to do.")
|
386
|
+
expect(tweet).to be_a Twitter::Tweet
|
387
|
+
expect(tweet.text).to eq "The problem with your code is that it's doing exactly what you told it to do."
|
472
388
|
end
|
473
389
|
end
|
474
390
|
|
475
391
|
describe "#update_with_media" do
|
476
392
|
before do
|
477
|
-
stub_post("/1.1/statuses/update_with_media.json").
|
478
|
-
to_return(:body => fixture("status_with_media.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
393
|
+
stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status_with_media.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
479
394
|
end
|
480
395
|
context "a gif image" do
|
481
396
|
it "requests the correct resource" do
|
482
397
|
@client.update_with_media("You always have options", fixture("pbjt.gif"))
|
483
|
-
a_post("/1.1/statuses/update_with_media.json").
|
484
|
-
should have_been_made
|
398
|
+
expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
|
485
399
|
end
|
486
400
|
it "returns a Tweet" do
|
487
401
|
tweet = @client.update_with_media("You always have options", fixture("pbjt.gif"))
|
488
|
-
tweet.
|
489
|
-
tweet.text.
|
402
|
+
expect(tweet).to be_a Twitter::Tweet
|
403
|
+
expect(tweet.text).to eq "You always have options http://t.co/CBYa7Ri"
|
490
404
|
end
|
491
405
|
end
|
492
406
|
context "a jpe image" do
|
493
407
|
it "requests the correct resource" do
|
494
408
|
@client.update_with_media("You always have options", fixture("wildcomet2.jpe"))
|
495
|
-
a_post("/1.1/statuses/update_with_media.json").
|
496
|
-
should have_been_made
|
409
|
+
expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
|
497
410
|
end
|
498
411
|
end
|
499
412
|
context "a jpeg image" do
|
500
413
|
it "requests the correct resource" do
|
501
414
|
@client.update_with_media("You always have options", fixture("me.jpeg"))
|
502
|
-
a_post("/1.1/statuses/update_with_media.json").
|
503
|
-
should have_been_made
|
415
|
+
expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
|
504
416
|
end
|
505
417
|
end
|
506
418
|
context "a png image" do
|
507
419
|
it "requests the correct resource" do
|
508
420
|
@client.update_with_media("You always have options", fixture("we_concept_bg2.png"))
|
509
|
-
a_post("/1.1/statuses/update_with_media.json").
|
510
|
-
should have_been_made
|
421
|
+
expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
|
511
422
|
end
|
512
423
|
end
|
513
424
|
context "a Tempfile" do
|
514
425
|
it "requests the correct resource" do
|
515
426
|
@client.update_with_media("You always have options", Tempfile.new("tmp"))
|
516
|
-
a_post("/1.1/statuses/update_with_media.json").
|
517
|
-
should have_been_made
|
427
|
+
expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
|
518
428
|
end
|
519
429
|
end
|
520
430
|
end
|
521
431
|
|
522
432
|
describe "#oembed" do
|
523
433
|
before do
|
524
|
-
stub_get("/1.1/statuses/oembed.json").
|
525
|
-
with(:query => {:id => "25938088801"}).
|
526
|
-
to_return(:body => fixture("oembed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
434
|
+
stub_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"}).to_return(:body => fixture("oembed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
527
435
|
end
|
528
436
|
it "requests the correct resource" do
|
529
437
|
@client.oembed(25938088801)
|
530
|
-
a_get("/1.1/statuses/oembed.json").
|
531
|
-
with(:query => {:id => "25938088801"}).
|
532
|
-
should have_been_made
|
438
|
+
expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
|
533
439
|
end
|
534
440
|
it "returns an array of OEmbed instances" do
|
535
441
|
oembed = @client.oembed(25938088801)
|
536
|
-
oembed.
|
442
|
+
expect(oembed).to be_a Twitter::OEmbed
|
537
443
|
end
|
538
444
|
end
|
539
445
|
|
540
446
|
describe "#oembeds" do
|
541
447
|
before do
|
542
|
-
stub_get("/1.1/statuses/oembed.json").
|
543
|
-
with(:query => {:id => "25938088801"}).
|
544
|
-
to_return(:body => fixture("oembed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
448
|
+
stub_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"}).to_return(:body => fixture("oembed.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
545
449
|
end
|
546
450
|
it "requests the correct resource" do
|
547
451
|
@client.oembeds(25938088801)
|
548
|
-
a_get("/1.1/statuses/oembed.json").
|
549
|
-
with(:query => {:id => "25938088801"}).
|
550
|
-
should have_been_made
|
452
|
+
expect(a_get("/1.1/statuses/oembed.json").with(:query => {:id => "25938088801"})).to have_been_made
|
551
453
|
end
|
552
454
|
it "returns an array of OEmbed instances" do
|
553
455
|
oembeds = @client.oembeds(25938088801)
|
554
|
-
oembeds.
|
555
|
-
oembeds.first.
|
456
|
+
expect(oembeds).to be_an Array
|
457
|
+
expect(oembeds.first).to be_a Twitter::OEmbed
|
556
458
|
end
|
557
459
|
end
|
558
460
|
|