twitter 4.8.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +36 -0
- data/CONTRIBUTING.md +13 -15
- data/LICENSE.md +1 -1
- data/README.md +401 -261
- data/Rakefile +6 -0
- data/lib/twitter/arguments.rb +14 -0
- data/lib/twitter/base.rb +109 -89
- data/lib/twitter/client.rb +38 -115
- data/lib/twitter/configuration.rb +5 -2
- data/lib/twitter/core_ext/kernel.rb +5 -1
- data/lib/twitter/creatable.rb +7 -4
- data/lib/twitter/cursor.rb +57 -45
- data/lib/twitter/direct_message.rb +2 -11
- data/lib/twitter/entity/uri.rb +14 -0
- data/lib/twitter/enumerable.rb +15 -0
- data/lib/twitter/error/already_favorited.rb +1 -1
- data/lib/twitter/error/already_posted.rb +10 -0
- data/lib/twitter/error/already_retweeted.rb +1 -1
- data/lib/twitter/error/bad_gateway.rb +2 -3
- data/lib/twitter/error/bad_request.rb +2 -2
- data/lib/twitter/error/forbidden.rb +2 -2
- data/lib/twitter/error/gateway_timeout.rb +2 -3
- data/lib/twitter/error/internal_server_error.rb +2 -3
- data/lib/twitter/error/not_acceptable.rb +2 -2
- data/lib/twitter/error/not_found.rb +2 -2
- data/lib/twitter/error/service_unavailable.rb +2 -3
- data/lib/twitter/error/too_many_requests.rb +2 -2
- data/lib/twitter/error/unauthorized.rb +2 -2
- data/lib/twitter/error/unprocessable_entity.rb +2 -2
- data/lib/twitter/error.rb +65 -14
- data/lib/twitter/factory.rb +13 -12
- data/lib/twitter/geo.rb +2 -7
- data/lib/twitter/geo_factory.rb +11 -7
- data/lib/twitter/geo_results.rb +40 -0
- data/lib/twitter/identity.rb +4 -34
- data/lib/twitter/list.rb +21 -4
- data/lib/twitter/media/photo.rb +6 -4
- data/lib/twitter/media_factory.rb +11 -7
- data/lib/twitter/null_object.rb +25 -0
- data/lib/twitter/oembed.rb +3 -2
- data/lib/twitter/place.rb +15 -15
- data/lib/twitter/profile_banner.rb +3 -2
- data/lib/twitter/rate_limit.rb +4 -17
- data/lib/twitter/relationship.rb +2 -19
- data/lib/twitter/rest/api/direct_messages.rb +138 -0
- data/lib/twitter/rest/api/favorites.rb +115 -0
- data/lib/twitter/rest/api/friends_and_followers.rb +287 -0
- data/lib/twitter/rest/api/help.rb +58 -0
- data/lib/twitter/rest/api/lists.rb +498 -0
- data/lib/twitter/rest/api/oauth.rb +62 -0
- data/lib/twitter/rest/api/places_and_geo.rb +86 -0
- data/lib/twitter/rest/api/saved_searches.rb +93 -0
- data/lib/twitter/rest/api/search.rb +37 -0
- data/lib/twitter/rest/api/spam_reporting.rb +29 -0
- data/lib/twitter/rest/api/suggested_users.rb +51 -0
- data/lib/twitter/rest/api/timelines.rb +202 -0
- data/lib/twitter/rest/api/trends.rb +58 -0
- data/lib/twitter/rest/api/tweets.rb +291 -0
- data/lib/twitter/rest/api/undocumented.rb +52 -0
- data/lib/twitter/rest/api/users.rb +383 -0
- data/lib/twitter/rest/api/utils.rb +246 -0
- data/lib/twitter/rest/client.rb +175 -0
- data/lib/twitter/rest/request/multipart_with_file.rb +36 -0
- data/lib/twitter/rest/response/parse_error_json.rb +15 -0
- data/lib/twitter/rest/response/parse_json.rb +31 -0
- data/lib/twitter/{response → rest/response}/raise_error.rb +8 -11
- data/lib/twitter/search_results.rb +37 -21
- data/lib/twitter/settings.rb +1 -6
- data/lib/twitter/size.rb +2 -15
- data/lib/twitter/streaming/client.rb +89 -0
- data/lib/twitter/streaming/connection.rb +22 -0
- data/lib/twitter/streaming/event.rb +35 -0
- data/lib/twitter/streaming/friend_list.rb +13 -0
- data/lib/twitter/streaming/message_parser.rb +18 -0
- data/lib/twitter/streaming/response.rb +34 -0
- data/lib/twitter/suggestion.rb +5 -8
- data/lib/twitter/token.rb +11 -1
- data/lib/twitter/trend.rb +4 -8
- data/lib/twitter/trend_results.rb +65 -0
- data/lib/twitter/tweet.rb +43 -92
- data/lib/twitter/user.rb +72 -47
- data/lib/twitter/version.rb +4 -4
- data/lib/twitter.rb +4 -39
- data/spec/fixtures/already_posted.json +1 -0
- data/spec/fixtures/ids_list.json +1 -1
- data/spec/fixtures/ids_list2.json +1 -1
- data/spec/fixtures/request_token.txt +6 -0
- data/spec/fixtures/search.json +1 -1
- data/spec/fixtures/search_malformed.json +1 -1
- data/spec/fixtures/track_streaming.json +3 -0
- data/spec/fixtures/track_streaming_user.json +5 -0
- data/spec/helper.rb +8 -13
- data/spec/twitter/base_spec.rb +13 -103
- data/spec/twitter/basic_user_spec.rb +3 -3
- data/spec/twitter/configuration_spec.rb +1 -1
- data/spec/twitter/cursor_spec.rb +17 -35
- data/spec/twitter/direct_message_spec.rb +44 -11
- data/spec/twitter/entity/uri_spec.rb +75 -0
- data/spec/twitter/error_spec.rb +59 -11
- data/spec/twitter/geo/point_spec.rb +6 -6
- data/spec/twitter/geo/polygon_spec.rb +5 -5
- data/spec/twitter/geo_factory_spec.rb +4 -4
- data/spec/twitter/geo_results_spec.rb +35 -0
- data/spec/twitter/geo_spec.rb +6 -6
- data/spec/twitter/identifiable_spec.rb +5 -26
- data/spec/twitter/list_spec.rb +54 -11
- data/spec/twitter/media/photo_spec.rb +122 -6
- data/spec/twitter/media_factory_spec.rb +3 -3
- data/spec/twitter/null_object_spec.rb +27 -0
- data/spec/twitter/oembed_spec.rb +69 -45
- data/spec/twitter/place_spec.rb +84 -28
- data/spec/twitter/profile_banner_spec.rb +1 -1
- data/spec/twitter/rate_limit_spec.rb +8 -25
- data/spec/twitter/relationship_spec.rb +26 -12
- data/spec/twitter/{api → rest/api}/direct_messages_spec.rb +28 -15
- data/spec/twitter/{api → rest/api}/favorites_spec.rb +80 -7
- data/spec/twitter/{api → rest/api}/friends_and_followers_spec.rb +121 -152
- data/spec/twitter/{api → rest/api}/geo_spec.rb +9 -23
- data/spec/twitter/{api → rest/api}/help_spec.rb +6 -6
- data/spec/twitter/{api → rest/api}/lists_spec.rb +116 -95
- data/spec/twitter/{api → rest/api}/oauth_spec.rb +21 -10
- data/spec/twitter/{api → rest/api}/saved_searches_spec.rb +13 -13
- data/spec/twitter/{api → rest/api}/search_spec.rb +8 -9
- data/spec/twitter/{api → rest/api}/spam_reporting_spec.rb +3 -3
- data/spec/twitter/{api → rest/api}/suggested_users_spec.rb +5 -5
- data/spec/twitter/{api → rest/api}/timelines_spec.rb +9 -9
- data/spec/twitter/{api → rest/api}/trends_spec.rb +6 -6
- data/spec/twitter/rest/api/tweets_spec.rb +503 -0
- data/spec/twitter/{api → rest/api}/undocumented_spec.rb +19 -45
- data/spec/twitter/{api → rest/api}/users_spec.rb +64 -39
- data/spec/twitter/rest/client_spec.rb +193 -0
- data/spec/twitter/saved_search_spec.rb +14 -3
- data/spec/twitter/search_results_spec.rb +32 -45
- data/spec/twitter/settings_spec.rb +17 -6
- data/spec/twitter/size_spec.rb +5 -15
- data/spec/twitter/source_user_spec.rb +3 -3
- data/spec/twitter/streaming/client_spec.rb +92 -0
- data/spec/twitter/streaming/event_spec.rb +45 -0
- data/spec/twitter/suggestion_spec.rb +5 -15
- data/spec/twitter/target_user_spec.rb +3 -3
- data/spec/twitter/token_spec.rb +16 -0
- data/spec/twitter/trend_results_spec.rb +89 -0
- data/spec/twitter/trend_spec.rb +26 -13
- data/spec/twitter/tweet_spec.rb +137 -124
- data/spec/twitter/user_spec.rb +139 -80
- data/spec/twitter_spec.rb +0 -119
- data/twitter.gemspec +12 -6
- data.tar.gz.sig +0 -0
- metadata +197 -138
- metadata.gz.sig +0 -0
- data/lib/twitter/action/favorite.rb +0 -19
- data/lib/twitter/action/follow.rb +0 -30
- data/lib/twitter/action/list_member_added.rb +0 -39
- data/lib/twitter/action/mention.rb +0 -46
- data/lib/twitter/action/reply.rb +0 -27
- data/lib/twitter/action/retweet.rb +0 -27
- data/lib/twitter/action/tweet.rb +0 -20
- data/lib/twitter/action_factory.rb +0 -22
- data/lib/twitter/api/arguments.rb +0 -13
- data/lib/twitter/api/direct_messages.rb +0 -148
- data/lib/twitter/api/favorites.rb +0 -126
- data/lib/twitter/api/friends_and_followers.rb +0 -334
- data/lib/twitter/api/help.rb +0 -64
- data/lib/twitter/api/lists.rb +0 -618
- data/lib/twitter/api/oauth.rb +0 -44
- data/lib/twitter/api/places_and_geo.rb +0 -121
- data/lib/twitter/api/saved_searches.rb +0 -99
- data/lib/twitter/api/search.rb +0 -37
- data/lib/twitter/api/spam_reporting.rb +0 -30
- data/lib/twitter/api/suggested_users.rb +0 -55
- data/lib/twitter/api/timelines.rb +0 -214
- data/lib/twitter/api/trends.rb +0 -63
- data/lib/twitter/api/tweets.rb +0 -304
- data/lib/twitter/api/undocumented.rb +0 -97
- data/lib/twitter/api/users.rb +0 -439
- data/lib/twitter/api/utils.rb +0 -187
- data/lib/twitter/configurable.rb +0 -96
- data/lib/twitter/default.rb +0 -102
- data/lib/twitter/entity/url.rb +0 -9
- data/lib/twitter/error/client_error.rb +0 -35
- data/lib/twitter/error/decode_error.rb +0 -9
- data/lib/twitter/error/identity_map_key_error.rb +0 -9
- data/lib/twitter/error/server_error.rb +0 -28
- data/lib/twitter/exceptable.rb +0 -36
- data/lib/twitter/identity_map.rb +0 -22
- data/lib/twitter/request/multipart_with_file.rb +0 -34
- data/lib/twitter/response/parse_json.rb +0 -25
- data/spec/fixtures/about_me.json +0 -1
- data/spec/fixtures/activity_summary.json +0 -1
- data/spec/fixtures/bad_gateway.json +0 -1
- data/spec/fixtures/bad_request.json +0 -1
- data/spec/fixtures/by_friends.json +0 -1
- data/spec/fixtures/end_session.json +0 -1
- data/spec/fixtures/forbidden.json +0 -1
- data/spec/fixtures/internal_server_error.json +0 -1
- data/spec/fixtures/not_acceptable.json +0 -1
- data/spec/fixtures/phoenix_search.phoenix +0 -1
- data/spec/fixtures/resolve.json +0 -1
- data/spec/fixtures/service_unavailable.json +0 -1
- data/spec/fixtures/totals.json +0 -1
- data/spec/fixtures/trends.json +0 -1
- data/spec/fixtures/unauthorized.json +0 -1
- data/spec/fixtures/video_facets.json +0 -1
- data/spec/twitter/action/favorite_spec.rb +0 -29
- data/spec/twitter/action/follow_spec.rb +0 -29
- data/spec/twitter/action/list_member_added_spec.rb +0 -41
- data/spec/twitter/action/mention_spec.rb +0 -52
- data/spec/twitter/action/reply_spec.rb +0 -41
- data/spec/twitter/action/retweet_spec.rb +0 -41
- data/spec/twitter/action_factory_spec.rb +0 -35
- data/spec/twitter/action_spec.rb +0 -16
- data/spec/twitter/api/tweets_spec.rb +0 -285
- data/spec/twitter/client_spec.rb +0 -223
- data/spec/twitter/error/client_error_spec.rb +0 -23
- data/spec/twitter/error/server_error_spec.rb +0 -20
|
@@ -7,22 +7,22 @@ describe Twitter::Geo::Polygon do
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
describe "#==" do
|
|
10
|
-
it "returns
|
|
10
|
+
it "returns true for empty objects" do
|
|
11
11
|
polygon = Twitter::Geo::Polygon.new
|
|
12
12
|
other = Twitter::Geo::Polygon.new
|
|
13
|
-
expect(polygon == other).to
|
|
13
|
+
expect(polygon == other).to be true
|
|
14
14
|
end
|
|
15
15
|
it "returns true when objects coordinates are the same" do
|
|
16
16
|
other = Twitter::Geo::Polygon.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
|
|
17
|
-
expect(@polygon == other).to
|
|
17
|
+
expect(@polygon == other).to be true
|
|
18
18
|
end
|
|
19
19
|
it "returns false when objects coordinates are different" do
|
|
20
20
|
other = Twitter::Geo::Polygon.new(:coordinates => [[[37.77752898, -122.40348192], [37.77752898, -122.387436], [37.79448597, -122.387436], [37.79448597, -122.40348192]]])
|
|
21
|
-
expect(@polygon == other).to
|
|
21
|
+
expect(@polygon == other).to be false
|
|
22
22
|
end
|
|
23
23
|
it "returns false when classes are different" do
|
|
24
24
|
other = Twitter::Geo.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
|
|
25
|
-
expect(@polygon == other).to
|
|
25
|
+
expect(@polygon == other).to be false
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -4,15 +4,15 @@ describe Twitter::GeoFactory do
|
|
|
4
4
|
|
|
5
5
|
describe ".new" do
|
|
6
6
|
it "generates a Point" do
|
|
7
|
-
geo = Twitter::GeoFactory.
|
|
7
|
+
geo = Twitter::GeoFactory.new(:type => "Point")
|
|
8
8
|
expect(geo).to be_a Twitter::Geo::Point
|
|
9
9
|
end
|
|
10
10
|
it "generates a Polygon" do
|
|
11
|
-
geo = Twitter::GeoFactory.
|
|
11
|
+
geo = Twitter::GeoFactory.new(:type => "Polygon")
|
|
12
12
|
expect(geo).to be_a Twitter::Geo::Polygon
|
|
13
13
|
end
|
|
14
|
-
it "raises an
|
|
15
|
-
expect{Twitter::GeoFactory.
|
|
14
|
+
it "raises an IndexError when type is not specified" do
|
|
15
|
+
expect{Twitter::GeoFactory.new}.to raise_error IndexError
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
describe Twitter::GeoResults do
|
|
4
|
+
|
|
5
|
+
describe "#each" do
|
|
6
|
+
before do
|
|
7
|
+
@geo_results = Twitter::GeoResults.new(:result => {:places => [{:id => 1}, {:id => 2}, {:id => 3}, {:id => 4}, {:id => 5}, {:id => 6}]})
|
|
8
|
+
end
|
|
9
|
+
it "iterates" do
|
|
10
|
+
count = 0
|
|
11
|
+
@geo_results.each{count += 1}
|
|
12
|
+
expect(count).to eq(6)
|
|
13
|
+
end
|
|
14
|
+
context "with start" do
|
|
15
|
+
it "iterates" do
|
|
16
|
+
count = 0
|
|
17
|
+
@geo_results.each(5){count += 1}
|
|
18
|
+
expect(count).to eq(1)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "#token" do
|
|
24
|
+
it "returns a String when token is set" do
|
|
25
|
+
geo_results = Twitter::GeoResults.new(:result => {}, :token => "abc123")
|
|
26
|
+
expect(geo_results.token).to be_a String
|
|
27
|
+
expect(geo_results.token).to eq("abc123")
|
|
28
|
+
end
|
|
29
|
+
it "returns nil when token is not set" do
|
|
30
|
+
geo_results = Twitter::GeoResults.new(:result => {})
|
|
31
|
+
expect(geo_results.token).to be_nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
data/spec/twitter/geo_spec.rb
CHANGED
|
@@ -7,22 +7,22 @@ describe Twitter::Geo do
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
describe "#==" do
|
|
10
|
-
it "returns
|
|
10
|
+
it "returns true for empty objects" do
|
|
11
11
|
geo = Twitter::Geo.new
|
|
12
12
|
other = Twitter::Geo.new
|
|
13
|
-
expect(geo == other).to
|
|
13
|
+
expect(geo == other).to be true
|
|
14
14
|
end
|
|
15
15
|
it "returns true when objects coordinates are the same" do
|
|
16
16
|
other = Twitter::Geo.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
|
|
17
|
-
expect(@geo == other).to
|
|
17
|
+
expect(@geo == other).to be true
|
|
18
18
|
end
|
|
19
19
|
it "returns false when objects coordinates are different" do
|
|
20
20
|
other = Twitter::Geo.new(:coordinates => [[[37.77752898, -122.40348192], [37.77752898, -122.387436], [37.79448597, -122.387436], [37.79448597, -122.40348192]]])
|
|
21
|
-
expect(@geo == other).to
|
|
21
|
+
expect(@geo == other).to be false
|
|
22
22
|
end
|
|
23
|
-
it "returns
|
|
23
|
+
it "returns true when classes are different" do
|
|
24
24
|
other = Twitter::Geo::Polygon.new(:coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]])
|
|
25
|
-
expect(@geo == other).to
|
|
25
|
+
expect(@geo == other).to be true
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -3,29 +3,8 @@ require 'helper'
|
|
|
3
3
|
describe Twitter::Identity do
|
|
4
4
|
|
|
5
5
|
describe "#initialize" do
|
|
6
|
-
it "raises an
|
|
7
|
-
expect{Twitter::Identity.new}.to raise_error
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context "identity map enabled" do
|
|
12
|
-
before do
|
|
13
|
-
Twitter.identity_map = Twitter::IdentityMap
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after do
|
|
17
|
-
Twitter.identity_map = false
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe ".fetch" do
|
|
21
|
-
it "returns existing objects" do
|
|
22
|
-
Twitter::Identity.store(Twitter::Identity.new(:id => 1))
|
|
23
|
-
expect(Twitter::Identity.fetch(:id => 1)).to be
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "raises an error on objects that don't exist" do
|
|
27
|
-
expect{Twitter::Identity.fetch(:id => 6)}.to raise_error Twitter::Error::IdentityMapKeyError
|
|
28
|
-
end
|
|
6
|
+
it "raises an IndexError when id is not specified" do
|
|
7
|
+
expect{Twitter::Identity.new}.to raise_error IndexError
|
|
29
8
|
end
|
|
30
9
|
end
|
|
31
10
|
|
|
@@ -33,17 +12,17 @@ describe Twitter::Identity do
|
|
|
33
12
|
it "returns true when objects IDs are the same" do
|
|
34
13
|
one = Twitter::Identity.new(:id => 1, :screen_name => "sferik")
|
|
35
14
|
two = Twitter::Identity.new(:id => 1, :screen_name => "garybernhardt")
|
|
36
|
-
expect(one == two).to
|
|
15
|
+
expect(one == two).to be true
|
|
37
16
|
end
|
|
38
17
|
it "returns false when objects IDs are different" do
|
|
39
18
|
one = Twitter::Identity.new(:id => 1)
|
|
40
19
|
two = Twitter::Identity.new(:id => 2)
|
|
41
|
-
expect(one == two).to
|
|
20
|
+
expect(one == two).to be false
|
|
42
21
|
end
|
|
43
22
|
it "returns false when classes are different" do
|
|
44
23
|
one = Twitter::Identity.new(:id => 1)
|
|
45
24
|
two = Twitter::Base.new(:id => 1)
|
|
46
|
-
expect(one == two).to
|
|
25
|
+
expect(one == two).to be false
|
|
47
26
|
end
|
|
48
27
|
end
|
|
49
28
|
|
data/spec/twitter/list_spec.rb
CHANGED
|
@@ -6,39 +6,82 @@ describe Twitter::List do
|
|
|
6
6
|
it "returns true when objects IDs are the same" do
|
|
7
7
|
list = Twitter::List.new(:id => 1, :slug => "foo")
|
|
8
8
|
other = Twitter::List.new(:id => 1, :slug => "bar")
|
|
9
|
-
expect(list == other).to
|
|
9
|
+
expect(list == other).to be true
|
|
10
10
|
end
|
|
11
11
|
it "returns false when objects IDs are different" do
|
|
12
12
|
list = Twitter::List.new(:id => 1)
|
|
13
13
|
other = Twitter::List.new(:id => 2)
|
|
14
|
-
expect(list == other).to
|
|
14
|
+
expect(list == other).to be false
|
|
15
15
|
end
|
|
16
16
|
it "returns false when classes are different" do
|
|
17
17
|
list = Twitter::List.new(:id => 1)
|
|
18
18
|
other = Twitter::Identity.new(:id => 1)
|
|
19
|
-
expect(list == other).to
|
|
19
|
+
expect(list == other).to be false
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
describe "#created_at" do
|
|
24
24
|
it "returns a Time when created_at is set" do
|
|
25
|
-
|
|
26
|
-
expect(
|
|
25
|
+
list = Twitter::List.new(:id => 8863586, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
|
|
26
|
+
expect(list.created_at).to be_a Time
|
|
27
27
|
end
|
|
28
28
|
it "returns nil when created_at is not set" do
|
|
29
|
-
|
|
30
|
-
expect(
|
|
29
|
+
list = Twitter::List.new(:id => 8863586)
|
|
30
|
+
expect(list.created_at).to be_nil
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "#created?" do
|
|
35
|
+
it "returns true when created_at is set" do
|
|
36
|
+
list = Twitter::List.new(:id => 8863586, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
|
|
37
|
+
expect(list.created?).to be true
|
|
38
|
+
end
|
|
39
|
+
it "returns false when created_at is not set" do
|
|
40
|
+
list = Twitter::List.new(:id => 8863586)
|
|
41
|
+
expect(list.created?).to be false
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe "#members_uri" do
|
|
46
|
+
it "returns the URI to the list members" do
|
|
47
|
+
list = Twitter::List.new(:id => 8863586, :slug => "presidents", :user => {:id => 7505382, :screen_name => "sferik"})
|
|
48
|
+
expect(list.members_uri.to_s).to eq("https://twitter.com/sferik/presidents/members")
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe "#subscribers_uri" do
|
|
53
|
+
it "returns the URI to the list subscribers" do
|
|
54
|
+
list = Twitter::List.new(:id => 8863586, :slug => "presidents", :user => {:id => 7505382, :screen_name => "sferik"})
|
|
55
|
+
expect(list.subscribers_uri.to_s).to eq("https://twitter.com/sferik/presidents/subscribers")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "#uri" do
|
|
60
|
+
it "returns the URI to the list" do
|
|
61
|
+
list = Twitter::List.new(:id => 8863586, :slug => "presidents", :user => {:id => 7505382, :screen_name => "sferik"})
|
|
62
|
+
expect(list.uri.to_s).to eq("https://twitter.com/sferik/presidents")
|
|
31
63
|
end
|
|
32
64
|
end
|
|
33
65
|
|
|
34
66
|
describe "#user" do
|
|
35
67
|
it "returns a User when user is set" do
|
|
36
|
-
|
|
37
|
-
expect(user).to be_a Twitter::User
|
|
68
|
+
list = Twitter::List.new(:id => 8863586, :user => {:id => 7505382})
|
|
69
|
+
expect(list.user).to be_a Twitter::User
|
|
38
70
|
end
|
|
39
71
|
it "returns nil when status is not set" do
|
|
40
|
-
|
|
41
|
-
expect(user).to be_nil
|
|
72
|
+
list = Twitter::List.new(:id => 8863586)
|
|
73
|
+
expect(list.user).to be_nil
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe "#user?" do
|
|
78
|
+
it "returns true when user is set" do
|
|
79
|
+
list = Twitter::List.new(:id => 8863586, :user => {:id => 7505382})
|
|
80
|
+
expect(list.user?).to be true
|
|
81
|
+
end
|
|
82
|
+
it "returns false when user is not set" do
|
|
83
|
+
list = Twitter::List.new(:id => 8863586)
|
|
84
|
+
expect(list.user?).to be false
|
|
42
85
|
end
|
|
43
86
|
end
|
|
44
87
|
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
+
# coding: utf-8
|
|
1
2
|
require 'helper'
|
|
2
3
|
|
|
3
4
|
describe Twitter::Media::Photo do
|
|
4
5
|
|
|
5
6
|
describe "#==" do
|
|
6
7
|
it "returns true when objects IDs are the same" do
|
|
7
|
-
photo = Twitter::Media::Photo.new(:id => 1
|
|
8
|
-
other = Twitter::Media::Photo.new(:id => 1
|
|
9
|
-
expect(photo == other).to
|
|
8
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
9
|
+
other = Twitter::Media::Photo.new(:id => 1)
|
|
10
|
+
expect(photo == other).to be true
|
|
10
11
|
end
|
|
11
12
|
it "returns false when objects IDs are different" do
|
|
12
13
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
13
14
|
other = Twitter::Media::Photo.new(:id => 2)
|
|
14
|
-
expect(photo == other).to
|
|
15
|
+
expect(photo == other).to be false
|
|
15
16
|
end
|
|
16
17
|
it "returns false when classes are different" do
|
|
17
18
|
photo = Twitter::Media::Photo.new(:id => 1)
|
|
18
19
|
other = Twitter::Identity.new(:id => 1)
|
|
19
|
-
expect(photo == other).to
|
|
20
|
+
expect(photo == other).to be false
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
describe "#sizes" do
|
|
24
25
|
it "returns a hash of Sizes when sizes is set" do
|
|
25
|
-
sizes = Twitter::Media::Photo.new(:id => 110102452988157952, :sizes => {:small => {:h => 226, :w => 340, :resize =>
|
|
26
|
+
sizes = Twitter::Media::Photo.new(:id => 110102452988157952, :sizes => {:small => {:h => 226, :w => 340, :resize => "fit"}, :large => {:h => 466, :w => 700, :resize => "fit"}, :medium => {:h => 399, :w => 600, :resize => "fit"}, :thumb => {:h => 150, :w => 150, :resize => "crop"}}).sizes
|
|
26
27
|
expect(sizes).to be_a Hash
|
|
27
28
|
expect(sizes[:small]).to be_a Twitter::Size
|
|
28
29
|
end
|
|
@@ -32,4 +33,119 @@ describe Twitter::Media::Photo do
|
|
|
32
33
|
end
|
|
33
34
|
end
|
|
34
35
|
|
|
36
|
+
describe "#display_uri" do
|
|
37
|
+
it "returns a String when the display_url is set" do
|
|
38
|
+
photo = Twitter::Media::Photo.new(:id => 1, :display_url => "example.com/expanded…")
|
|
39
|
+
expect(photo.display_uri).to be_a String
|
|
40
|
+
expect(photo.display_uri).to eq("example.com/expanded…")
|
|
41
|
+
end
|
|
42
|
+
it "returns nil when the display_url is not set" do
|
|
43
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
44
|
+
expect(photo.display_uri).to be_nil
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe "#display_uri?" do
|
|
49
|
+
it "returns true when the display_url is set" do
|
|
50
|
+
photo = Twitter::Media::Photo.new(:id => 1, :display_url => "example.com/expanded…")
|
|
51
|
+
expect(photo.display_uri?).to be true
|
|
52
|
+
end
|
|
53
|
+
it "returns false when the display_url is not set" do
|
|
54
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
55
|
+
expect(photo.display_uri?).to be false
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "#expanded_uri" do
|
|
60
|
+
it "returns a URI when the expanded_url is set" do
|
|
61
|
+
photo = Twitter::Media::Photo.new(:id => 1, :expanded_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
62
|
+
expect(photo.expanded_uri).to be_a URI
|
|
63
|
+
expect(photo.expanded_uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
64
|
+
end
|
|
65
|
+
it "returns nil when the expanded_url is not set" do
|
|
66
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
67
|
+
expect(photo.expanded_uri).to be_nil
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
describe "#expanded_uri?" do
|
|
72
|
+
it "returns true when the expanded_url is set" do
|
|
73
|
+
photo = Twitter::Media::Photo.new(:id => 1, :expanded_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
74
|
+
expect(photo.expanded_uri?).to be true
|
|
75
|
+
end
|
|
76
|
+
it "returns false when the expanded_url is not set" do
|
|
77
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
78
|
+
expect(photo.expanded_uri?).to be false
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe "#media_uri" do
|
|
83
|
+
it "returns a URI when the media_url is set" do
|
|
84
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
85
|
+
expect(photo.media_uri).to be_a URI
|
|
86
|
+
expect(photo.media_uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
87
|
+
end
|
|
88
|
+
it "returns nil when the media_url is not set" do
|
|
89
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
90
|
+
expect(photo.media_uri).to be_nil
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe "#media_uri?" do
|
|
95
|
+
it "returns true when the media_url is set" do
|
|
96
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
97
|
+
expect(photo.media_uri?).to be true
|
|
98
|
+
end
|
|
99
|
+
it "returns false when the media_url is not set" do
|
|
100
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
101
|
+
expect(photo.media_uri?).to be false
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
describe "#media_uri_https" do
|
|
106
|
+
it "returns a URI when the media_url_https is set" do
|
|
107
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url_https => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
108
|
+
expect(photo.media_uri_https).to be_a URI
|
|
109
|
+
expect(photo.media_uri_https.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
110
|
+
end
|
|
111
|
+
it "returns nil when the media_url_https is not set" do
|
|
112
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
113
|
+
expect(photo.media_uri_https).to be_nil
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
describe "#media_uri_https?" do
|
|
118
|
+
it "returns true when the media_url_https is set" do
|
|
119
|
+
photo = Twitter::Media::Photo.new(:id => 1, :media_url_https => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
120
|
+
expect(photo.media_uri_https?).to be true
|
|
121
|
+
end
|
|
122
|
+
it "returns false when the media_url_https is not set" do
|
|
123
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
124
|
+
expect(photo.media_uri_https?).to be false
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
describe "#uri" do
|
|
129
|
+
it "returns a URI when the url is set" do
|
|
130
|
+
photo = Twitter::Media::Photo.new(:id => 1, :url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
131
|
+
expect(photo.uri).to be_a URI
|
|
132
|
+
expect(photo.uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
133
|
+
end
|
|
134
|
+
it "returns nil when the url is not set" do
|
|
135
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
136
|
+
expect(photo.uri).to be_nil
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
describe "#uri?" do
|
|
141
|
+
it "returns true when the url is set" do
|
|
142
|
+
photo = Twitter::Media::Photo.new(:id => 1, :url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png")
|
|
143
|
+
expect(photo.uri?).to be true
|
|
144
|
+
end
|
|
145
|
+
it "returns false when the url is not set" do
|
|
146
|
+
photo = Twitter::Media::Photo.new(:id => 1)
|
|
147
|
+
expect(photo.uri?).to be false
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
35
151
|
end
|
|
@@ -4,11 +4,11 @@ describe Twitter::MediaFactory do
|
|
|
4
4
|
|
|
5
5
|
describe ".new" do
|
|
6
6
|
it "generates a Photo" do
|
|
7
|
-
media = Twitter::MediaFactory.
|
|
7
|
+
media = Twitter::MediaFactory.new(:id => 1, :type => "photo")
|
|
8
8
|
expect(media).to be_a Twitter::Media::Photo
|
|
9
9
|
end
|
|
10
|
-
it "raises an
|
|
11
|
-
expect{Twitter::MediaFactory.
|
|
10
|
+
it "raises an IndexError when type is not specified" do
|
|
11
|
+
expect{Twitter::MediaFactory.new}.to raise_error IndexError
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'helper'
|
|
2
|
+
|
|
3
|
+
describe Twitter::NullObject do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@null_object = Twitter::NullObject.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe "#nil?" do
|
|
10
|
+
it "returns true" do
|
|
11
|
+
expect(@null_object.nil?).to be true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "calling any method" do
|
|
16
|
+
it "returns self" do
|
|
17
|
+
expect(@null_object.any).to equal @null_object
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "#respond_to?" do
|
|
22
|
+
it "returns true" do
|
|
23
|
+
expect(@null_object.respond_to?(:any)).to be true
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
data/spec/twitter/oembed_spec.rb
CHANGED
|
@@ -2,24 +2,34 @@ require 'helper'
|
|
|
2
2
|
|
|
3
3
|
describe Twitter::OEmbed do
|
|
4
4
|
|
|
5
|
-
describe "#
|
|
6
|
-
it "returns the
|
|
7
|
-
oembed = Twitter::OEmbed.new(:author_url =>
|
|
8
|
-
expect(oembed.
|
|
5
|
+
describe "#author_uri" do
|
|
6
|
+
it "returns a URI when the author_url is set" do
|
|
7
|
+
oembed = Twitter::OEmbed.new(:author_url => "https://twitter.com/sferik")
|
|
8
|
+
expect(oembed.author_uri).to be_a URI
|
|
9
|
+
expect(oembed.author_uri.to_s).to eq("https://twitter.com/sferik")
|
|
9
10
|
end
|
|
11
|
+
it "returns nil when the author_uri is not set" do
|
|
12
|
+
oembed = Twitter::OEmbed.new
|
|
13
|
+
expect(oembed.author_uri).to be_nil
|
|
14
|
+
end
|
|
15
|
+
end
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
describe "#author_uri?" do
|
|
18
|
+
it "returns true when the author_url is set" do
|
|
19
|
+
oembed = Twitter::OEmbed.new(:author_url => "https://twitter.com/sferik")
|
|
20
|
+
expect(oembed.author_uri?).to be true
|
|
21
|
+
end
|
|
22
|
+
it "returns false when the author_uri is not set" do
|
|
23
|
+
oembed = Twitter::OEmbed.new
|
|
24
|
+
expect(oembed.author_uri?).to be false
|
|
14
25
|
end
|
|
15
26
|
end
|
|
16
27
|
|
|
17
28
|
describe "#author_name" do
|
|
18
29
|
it "returns the author's name" do
|
|
19
|
-
oembed = Twitter::OEmbed.new(:author_name =>
|
|
20
|
-
expect(oembed.author_name).to eq
|
|
30
|
+
oembed = Twitter::OEmbed.new(:author_name => "Erik Michaels-Ober")
|
|
31
|
+
expect(oembed.author_name).to eq("Erik Michaels-Ober")
|
|
21
32
|
end
|
|
22
|
-
|
|
23
33
|
it "returns nil when not set" do
|
|
24
34
|
author_name = Twitter::OEmbed.new.author_name
|
|
25
35
|
expect(author_name).to be_nil
|
|
@@ -28,10 +38,9 @@ describe Twitter::OEmbed do
|
|
|
28
38
|
|
|
29
39
|
describe "#cache_age" do
|
|
30
40
|
it "returns the cache_age" do
|
|
31
|
-
oembed = Twitter::OEmbed.new(:cache_age =>
|
|
32
|
-
expect(oembed.cache_age).to eq
|
|
41
|
+
oembed = Twitter::OEmbed.new(:cache_age => "31536000000")
|
|
42
|
+
expect(oembed.cache_age).to eq("31536000000")
|
|
33
43
|
end
|
|
34
|
-
|
|
35
44
|
it "returns nil when not set" do
|
|
36
45
|
cache_age = Twitter::OEmbed.new.cache_age
|
|
37
46
|
expect(cache_age).to be_nil
|
|
@@ -41,14 +50,12 @@ describe Twitter::OEmbed do
|
|
|
41
50
|
describe "#height" do
|
|
42
51
|
it "returns the height" do
|
|
43
52
|
oembed = Twitter::OEmbed.new(:height => 200)
|
|
44
|
-
expect(oembed.height).to eq
|
|
53
|
+
expect(oembed.height).to eq(200)
|
|
45
54
|
end
|
|
46
|
-
|
|
47
55
|
it "returns it as an Integer" do
|
|
48
56
|
oembed = Twitter::OEmbed.new(:height => 200)
|
|
49
57
|
expect(oembed.height).to be_an Integer
|
|
50
58
|
end
|
|
51
|
-
|
|
52
59
|
it "returns nil when not set" do
|
|
53
60
|
height = Twitter::OEmbed.new.height
|
|
54
61
|
expect(height).to be_nil
|
|
@@ -57,10 +64,9 @@ describe Twitter::OEmbed do
|
|
|
57
64
|
|
|
58
65
|
describe "#html" do
|
|
59
66
|
it "returns the html" do
|
|
60
|
-
oembed = Twitter::OEmbed.new(:html =>
|
|
61
|
-
expect(oembed.html).to eq
|
|
67
|
+
oembed = Twitter::OEmbed.new(:html => "<blockquote>all my <b>witty tweet</b> stuff here</blockquote>")
|
|
68
|
+
expect(oembed.html).to eq("<blockquote>all my <b>witty tweet</b> stuff here</blockquote>")
|
|
62
69
|
end
|
|
63
|
-
|
|
64
70
|
it "returns nil when not set" do
|
|
65
71
|
html = Twitter::OEmbed.new.html
|
|
66
72
|
expect(html).to be_nil
|
|
@@ -69,34 +75,43 @@ describe Twitter::OEmbed do
|
|
|
69
75
|
|
|
70
76
|
describe "#provider_name" do
|
|
71
77
|
it "returns the provider_name" do
|
|
72
|
-
oembed = Twitter::OEmbed.new(:provider_name =>
|
|
73
|
-
expect(oembed.provider_name).to eq
|
|
78
|
+
oembed = Twitter::OEmbed.new(:provider_name => "Twitter")
|
|
79
|
+
expect(oembed.provider_name).to eq("Twitter")
|
|
74
80
|
end
|
|
75
|
-
|
|
76
81
|
it "returns nil when not set" do
|
|
77
82
|
provider_name = Twitter::OEmbed.new.provider_name
|
|
78
83
|
expect(provider_name).to be_nil
|
|
79
84
|
end
|
|
80
85
|
end
|
|
81
86
|
|
|
82
|
-
describe "#
|
|
83
|
-
it "returns the provider_url" do
|
|
84
|
-
oembed = Twitter::OEmbed.new(:provider_url =>
|
|
85
|
-
expect(oembed.
|
|
87
|
+
describe "#provider_uri" do
|
|
88
|
+
it "returns a URI when the provider_url is set" do
|
|
89
|
+
oembed = Twitter::OEmbed.new(:provider_url => "http://twitter.com")
|
|
90
|
+
expect(oembed.provider_uri).to be_a URI
|
|
91
|
+
expect(oembed.provider_uri.to_s).to eq("http://twitter.com")
|
|
92
|
+
end
|
|
93
|
+
it "returns nil when the provider_uri is not set" do
|
|
94
|
+
oembed = Twitter::OEmbed.new
|
|
95
|
+
expect(oembed.provider_uri).to be_nil
|
|
86
96
|
end
|
|
97
|
+
end
|
|
87
98
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
describe "#provider_uri?" do
|
|
100
|
+
it "returns true when the provider_url is set" do
|
|
101
|
+
oembed = Twitter::OEmbed.new(:provider_url => "https://twitter.com/sferik")
|
|
102
|
+
expect(oembed.provider_uri?).to be true
|
|
103
|
+
end
|
|
104
|
+
it "returns false when the provider_uri is not set" do
|
|
105
|
+
oembed = Twitter::OEmbed.new
|
|
106
|
+
expect(oembed.provider_uri?).to be false
|
|
91
107
|
end
|
|
92
108
|
end
|
|
93
109
|
|
|
94
110
|
describe "#type" do
|
|
95
111
|
it "returns the type" do
|
|
96
|
-
oembed = Twitter::OEmbed.new(:type =>
|
|
97
|
-
expect(oembed.type).to eq
|
|
112
|
+
oembed = Twitter::OEmbed.new(:type => "rich")
|
|
113
|
+
expect(oembed.type).to eq("rich")
|
|
98
114
|
end
|
|
99
|
-
|
|
100
115
|
it "returns nil when not set" do
|
|
101
116
|
type = Twitter::OEmbed.new.type
|
|
102
117
|
expect(type).to be_nil
|
|
@@ -106,41 +121,50 @@ describe Twitter::OEmbed do
|
|
|
106
121
|
describe "#width" do
|
|
107
122
|
it "returns the width" do
|
|
108
123
|
oembed = Twitter::OEmbed.new(:width => 550)
|
|
109
|
-
expect(oembed.width).to eq
|
|
124
|
+
expect(oembed.width).to eq(550)
|
|
110
125
|
end
|
|
111
|
-
|
|
112
126
|
it "returns it as an Integer" do
|
|
113
127
|
oembed = Twitter::OEmbed.new(:width => 550)
|
|
114
128
|
expect(oembed.width).to be_an Integer
|
|
115
129
|
end
|
|
116
|
-
|
|
117
130
|
it "returns nil when not set" do
|
|
118
131
|
width = Twitter::OEmbed.new.width
|
|
119
132
|
expect(width).to be_nil
|
|
120
133
|
end
|
|
121
134
|
end
|
|
122
135
|
|
|
123
|
-
describe "#
|
|
124
|
-
it "returns the url" do
|
|
125
|
-
oembed = Twitter::OEmbed.new(:url =>
|
|
126
|
-
expect(oembed.
|
|
136
|
+
describe "#uri" do
|
|
137
|
+
it "returns a URI when the url is set" do
|
|
138
|
+
oembed = Twitter::OEmbed.new(:url => "https://twitter.com/twitterapi/status/133640144317198338")
|
|
139
|
+
expect(oembed.uri).to be_a URI
|
|
140
|
+
expect(oembed.uri.to_s).to eq("https://twitter.com/twitterapi/status/133640144317198338")
|
|
141
|
+
end
|
|
142
|
+
it "returns nil when the url is not set" do
|
|
143
|
+
oembed = Twitter::OEmbed.new
|
|
144
|
+
expect(oembed.uri).to be_nil
|
|
127
145
|
end
|
|
146
|
+
end
|
|
128
147
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
148
|
+
describe "#uri?" do
|
|
149
|
+
it "returns true when the url is set" do
|
|
150
|
+
oembed = Twitter::OEmbed.new(:url => "https://twitter.com/twitterapi/status/133640144317198338")
|
|
151
|
+
expect(oembed.uri?).to be true
|
|
152
|
+
end
|
|
153
|
+
it "returns false when the url is not set" do
|
|
154
|
+
oembed = Twitter::OEmbed.new
|
|
155
|
+
expect(oembed.uri?).to be false
|
|
132
156
|
end
|
|
133
157
|
end
|
|
134
158
|
|
|
135
159
|
describe "#version" do
|
|
136
160
|
it "returns the version" do
|
|
137
|
-
oembed = Twitter::OEmbed.new(:version =>
|
|
138
|
-
expect(oembed.version).to eq
|
|
161
|
+
oembed = Twitter::OEmbed.new(:version => "1.0")
|
|
162
|
+
expect(oembed.version).to eq("1.0")
|
|
139
163
|
end
|
|
140
|
-
|
|
141
164
|
it "returns nil when not set" do
|
|
142
165
|
version = Twitter::OEmbed.new.version
|
|
143
166
|
expect(version).to be_nil
|
|
144
167
|
end
|
|
145
168
|
end
|
|
169
|
+
|
|
146
170
|
end
|