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,92 +8,74 @@ describe Twitter::API do
|
|
8
8
|
|
9
9
|
describe "#places_nearby" do
|
10
10
|
before do
|
11
|
-
stub_get("/1.1/geo/search.json").
|
12
|
-
with(:query => {:ip => "74.125.19.104"}).
|
13
|
-
to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
11
|
+
stub_get("/1.1/geo/search.json").with(:query => {:ip => "74.125.19.104"}).to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
14
12
|
end
|
15
13
|
it "requests the correct resource" do
|
16
14
|
@client.places_nearby(:ip => "74.125.19.104")
|
17
|
-
a_get("/1.1/geo/search.json").
|
18
|
-
with(:query => {:ip => "74.125.19.104"}).
|
19
|
-
should have_been_made
|
15
|
+
expect(a_get("/1.1/geo/search.json").with(:query => {:ip => "74.125.19.104"})).to have_been_made
|
20
16
|
end
|
21
17
|
it "returns nearby places" do
|
22
18
|
places = @client.places_nearby(:ip => "74.125.19.104")
|
23
|
-
places.
|
24
|
-
places.first.name.
|
19
|
+
expect(places).to be_an Array
|
20
|
+
expect(places.first.name).to eq "Bernal Heights"
|
25
21
|
end
|
26
22
|
end
|
27
23
|
|
28
24
|
describe "#places_similar" do
|
29
25
|
before do
|
30
|
-
stub_get("/1.1/geo/similar_places.json").
|
31
|
-
with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"}).
|
32
|
-
to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
26
|
+
stub_get("/1.1/geo/similar_places.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"}).to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
33
27
|
end
|
34
28
|
it "requests the correct resource" do
|
35
29
|
@client.places_similar(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ")
|
36
|
-
a_get("/1.1/geo/similar_places.json").
|
37
|
-
with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"}).
|
38
|
-
should have_been_made
|
30
|
+
expect(a_get("/1.1/geo/similar_places.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"})).to have_been_made
|
39
31
|
end
|
40
32
|
it "returns similar places" do
|
41
33
|
places = @client.places_similar(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ")
|
42
|
-
places.
|
43
|
-
places.first.name.
|
34
|
+
expect(places).to be_an Array
|
35
|
+
expect(places.first.name).to eq "Bernal Heights"
|
44
36
|
end
|
45
37
|
end
|
46
38
|
|
47
39
|
describe "#reverse_geocode" do
|
48
40
|
before do
|
49
|
-
stub_get("/1.1/geo/reverse_geocode.json").
|
50
|
-
with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116"}).
|
51
|
-
to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
41
|
+
stub_get("/1.1/geo/reverse_geocode.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116"}).to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
52
42
|
end
|
53
43
|
it "requests the correct resource" do
|
54
44
|
@client.reverse_geocode(:lat => "37.7821120598956", :long => "-122.400612831116")
|
55
|
-
a_get("/1.1/geo/reverse_geocode.json").
|
56
|
-
with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116"}).
|
57
|
-
should have_been_made
|
45
|
+
expect(a_get("/1.1/geo/reverse_geocode.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116"})).to have_been_made
|
58
46
|
end
|
59
47
|
it "returns places" do
|
60
48
|
places = @client.reverse_geocode(:lat => "37.7821120598956", :long => "-122.400612831116")
|
61
|
-
places.
|
62
|
-
places.first.name.
|
49
|
+
expect(places).to be_an Array
|
50
|
+
expect(places.first.name).to eq "Bernal Heights"
|
63
51
|
end
|
64
52
|
end
|
65
53
|
|
66
54
|
describe "#place" do
|
67
55
|
before do
|
68
|
-
stub_get("/1.1/geo/id/247f43d441defc03.json").
|
69
|
-
to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
56
|
+
stub_get("/1.1/geo/id/247f43d441defc03.json").to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
70
57
|
end
|
71
58
|
it "requests the correct resource" do
|
72
59
|
@client.place("247f43d441defc03")
|
73
|
-
a_get("/1.1/geo/id/247f43d441defc03.json").
|
74
|
-
should have_been_made
|
60
|
+
expect(a_get("/1.1/geo/id/247f43d441defc03.json")).to have_been_made
|
75
61
|
end
|
76
62
|
it "returns a place" do
|
77
63
|
place = @client.place("247f43d441defc03")
|
78
|
-
place.name.
|
64
|
+
expect(place.name).to eq "Twitter HQ"
|
79
65
|
end
|
80
66
|
end
|
81
67
|
|
82
68
|
describe "#place_create" do
|
83
69
|
before do
|
84
|
-
stub_post("/1.1/geo/place.json").
|
85
|
-
with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}).
|
86
|
-
to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
70
|
+
stub_post("/1.1/geo/place.json").with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}).to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
87
71
|
end
|
88
72
|
it "requests the correct resource" do
|
89
73
|
@client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581")
|
90
|
-
a_post("/1.1/geo/place.json").
|
91
|
-
with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}).
|
92
|
-
should have_been_made
|
74
|
+
expect(a_post("/1.1/geo/place.json").with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"})).to have_been_made
|
93
75
|
end
|
94
76
|
it "returns a place" do
|
95
77
|
place = @client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581")
|
96
|
-
place.name.
|
78
|
+
expect(place.name).to eq "Twitter HQ"
|
97
79
|
end
|
98
80
|
end
|
99
81
|
|
@@ -8,68 +8,60 @@ describe Twitter::API do
|
|
8
8
|
|
9
9
|
describe "#configuration" do
|
10
10
|
before do
|
11
|
-
stub_get("/1.1/help/configuration.json").
|
12
|
-
to_return(:body => fixture("configuration.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
11
|
+
stub_get("/1.1/help/configuration.json").to_return(:body => fixture("configuration.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
13
12
|
end
|
14
13
|
it "requests the correct resource" do
|
15
14
|
@client.configuration
|
16
|
-
a_get("/1.1/help/configuration.json").
|
17
|
-
should have_been_made
|
15
|
+
expect(a_get("/1.1/help/configuration.json")).to have_been_made
|
18
16
|
end
|
19
17
|
it "returns Twitter's current configuration" do
|
20
18
|
configuration = @client.configuration
|
21
|
-
configuration.
|
22
|
-
configuration.characters_reserved_per_media.
|
19
|
+
expect(configuration).to be_a Twitter::Configuration
|
20
|
+
expect(configuration.characters_reserved_per_media).to eq 20
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
24
|
describe "#languages" do
|
27
25
|
before do
|
28
|
-
stub_get("/1.1/help/languages.json").
|
29
|
-
to_return(:body => fixture("languages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
26
|
+
stub_get("/1.1/help/languages.json").to_return(:body => fixture("languages.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
30
27
|
end
|
31
28
|
it "requests the correct resource" do
|
32
29
|
@client.languages
|
33
|
-
a_get("/1.1/help/languages.json").
|
34
|
-
should have_been_made
|
30
|
+
expect(a_get("/1.1/help/languages.json")).to have_been_made
|
35
31
|
end
|
36
32
|
it "returns the list of languages supported by Twitter" do
|
37
33
|
languages = @client.languages
|
38
|
-
languages.
|
39
|
-
languages.first.
|
40
|
-
languages.first.name.
|
34
|
+
expect(languages).to be_an Array
|
35
|
+
expect(languages.first).to be_a Twitter::Language
|
36
|
+
expect(languages.first.name).to eq "Portuguese"
|
41
37
|
end
|
42
38
|
end
|
43
39
|
|
44
40
|
describe "#privacy" do
|
45
41
|
before do
|
46
|
-
stub_get("/1.1/help/privacy.json").
|
47
|
-
to_return(:body => fixture("privacy.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
42
|
+
stub_get("/1.1/help/privacy.json").to_return(:body => fixture("privacy.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
48
43
|
end
|
49
44
|
it "requests the correct resource" do
|
50
45
|
@client.privacy
|
51
|
-
a_get("/1.1/help/privacy.json").
|
52
|
-
should have_been_made
|
46
|
+
expect(a_get("/1.1/help/privacy.json")).to have_been_made
|
53
47
|
end
|
54
48
|
it "returns Twitter's Privacy Policy" do
|
55
49
|
privacy = @client.privacy
|
56
|
-
privacy.split.first.
|
50
|
+
expect(privacy.split.first).to eq "Twitter"
|
57
51
|
end
|
58
52
|
end
|
59
53
|
|
60
54
|
describe "#tos" do
|
61
55
|
before do
|
62
|
-
stub_get("/1.1/help/tos.json").
|
63
|
-
to_return(:body => fixture("tos.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
56
|
+
stub_get("/1.1/help/tos.json").to_return(:body => fixture("tos.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
64
57
|
end
|
65
58
|
it "requests the correct resource" do
|
66
59
|
@client.tos
|
67
|
-
a_get("/1.1/help/tos.json").
|
68
|
-
should have_been_made
|
60
|
+
expect(a_get("/1.1/help/tos.json")).to have_been_made
|
69
61
|
end
|
70
62
|
it "returns Twitter's Terms of Service" do
|
71
63
|
tos = @client.tos
|
72
|
-
tos.split.first.
|
64
|
+
expect(tos.split.first).to eq "Terms"
|
73
65
|
end
|
74
66
|
end
|
75
67
|
|
@@ -9,36 +9,27 @@ describe Twitter::API do
|
|
9
9
|
describe "#list_timeline" do
|
10
10
|
context "with a screen name passed" do
|
11
11
|
before do
|
12
|
-
stub_get("/1.1/lists/statuses.json").
|
13
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
14
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
12
|
+
stub_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
15
13
|
end
|
16
14
|
it "requests the correct resource" do
|
17
15
|
@client.list_timeline("sferik", "presidents")
|
18
|
-
a_get("/1.1/lists/statuses.json").
|
19
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
20
|
-
should have_been_made
|
16
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
21
17
|
end
|
22
18
|
it "returns the timeline for members of the specified list" do
|
23
19
|
tweets = @client.list_timeline("sferik", "presidents")
|
24
|
-
tweets.
|
25
|
-
tweets.first.
|
26
|
-
tweets.first.text.
|
20
|
+
expect(tweets).to be_an Array
|
21
|
+
expect(tweets.first).to be_a Twitter::Tweet
|
22
|
+
expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!"
|
27
23
|
end
|
28
24
|
end
|
29
25
|
context "without a screen name passed" do
|
30
26
|
before do
|
31
|
-
stub_get("/1.1/account/verify_credentials.json").
|
32
|
-
|
33
|
-
stub_get("/1.1/lists/statuses.json").
|
34
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
35
|
-
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
27
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
28
|
+
stub_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
36
29
|
end
|
37
30
|
it "requests the correct resource" do
|
38
31
|
@client.list_timeline("presidents")
|
39
|
-
a_get("/1.1/lists/statuses.json").
|
40
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
41
|
-
should have_been_made
|
32
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
42
33
|
end
|
43
34
|
end
|
44
35
|
end
|
@@ -46,35 +37,26 @@ describe Twitter::API do
|
|
46
37
|
describe "#list_remove_member" do
|
47
38
|
context "with a screen name passed" do
|
48
39
|
before do
|
49
|
-
stub_post("/1.1/lists/members/destroy.json").
|
50
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
51
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
40
|
+
stub_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
52
41
|
end
|
53
42
|
it "requests the correct resource" do
|
54
43
|
@client.list_remove_member("sferik", "presidents", 813286)
|
55
|
-
a_post("/1.1/lists/members/destroy.json").
|
56
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
57
|
-
should have_been_made
|
44
|
+
expect(a_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"})).to have_been_made
|
58
45
|
end
|
59
46
|
it "returns the list" do
|
60
47
|
list = @client.list_remove_member("sferik", "presidents", 813286)
|
61
|
-
list.
|
62
|
-
list.name.
|
48
|
+
expect(list).to be_a Twitter::List
|
49
|
+
expect(list.name).to eq "presidents"
|
63
50
|
end
|
64
51
|
end
|
65
52
|
context "without a screen name passed" do
|
66
53
|
before do
|
67
|
-
stub_get("/1.1/account/verify_credentials.json").
|
68
|
-
|
69
|
-
stub_post("/1.1/lists/members/destroy.json").
|
70
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
71
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
54
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
55
|
+
stub_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
72
56
|
end
|
73
57
|
it "requests the correct resource" do
|
74
58
|
@client.list_remove_member("presidents", 813286)
|
75
|
-
a_post("/1.1/lists/members/destroy.json").
|
76
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
77
|
-
should have_been_made
|
59
|
+
expect(a_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"})).to have_been_made
|
78
60
|
end
|
79
61
|
end
|
80
62
|
end
|
@@ -82,37 +64,28 @@ describe Twitter::API do
|
|
82
64
|
describe "#memberships" do
|
83
65
|
context "with a screen name passed" do
|
84
66
|
before do
|
85
|
-
stub_get("/1.1/lists/memberships.json").
|
86
|
-
with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}).
|
87
|
-
to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
67
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}).to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
88
68
|
end
|
89
69
|
it "requests the correct resource" do
|
90
70
|
@client.memberships("pengwynn")
|
91
|
-
a_get("/1.1/lists/memberships.json").
|
92
|
-
with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}).
|
93
|
-
should have_been_made
|
71
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => 'pengwynn', :cursor => "-1"})).to have_been_made
|
94
72
|
end
|
95
73
|
it "returns the lists the specified user has been added to" do
|
96
74
|
memberships = @client.memberships("pengwynn")
|
97
|
-
memberships.
|
98
|
-
memberships.lists.
|
99
|
-
memberships.lists.first.
|
100
|
-
memberships.lists.first.name.
|
75
|
+
expect(memberships).to be_a Twitter::Cursor
|
76
|
+
expect(memberships.lists).to be_an Array
|
77
|
+
expect(memberships.lists.first).to be_a Twitter::List
|
78
|
+
expect(memberships.lists.first.name).to eq "developer"
|
101
79
|
end
|
102
80
|
end
|
103
81
|
context "without a screen name passed" do
|
104
82
|
before do
|
105
|
-
stub_get("/1.1/account/verify_credentials.json").
|
106
|
-
|
107
|
-
stub_get("/1.1/lists/memberships.json").
|
108
|
-
with(:query => {:cursor => "-1"}).
|
109
|
-
to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
83
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
84
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
110
85
|
end
|
111
86
|
it "requests the correct resource" do
|
112
87
|
@client.memberships
|
113
|
-
a_get("/1.1/lists/memberships.json").
|
114
|
-
with(:query => {:cursor => "-1"}).
|
115
|
-
should have_been_made
|
88
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:cursor => "-1"})).to have_been_made
|
116
89
|
end
|
117
90
|
end
|
118
91
|
end
|
@@ -120,37 +93,28 @@ describe Twitter::API do
|
|
120
93
|
describe "#list_subscribers" do
|
121
94
|
context "with a screen name passed" do
|
122
95
|
before do
|
123
|
-
stub_get("/1.1/lists/subscribers.json").
|
124
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
125
|
-
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
96
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
126
97
|
end
|
127
98
|
it "requests the correct resource" do
|
128
99
|
@client.list_subscribers("sferik", "presidents")
|
129
|
-
a_get("/1.1/lists/subscribers.json").
|
130
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
131
|
-
should have_been_made
|
100
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"})).to have_been_made
|
132
101
|
end
|
133
102
|
it "returns the subscribers of the specified list" do
|
134
103
|
list_subscribers = @client.list_subscribers("sferik", "presidents")
|
135
|
-
list_subscribers.
|
136
|
-
list_subscribers.users.
|
137
|
-
list_subscribers.users.first.
|
138
|
-
list_subscribers.users.first.id.
|
104
|
+
expect(list_subscribers).to be_a Twitter::Cursor
|
105
|
+
expect(list_subscribers.users).to be_an Array
|
106
|
+
expect(list_subscribers.users.first).to be_a Twitter::User
|
107
|
+
expect(list_subscribers.users.first.id).to eq 7505382
|
139
108
|
end
|
140
109
|
end
|
141
110
|
context "without a screen name passed" do
|
142
111
|
before do
|
143
|
-
stub_get("/1.1/account/verify_credentials.json").
|
144
|
-
|
145
|
-
stub_get("/1.1/lists/subscribers.json").
|
146
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
147
|
-
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
112
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
113
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
148
114
|
end
|
149
115
|
it "requests the correct resource" do
|
150
116
|
@client.list_subscribers("presidents")
|
151
|
-
a_get("/1.1/lists/subscribers.json").
|
152
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
153
|
-
should have_been_made
|
117
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"})).to have_been_made
|
154
118
|
end
|
155
119
|
end
|
156
120
|
end
|
@@ -158,37 +122,28 @@ describe Twitter::API do
|
|
158
122
|
describe "#subscriptions" do
|
159
123
|
context "with a screen name passed" do
|
160
124
|
before do
|
161
|
-
stub_get("/1.1/lists/subscriptions.json").
|
162
|
-
with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}).
|
163
|
-
to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
125
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}).to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
164
126
|
end
|
165
127
|
it "requests the correct resource" do
|
166
128
|
@client.subscriptions("pengwynn")
|
167
|
-
a_get("/1.1/lists/subscriptions.json").
|
168
|
-
with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}).
|
169
|
-
should have_been_made
|
129
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => 'pengwynn', :cursor => "-1"})).to have_been_made
|
170
130
|
end
|
171
131
|
it "returns the lists the specified user follows" do
|
172
132
|
subscriptions = @client.subscriptions("pengwynn")
|
173
|
-
subscriptions.
|
174
|
-
subscriptions.lists.
|
175
|
-
subscriptions.lists.first.
|
176
|
-
subscriptions.lists.first.name.
|
133
|
+
expect(subscriptions).to be_a Twitter::Cursor
|
134
|
+
expect(subscriptions.lists).to be_an Array
|
135
|
+
expect(subscriptions.lists.first).to be_a Twitter::List
|
136
|
+
expect(subscriptions.lists.first.name).to eq "Rubyists"
|
177
137
|
end
|
178
138
|
end
|
179
139
|
context "without a screen name passed" do
|
180
140
|
before do
|
181
|
-
stub_get("/1.1/account/verify_credentials.json").
|
182
|
-
|
183
|
-
stub_get("/1.1/lists/subscriptions.json").
|
184
|
-
with(:query => {:cursor => "-1"}).
|
185
|
-
to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
141
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
142
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
186
143
|
end
|
187
144
|
it "requests the correct resource" do
|
188
145
|
@client.subscriptions
|
189
|
-
a_get("/1.1/lists/subscriptions.json").
|
190
|
-
with(:query => {:cursor => "-1"}).
|
191
|
-
should have_been_made
|
146
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:cursor => "-1"})).to have_been_made
|
192
147
|
end
|
193
148
|
end
|
194
149
|
end
|
@@ -196,35 +151,26 @@ describe Twitter::API do
|
|
196
151
|
describe "#list_subscribe" do
|
197
152
|
context "with a screen name passed" do
|
198
153
|
before do
|
199
|
-
stub_post("/1.1/lists/subscribers/create.json").
|
200
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
201
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
154
|
+
stub_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
202
155
|
end
|
203
156
|
it "requests the correct resource" do
|
204
157
|
@client.list_subscribe("sferik", "presidents")
|
205
|
-
a_post("/1.1/lists/subscribers/create.json").
|
206
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
207
|
-
should have_been_made
|
158
|
+
expect(a_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
208
159
|
end
|
209
160
|
it "returns the specified list" do
|
210
161
|
list = @client.list_subscribe("sferik", "presidents")
|
211
|
-
list.
|
212
|
-
list.name.
|
162
|
+
expect(list).to be_a Twitter::List
|
163
|
+
expect(list.name).to eq "presidents"
|
213
164
|
end
|
214
165
|
end
|
215
166
|
context "without a screen name passed" do
|
216
167
|
before do
|
217
|
-
stub_get("/1.1/account/verify_credentials.json").
|
218
|
-
|
219
|
-
stub_post("/1.1/lists/subscribers/create.json").
|
220
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
221
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
168
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
169
|
+
stub_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
222
170
|
end
|
223
171
|
it "requests the correct resource" do
|
224
172
|
@client.list_subscribe("presidents")
|
225
|
-
a_post("/1.1/lists/subscribers/create.json").
|
226
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
227
|
-
should have_been_made
|
173
|
+
expect(a_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
228
174
|
end
|
229
175
|
end
|
230
176
|
end
|
@@ -232,101 +178,72 @@ describe Twitter::API do
|
|
232
178
|
describe "#list_subscriber?" do
|
233
179
|
context "with a screen name passed" do
|
234
180
|
before do
|
235
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
236
|
-
|
237
|
-
|
238
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
239
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '18755393'}).
|
240
|
-
to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
241
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
242
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '12345678'}).
|
243
|
-
to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
|
181
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
182
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '18755393'}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
183
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '12345678'}).to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
|
244
184
|
end
|
245
185
|
it "requests the correct resource" do
|
246
186
|
@client.list_subscriber?("sferik", "presidents", 813286)
|
247
|
-
a_get("/1.1/lists/subscribers/show.json").
|
248
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).
|
249
|
-
should have_been_made
|
187
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'})).to have_been_made
|
250
188
|
end
|
251
189
|
it "returns true if the specified user subscribes to the specified list" do
|
252
190
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 813286)
|
253
|
-
list_subscriber.
|
191
|
+
expect(list_subscriber).to be_true
|
254
192
|
end
|
255
193
|
it "returns false if the specified user does not subscribe to the specified list" do
|
256
194
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 18755393)
|
257
|
-
list_subscriber.
|
195
|
+
expect(list_subscriber).to be_false
|
258
196
|
end
|
259
197
|
it "returns false if user does not exist" do
|
260
198
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 12345678)
|
261
|
-
list_subscriber.
|
199
|
+
expect(list_subscriber).to be_false
|
262
200
|
end
|
263
201
|
end
|
264
202
|
context "with a owner ID passed" do
|
265
203
|
before do
|
266
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
267
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}).
|
268
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
204
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
269
205
|
end
|
270
206
|
it "requests the correct resource" do
|
271
207
|
@client.list_subscriber?(12345678, "presidents", 813286)
|
272
|
-
a_get("/1.1/lists/subscribers/show.json").
|
273
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}).
|
274
|
-
should have_been_made
|
208
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'})).to have_been_made
|
275
209
|
end
|
276
210
|
end
|
277
211
|
context "with a list ID passed" do
|
278
212
|
before do
|
279
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
280
|
-
with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}).
|
281
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
213
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
282
214
|
end
|
283
215
|
it "requests the correct resource" do
|
284
216
|
@client.list_subscriber?('sferik', 12345678, 813286)
|
285
|
-
a_get("/1.1/lists/subscribers/show.json").
|
286
|
-
with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}).
|
287
|
-
should have_been_made
|
217
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'})).to have_been_made
|
288
218
|
end
|
289
219
|
end
|
290
220
|
context "with a list object passed" do
|
291
221
|
before do
|
292
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
293
|
-
with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'}).
|
294
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
222
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
295
223
|
end
|
296
224
|
it "requests the correct resource" do
|
297
225
|
list = Twitter::List.new(:id => 12345678, :user => {:id => 7505382, :screen_name => 'sferik'})
|
298
226
|
@client.list_subscriber?(list, 813286)
|
299
|
-
a_get("/1.1/lists/subscribers/show.json").
|
300
|
-
with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'}).
|
301
|
-
should have_been_made
|
227
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'})).to have_been_made
|
302
228
|
end
|
303
229
|
end
|
304
230
|
context "with a screen name passed for user_to_check" do
|
305
231
|
before do
|
306
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
307
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}).
|
308
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
232
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
309
233
|
end
|
310
234
|
it "requests the correct resource" do
|
311
235
|
@client.list_subscriber?("sferik", "presidents", 'erebor')
|
312
|
-
a_get("/1.1/lists/subscribers/show.json").
|
313
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}).
|
314
|
-
should have_been_made
|
236
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'})).to have_been_made
|
315
237
|
end
|
316
238
|
end
|
317
239
|
context "without a screen name passed" do
|
318
240
|
before do
|
319
|
-
stub_get("/1.1/account/verify_credentials.json").
|
320
|
-
|
321
|
-
stub_get("/1.1/lists/subscribers/show.json").
|
322
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).
|
323
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
241
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
242
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
324
243
|
end
|
325
244
|
it "requests the correct resource" do
|
326
245
|
@client.list_subscriber?("presidents", 813286)
|
327
|
-
a_get("/1.1/lists/subscribers/show.json").
|
328
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).
|
329
|
-
should have_been_made
|
246
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'})).to have_been_made
|
330
247
|
end
|
331
248
|
end
|
332
249
|
end
|
@@ -334,35 +251,26 @@ describe Twitter::API do
|
|
334
251
|
describe "#list_unsubscribe" do
|
335
252
|
context "with a screen name passed" do
|
336
253
|
before do
|
337
|
-
stub_post("/1.1/lists/subscribers/destroy.json").
|
338
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
339
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
254
|
+
stub_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
340
255
|
end
|
341
256
|
it "requests the correct resource" do
|
342
257
|
@client.list_unsubscribe("sferik", "presidents")
|
343
|
-
a_post("/1.1/lists/subscribers/destroy.json").
|
344
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
345
|
-
should have_been_made
|
258
|
+
expect(a_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
346
259
|
end
|
347
260
|
it "returns the specified list" do
|
348
261
|
list = @client.list_unsubscribe("sferik", "presidents")
|
349
|
-
list.
|
350
|
-
list.name.
|
262
|
+
expect(list).to be_a Twitter::List
|
263
|
+
expect(list.name).to eq "presidents"
|
351
264
|
end
|
352
265
|
end
|
353
266
|
context "without a screen name passed" do
|
354
267
|
before do
|
355
|
-
stub_get("/1.1/account/verify_credentials.json").
|
356
|
-
|
357
|
-
stub_post("/1.1/lists/subscribers/destroy.json").
|
358
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
359
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
268
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
269
|
+
stub_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
360
270
|
end
|
361
271
|
it "requests the correct resource" do
|
362
272
|
@client.list_unsubscribe("presidents")
|
363
|
-
a_post("/1.1/lists/subscribers/destroy.json").
|
364
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
365
|
-
should have_been_made
|
273
|
+
expect(a_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
366
274
|
end
|
367
275
|
end
|
368
276
|
end
|
@@ -370,48 +278,35 @@ describe Twitter::API do
|
|
370
278
|
describe "#list_add_members" do
|
371
279
|
context "with a screen name passed" do
|
372
280
|
before do
|
373
|
-
stub_post("/1.1/lists/members/create_all.json").
|
374
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
375
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
281
|
+
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
376
282
|
end
|
377
283
|
it "requests the correct resource" do
|
378
284
|
@client.list_add_members("sferik", "presidents", [813286, 18755393])
|
379
|
-
a_post("/1.1/lists/members/create_all.json").
|
380
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
381
|
-
should have_been_made
|
285
|
+
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"})).to have_been_made
|
382
286
|
end
|
383
287
|
it "returns the list" do
|
384
288
|
list = @client.list_add_members("sferik", "presidents", [813286, 18755393])
|
385
|
-
list.
|
386
|
-
list.name.
|
289
|
+
expect(list).to be_a Twitter::List
|
290
|
+
expect(list.name).to eq "presidents"
|
387
291
|
end
|
388
292
|
end
|
389
293
|
context "with a combination of member IDs and member screen names to add" do
|
390
294
|
before do
|
391
|
-
stub_post("/1.1/lists/members/create_all.json").
|
392
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).
|
393
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
295
|
+
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
394
296
|
end
|
395
297
|
it "requests the correct resource" do
|
396
298
|
@client.list_add_members('sferik', 'presidents', [813286, 'pengwynn', 18755393, 'erebor'])
|
397
|
-
a_post("/1.1/lists/members/create_all.json").
|
398
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).
|
399
|
-
should have_been_made
|
299
|
+
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"})).to have_been_made
|
400
300
|
end
|
401
301
|
end
|
402
302
|
context "without a screen name passed" do
|
403
303
|
before do
|
404
|
-
stub_get("/1.1/account/verify_credentials.json").
|
405
|
-
|
406
|
-
stub_post("/1.1/lists/members/create_all.json").
|
407
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
408
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
304
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
305
|
+
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
409
306
|
end
|
410
307
|
it "requests the correct resource" do
|
411
308
|
@client.list_add_members("presidents", [813286, 18755393])
|
412
|
-
a_post("/1.1/lists/members/create_all.json").
|
413
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
414
|
-
should have_been_made
|
309
|
+
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"})).to have_been_made
|
415
310
|
end
|
416
311
|
end
|
417
312
|
end
|
@@ -419,48 +314,35 @@ describe Twitter::API do
|
|
419
314
|
describe "#list_remove_members" do
|
420
315
|
context "with a screen name passed" do
|
421
316
|
before do
|
422
|
-
stub_post("/1.1/lists/members/destroy_all.json").
|
423
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
424
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
317
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
425
318
|
end
|
426
319
|
it "requests the correct resource" do
|
427
320
|
@client.list_remove_members("sferik", "presidents", [813286, 18755393])
|
428
|
-
a_post("/1.1/lists/members/destroy_all.json").
|
429
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
430
|
-
should have_been_made
|
321
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"})).to have_been_made
|
431
322
|
end
|
432
323
|
it "returns the list" do
|
433
324
|
list = @client.list_remove_members("sferik", "presidents", [813286, 18755393])
|
434
|
-
list.
|
435
|
-
list.name.
|
325
|
+
expect(list).to be_a Twitter::List
|
326
|
+
expect(list.name).to eq "presidents"
|
436
327
|
end
|
437
328
|
end
|
438
329
|
context "with a combination of member IDs and member screen names to add" do
|
439
330
|
before do
|
440
|
-
stub_post("/1.1/lists/members/destroy_all.json").
|
441
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).
|
442
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
331
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
443
332
|
end
|
444
333
|
it "requests the correct resource" do
|
445
334
|
@client.list_remove_members('sferik', 'presidents', [813286, 'pengwynn', 18755393, 'erebor'])
|
446
|
-
a_post("/1.1/lists/members/destroy_all.json").
|
447
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).
|
448
|
-
should have_been_made
|
335
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"})).to have_been_made
|
449
336
|
end
|
450
337
|
end
|
451
338
|
context "without a screen name passed" do
|
452
339
|
before do
|
453
|
-
stub_get("/1.1/account/verify_credentials.json").
|
454
|
-
|
455
|
-
stub_post("/1.1/lists/members/destroy_all.json").
|
456
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
457
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
340
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
341
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
458
342
|
end
|
459
343
|
it "requests the correct resource" do
|
460
344
|
@client.list_remove_members("presidents", [813286, 18755393])
|
461
|
-
a_post("/1.1/lists/members/destroy_all.json").
|
462
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}).
|
463
|
-
should have_been_made
|
345
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"})).to have_been_made
|
464
346
|
end
|
465
347
|
end
|
466
348
|
end
|
@@ -468,101 +350,72 @@ describe Twitter::API do
|
|
468
350
|
describe "#list_member?" do
|
469
351
|
context "with a screen name passed" do
|
470
352
|
before do
|
471
|
-
stub_get("/1.1/lists/members/show.json").
|
472
|
-
|
473
|
-
|
474
|
-
stub_get("/1.1/lists/members/show.json").
|
475
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '65493023'}).
|
476
|
-
to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
477
|
-
stub_get("/1.1/lists/members/show.json").
|
478
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '12345678'}).
|
479
|
-
to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
|
353
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
354
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '65493023'}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
355
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '12345678'}).to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
|
480
356
|
end
|
481
357
|
it "requests the correct resource" do
|
482
358
|
@client.list_member?("sferik", "presidents", 813286)
|
483
|
-
a_get("/1.1/lists/members/show.json").
|
484
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).
|
485
|
-
should have_been_made
|
359
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'})).to have_been_made
|
486
360
|
end
|
487
361
|
it "returns true if user is a list member" do
|
488
362
|
list_member = @client.list_member?("sferik", "presidents", 813286)
|
489
|
-
list_member.
|
363
|
+
expect(list_member).to be_true
|
490
364
|
end
|
491
365
|
it "returns false if user is not a list member" do
|
492
366
|
list_member = @client.list_member?("sferik", "presidents", 65493023)
|
493
|
-
list_member.
|
367
|
+
expect(list_member).to be_false
|
494
368
|
end
|
495
369
|
it "returns false if user does not exist" do
|
496
370
|
list_member = @client.list_member?("sferik", "presidents", 12345678)
|
497
|
-
list_member.
|
371
|
+
expect(list_member).to be_false
|
498
372
|
end
|
499
373
|
end
|
500
374
|
context "with an owner ID passed" do
|
501
375
|
before do
|
502
|
-
stub_get("/1.1/lists/members/show.json").
|
503
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}).
|
504
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
376
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
505
377
|
end
|
506
378
|
it "requests the correct resource" do
|
507
379
|
@client.list_member?(12345678, "presidents", 813286)
|
508
|
-
a_get("/1.1/lists/members/show.json").
|
509
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}).
|
510
|
-
should have_been_made
|
380
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'})).to have_been_made
|
511
381
|
end
|
512
382
|
end
|
513
383
|
context "with a list ID passed" do
|
514
384
|
before do
|
515
|
-
stub_get("/1.1/lists/members/show.json").
|
516
|
-
with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}).
|
517
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
385
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
518
386
|
end
|
519
387
|
it "requests the correct resource" do
|
520
388
|
@client.list_member?('sferik', 12345678, 813286)
|
521
|
-
a_get("/1.1/lists/members/show.json").
|
522
|
-
with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}).
|
523
|
-
should have_been_made
|
389
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'})).to have_been_made
|
524
390
|
end
|
525
391
|
end
|
526
392
|
context "with a list object passed" do
|
527
393
|
before do
|
528
|
-
stub_get("/1.1/lists/members/show.json").
|
529
|
-
with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'}).
|
530
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
394
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
531
395
|
end
|
532
396
|
it "requests the correct resource" do
|
533
397
|
list = Twitter::List.new(:id => 12345678, :user => {:id => 7505382, :screen_name => 'sferik'})
|
534
398
|
@client.list_member?(list, 813286)
|
535
|
-
a_get("/1.1/lists/members/show.json").
|
536
|
-
with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'}).
|
537
|
-
should have_been_made
|
399
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id => '7505382', :list_id => '12345678', :user_id => '813286'})).to have_been_made
|
538
400
|
end
|
539
401
|
end
|
540
402
|
context "with a screen name passed for user_to_check" do
|
541
403
|
before do
|
542
|
-
stub_get("/1.1/lists/members/show.json").
|
543
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}).
|
544
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"})
|
404
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"})
|
545
405
|
end
|
546
406
|
it "requests the correct resource" do
|
547
407
|
@client.list_member?("sferik", "presidents", 'erebor')
|
548
|
-
a_get("/1.1/lists/members/show.json").
|
549
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}).
|
550
|
-
should have_been_made
|
408
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'})).to have_been_made
|
551
409
|
end
|
552
410
|
end
|
553
411
|
context "without a screen name passed" do
|
554
412
|
before do
|
555
|
-
stub_get("/1.1/account/verify_credentials.json").
|
556
|
-
|
557
|
-
stub_get("/1.1/lists/members/show.json").
|
558
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).
|
559
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"})
|
413
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
414
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"})
|
560
415
|
end
|
561
416
|
it "requests the correct resource" do
|
562
417
|
@client.list_member?("presidents", 813286)
|
563
|
-
a_get("/1.1/lists/members/show.json").
|
564
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}).
|
565
|
-
should have_been_made
|
418
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'})).to have_been_made
|
566
419
|
end
|
567
420
|
end
|
568
421
|
end
|
@@ -570,37 +423,28 @@ describe Twitter::API do
|
|
570
423
|
describe "#list_members" do
|
571
424
|
context "with a screen name passed" do
|
572
425
|
before do
|
573
|
-
stub_get("/1.1/lists/members.json").
|
574
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
575
|
-
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
426
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
576
427
|
end
|
577
428
|
it "requests the correct resource" do
|
578
429
|
@client.list_members("sferik", "presidents")
|
579
|
-
a_get("/1.1/lists/members.json").
|
580
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
581
|
-
should have_been_made
|
430
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"})).to have_been_made
|
582
431
|
end
|
583
432
|
it "returns the members of the specified list" do
|
584
433
|
list_members = @client.list_members("sferik", "presidents")
|
585
|
-
list_members.
|
586
|
-
list_members.users.
|
587
|
-
list_members.users.first.
|
588
|
-
list_members.users.first.id.
|
434
|
+
expect(list_members).to be_a Twitter::Cursor
|
435
|
+
expect(list_members.users).to be_an Array
|
436
|
+
expect(list_members.users.first).to be_a Twitter::User
|
437
|
+
expect(list_members.users.first.id).to eq 7505382
|
589
438
|
end
|
590
439
|
end
|
591
440
|
context "without a screen name passed" do
|
592
441
|
before do
|
593
|
-
stub_get("/1.1/account/verify_credentials.json").
|
594
|
-
|
595
|
-
stub_get("/1.1/lists/members.json").
|
596
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
597
|
-
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
442
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
443
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
598
444
|
end
|
599
445
|
it "requests the correct resource" do
|
600
446
|
@client.list_members("presidents")
|
601
|
-
a_get("/1.1/lists/members.json").
|
602
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}).
|
603
|
-
should have_been_made
|
447
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"})).to have_been_made
|
604
448
|
end
|
605
449
|
end
|
606
450
|
end
|
@@ -608,35 +452,26 @@ describe Twitter::API do
|
|
608
452
|
describe "#list_add_member" do
|
609
453
|
context "with a screen name passed" do
|
610
454
|
before do
|
611
|
-
stub_post("/1.1/lists/members/create.json").
|
612
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
613
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
455
|
+
stub_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
614
456
|
end
|
615
457
|
it "requests the correct resource" do
|
616
458
|
@client.list_add_member("sferik", "presidents", 813286)
|
617
|
-
a_post("/1.1/lists/members/create.json").
|
618
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
619
|
-
should have_been_made
|
459
|
+
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"})).to have_been_made
|
620
460
|
end
|
621
461
|
it "returns the list" do
|
622
462
|
list = @client.list_add_member("sferik", "presidents", 813286)
|
623
|
-
list.
|
624
|
-
list.name.
|
463
|
+
expect(list).to be_a Twitter::List
|
464
|
+
expect(list.name).to eq "presidents"
|
625
465
|
end
|
626
466
|
end
|
627
467
|
context "without a screen name passed" do
|
628
468
|
before do
|
629
|
-
stub_get("/1.1/account/verify_credentials.json").
|
630
|
-
|
631
|
-
stub_post("/1.1/lists/members/create.json").
|
632
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
633
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
469
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
470
|
+
stub_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
634
471
|
end
|
635
472
|
it "requests the correct resource" do
|
636
473
|
@client.list_add_member("presidents", 813286)
|
637
|
-
a_post("/1.1/lists/members/create.json").
|
638
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}).
|
639
|
-
should have_been_made
|
474
|
+
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"})).to have_been_made
|
640
475
|
end
|
641
476
|
end
|
642
477
|
end
|
@@ -644,62 +479,45 @@ describe Twitter::API do
|
|
644
479
|
describe "#list_destroy" do
|
645
480
|
context "with a screen name passed" do
|
646
481
|
before do
|
647
|
-
stub_post("/1.1/lists/destroy.json").
|
648
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
649
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
482
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
650
483
|
end
|
651
484
|
it "requests the correct resource" do
|
652
485
|
@client.list_destroy("sferik", "presidents")
|
653
|
-
a_post("/1.1/lists/destroy.json").
|
654
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
655
|
-
should have_been_made
|
486
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
656
487
|
end
|
657
488
|
it "returns the deleted list" do
|
658
489
|
list = @client.list_destroy("sferik", "presidents")
|
659
|
-
list.
|
660
|
-
list.name.
|
490
|
+
expect(list).to be_a Twitter::List
|
491
|
+
expect(list.name).to eq "presidents"
|
661
492
|
end
|
662
493
|
end
|
663
494
|
context "without a screen name passed" do
|
664
495
|
before do
|
665
|
-
stub_get("/1.1/account/verify_credentials.json").
|
666
|
-
|
667
|
-
stub_post("/1.1/lists/destroy.json").
|
668
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
669
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
496
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
497
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
670
498
|
end
|
671
499
|
it "requests the correct resource" do
|
672
500
|
@client.list_destroy("presidents")
|
673
|
-
a_post("/1.1/lists/destroy.json").
|
674
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
675
|
-
should have_been_made
|
501
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
676
502
|
end
|
677
503
|
end
|
678
504
|
context "with a list ID passed" do
|
679
505
|
before do
|
680
|
-
stub_post("/1.1/lists/destroy.json").
|
681
|
-
with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}).
|
682
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
506
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
683
507
|
end
|
684
508
|
it "requests the correct resource" do
|
685
509
|
@client.list_destroy("sferik", 12345678)
|
686
|
-
a_post("/1.1/lists/destroy.json").
|
687
|
-
with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}).
|
688
|
-
should have_been_made
|
510
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'})).to have_been_made
|
689
511
|
end
|
690
512
|
end
|
691
513
|
context "with a list object passed" do
|
692
514
|
before do
|
693
|
-
stub_post("/1.1/lists/destroy.json").
|
694
|
-
with(:body => {:owner_id => '7505382', :list_id => '12345678'}).
|
695
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
515
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_id => '7505382', :list_id => '12345678'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
696
516
|
end
|
697
517
|
it "requests the correct resource" do
|
698
518
|
list = Twitter::List.new(:id => '12345678', :user => {:id => 7505382, :screen_name => 'sferik'})
|
699
519
|
@client.list_destroy(list)
|
700
|
-
a_post("/1.1/lists/destroy.json").
|
701
|
-
with(:body => {:owner_id => '7505382', :list_id => '12345678'}).
|
702
|
-
should have_been_made
|
520
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id => '7505382', :list_id => '12345678'})).to have_been_made
|
703
521
|
end
|
704
522
|
end
|
705
523
|
end
|
@@ -707,189 +525,141 @@ describe Twitter::API do
|
|
707
525
|
describe "#list_update" do
|
708
526
|
context "with a screen name passed" do
|
709
527
|
before do
|
710
|
-
stub_post("/1.1/lists/update.json").
|
711
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => "presidents", :description => "Presidents of the United States of America"}).
|
712
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
528
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => 'sferik', :slug => "presidents", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
713
529
|
end
|
714
530
|
it "requests the correct resource" do
|
715
531
|
@client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
|
716
|
-
a_post("/1.1/lists/update.json").
|
717
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => "presidents", :description => "Presidents of the United States of America"}).
|
718
|
-
should have_been_made
|
532
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => 'sferik', :slug => "presidents", :description => "Presidents of the United States of America"})).to have_been_made
|
719
533
|
end
|
720
534
|
it "returns the updated list" do
|
721
535
|
list = @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
|
722
|
-
list.
|
723
|
-
list.name.
|
536
|
+
expect(list).to be_a Twitter::List
|
537
|
+
expect(list.name).to eq "presidents"
|
724
538
|
end
|
725
539
|
end
|
726
540
|
context "without a screen name passed" do
|
727
541
|
before do
|
728
|
-
stub_get("/1.1/account/verify_credentials.json").
|
729
|
-
|
730
|
-
stub_post("/1.1/lists/update.json").
|
731
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :description => "Presidents of the United States of America"}).
|
732
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
542
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
543
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
733
544
|
end
|
734
545
|
it "requests the correct resource" do
|
735
546
|
@client.list_update("presidents", :description => "Presidents of the United States of America")
|
736
|
-
a_post("/1.1/lists/update.json").
|
737
|
-
with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :description => "Presidents of the United States of America"}).
|
738
|
-
should have_been_made
|
547
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :description => "Presidents of the United States of America"})).to have_been_made
|
739
548
|
end
|
740
549
|
end
|
741
550
|
context "with a list ID passed" do
|
742
551
|
before do
|
743
|
-
stub_post("/1.1/lists/update.json").
|
744
|
-
with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :description => "Presidents of the United States of America"}).
|
745
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
552
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
746
553
|
end
|
747
554
|
it "requests the correct resource" do
|
748
555
|
@client.list_update("sferik", 12345678, :description => "Presidents of the United States of America")
|
749
|
-
a_post("/1.1/lists/update.json").
|
750
|
-
with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :description => "Presidents of the United States of America"}).
|
751
|
-
should have_been_made
|
556
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :description => "Presidents of the United States of America"})).to have_been_made
|
752
557
|
end
|
753
558
|
end
|
754
559
|
context "with a list object passed" do
|
755
560
|
before do
|
756
|
-
stub_post("/1.1/lists/update.json").
|
757
|
-
with(:body => {:owner_id => '7505382', :list_id => '12345678', :description => "Presidents of the United States of America"}).
|
758
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
561
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_id => '7505382', :list_id => '12345678', :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
759
562
|
end
|
760
563
|
it "requests the correct resource" do
|
761
564
|
list = Twitter::List.new(:id => '12345678', :user => {:id => 7505382, :screen_name => 'sferik'})
|
762
565
|
@client.list_update(list, :description => "Presidents of the United States of America")
|
763
|
-
a_post("/1.1/lists/update.json").
|
764
|
-
with(:body => {:owner_id => '7505382', :list_id => '12345678', :description => "Presidents of the United States of America"}).
|
765
|
-
should have_been_made
|
566
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_id => '7505382', :list_id => '12345678', :description => "Presidents of the United States of America"})).to have_been_made
|
766
567
|
end
|
767
568
|
end
|
768
569
|
end
|
769
570
|
|
770
571
|
describe "#list_create" do
|
771
572
|
before do
|
772
|
-
stub_post("/1.1/lists/create.json").
|
773
|
-
with(:body => {:name => "presidents"}).
|
774
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
573
|
+
stub_post("/1.1/lists/create.json").with(:body => {:name => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
775
574
|
end
|
776
575
|
it "requests the correct resource" do
|
777
576
|
@client.list_create("presidents")
|
778
|
-
a_post("/1.1/lists/create.json").
|
779
|
-
with(:body => {:name => "presidents"}).
|
780
|
-
should have_been_made
|
577
|
+
expect(a_post("/1.1/lists/create.json").with(:body => {:name => "presidents"})).to have_been_made
|
781
578
|
end
|
782
579
|
it "returns the created list" do
|
783
580
|
list = @client.list_create("presidents")
|
784
|
-
list.
|
785
|
-
list.name.
|
581
|
+
expect(list).to be_a Twitter::List
|
582
|
+
expect(list.name).to eq "presidents"
|
786
583
|
end
|
787
584
|
end
|
788
585
|
|
789
586
|
describe "#lists" do
|
790
587
|
before do
|
791
|
-
stub_get("/1.1/lists/list.json").
|
792
|
-
to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
588
|
+
stub_get("/1.1/lists/list.json").to_return(:body => fixture("lists.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
793
589
|
end
|
794
590
|
it "requests the correct resource" do
|
795
591
|
@client.lists
|
796
|
-
a_get("/1.1/lists/list.json").
|
797
|
-
should have_been_made
|
592
|
+
expect(a_get("/1.1/lists/list.json")).to have_been_made
|
798
593
|
end
|
799
594
|
it "returns the requested list" do
|
800
595
|
lists = @client.lists
|
801
|
-
lists.
|
802
|
-
lists.first.
|
803
|
-
lists.first.name.
|
596
|
+
expect(lists).to be_an Array
|
597
|
+
expect(lists.first).to be_a Twitter::List
|
598
|
+
expect(lists.first.name).to eq "Rubyists"
|
804
599
|
end
|
805
600
|
end
|
806
601
|
|
807
602
|
describe "#list" do
|
808
603
|
context "with a screen name passed" do
|
809
604
|
before do
|
810
|
-
stub_get("/1.1/lists/show.json").
|
811
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
812
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
605
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
813
606
|
end
|
814
607
|
it "requests the correct resource" do
|
815
608
|
@client.list("sferik", "presidents")
|
816
|
-
a_get("/1.1/lists/show.json").
|
817
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
818
|
-
should have_been_made
|
609
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
819
610
|
end
|
820
611
|
it "returns the updated list" do
|
821
612
|
list = @client.list("sferik", "presidents")
|
822
|
-
list.
|
823
|
-
list.name.
|
613
|
+
expect(list).to be_a Twitter::List
|
614
|
+
expect(list.name).to eq "presidents"
|
824
615
|
end
|
825
616
|
end
|
826
617
|
context "with a user ID passed" do
|
827
618
|
before do
|
828
|
-
stub_get("/1.1/lists/show.json").
|
829
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents'}).
|
830
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
619
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
831
620
|
end
|
832
621
|
it "requests the correct resource" do
|
833
622
|
@client.list(12345678, 'presidents')
|
834
|
-
a_get("/1.1/lists/show.json").
|
835
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents'}).
|
836
|
-
should have_been_made
|
623
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents'})).to have_been_made
|
837
624
|
end
|
838
625
|
end
|
839
626
|
context "with a user object passed" do
|
840
627
|
before do
|
841
|
-
stub_get("/1.1/lists/show.json").
|
842
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents'}).
|
843
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
628
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
844
629
|
end
|
845
630
|
it "requests the correct resource" do
|
846
631
|
user = Twitter::User.new(:id => '12345678')
|
847
632
|
@client.list(user, 'presidents')
|
848
|
-
a_get("/1.1/lists/show.json").
|
849
|
-
with(:query => {:owner_id => '12345678', :slug => 'presidents'}).
|
850
|
-
should have_been_made
|
633
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id => '12345678', :slug => 'presidents'})).to have_been_made
|
851
634
|
end
|
852
635
|
end
|
853
636
|
context "without a screen name passed" do
|
854
637
|
before do
|
855
|
-
stub_get("/1.1/account/verify_credentials.json").
|
856
|
-
|
857
|
-
stub_get("/1.1/lists/show.json").
|
858
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
859
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
638
|
+
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
639
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
860
640
|
end
|
861
641
|
it "requests the correct resource" do
|
862
642
|
@client.list("presidents")
|
863
|
-
a_get("/1.1/lists/show.json").
|
864
|
-
with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}).
|
865
|
-
should have_been_made
|
643
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'})).to have_been_made
|
866
644
|
end
|
867
645
|
end
|
868
646
|
context "with a list ID passed" do
|
869
647
|
before do
|
870
|
-
stub_get("/1.1/lists/show.json").
|
871
|
-
with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}).
|
872
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
648
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
873
649
|
end
|
874
650
|
it "requests the correct resource" do
|
875
651
|
@client.list("sferik", 12345678)
|
876
|
-
a_get("/1.1/lists/show.json").
|
877
|
-
with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}).
|
878
|
-
should have_been_made
|
652
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'})).to have_been_made
|
879
653
|
end
|
880
654
|
end
|
881
655
|
context "with a list object passed" do
|
882
656
|
before do
|
883
|
-
stub_get("/1.1/lists/show.json").
|
884
|
-
with(:query => {:owner_id => '7505382', :list_id => '12345678'}).
|
885
|
-
to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
657
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_id => '7505382', :list_id => '12345678'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
886
658
|
end
|
887
659
|
it "requests the correct resource" do
|
888
660
|
list = Twitter::List.new(:id => '12345678', :user => {:id => 7505382, :screen_name => 'sferik'})
|
889
661
|
@client.list(list)
|
890
|
-
a_get("/1.1/lists/show.json").
|
891
|
-
with(:query => {:owner_id => '7505382', :list_id => '12345678'}).
|
892
|
-
should have_been_made
|
662
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id => '7505382', :list_id => '12345678'})).to have_been_made
|
893
663
|
end
|
894
664
|
end
|
895
665
|
end
|