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
@@ -11,14 +11,10 @@ describe Twitter::Error::ClientError do
|
|
11
11
|
context "when HTTP status is #{status} and body is #{body.inspect}" do
|
12
12
|
before do
|
13
13
|
body_message = '{"' + body + '":"Client Error"}' unless body.nil?
|
14
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
15
|
-
with(:query => {:screen_name => 'sferik'}).
|
16
|
-
to_return(:status => status, :body => body_message)
|
14
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => body_message)
|
17
15
|
end
|
18
16
|
it "raises #{exception.name}" do
|
19
|
-
|
20
|
-
@client.user_timeline('sferik')
|
21
|
-
end.should raise_error(exception)
|
17
|
+
expect{@client.user_timeline('sferik')}.to raise_error(exception)
|
22
18
|
end
|
23
19
|
end
|
24
20
|
end
|
@@ -26,14 +22,10 @@ describe Twitter::Error::ClientError do
|
|
26
22
|
|
27
23
|
context "when response status is 404 from lookup" do
|
28
24
|
before do
|
29
|
-
stub_post("/1.1/users/lookup.json").
|
30
|
-
with(:body => {:screen_name => "not_on_twitter"}).
|
31
|
-
to_return(:status => 404, :body => fixture('no_user_matches.json'))
|
25
|
+
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "not_on_twitter"}).to_return(:status => 404, :body => fixture('no_user_matches.json'))
|
32
26
|
end
|
33
27
|
it "raises Twitter::Error::NotFound" do
|
34
|
-
|
35
|
-
@client.users('not_on_twitter')
|
36
|
-
end.should raise_error(Twitter::Error::NotFound)
|
28
|
+
expect{@client.users('not_on_twitter')}.to raise_error(Twitter::Error::NotFound)
|
37
29
|
end
|
38
30
|
end
|
39
31
|
|
@@ -9,14 +9,10 @@ describe Twitter::Error::ServerError do
|
|
9
9
|
Twitter::Error::ServerError.errors.each do |status, exception|
|
10
10
|
context "when HTTP status is #{status}" do
|
11
11
|
before do
|
12
|
-
stub_get("/1.1/statuses/user_timeline.json").
|
13
|
-
with(:query => {:screen_name => 'sferik'}).
|
14
|
-
to_return(:status => status)
|
12
|
+
stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => 'sferik'}).to_return(:status => status)
|
15
13
|
end
|
16
14
|
it "raises #{exception.name}" do
|
17
|
-
|
18
|
-
@client.user_timeline('sferik')
|
19
|
-
end.should raise_error(exception)
|
15
|
+
expect{@client.user_timeline('sferik')}.to raise_error(exception)
|
20
16
|
end
|
21
17
|
end
|
22
18
|
end
|
data/spec/twitter/error_spec.rb
CHANGED
@@ -10,8 +10,8 @@ describe Twitter::Error do
|
|
10
10
|
begin
|
11
11
|
raise Twitter::Error
|
12
12
|
rescue Twitter::Error => error
|
13
|
-
error.message.
|
14
|
-
error.wrapped_exception.class.
|
13
|
+
expect(error.message).to eq "Oups"
|
14
|
+
expect(error.wrapped_exception.class).to eq Faraday::Error::ClientError
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -10,31 +10,31 @@ describe Twitter::Geo::Point do
|
|
10
10
|
it "returns false for empty objects" do
|
11
11
|
point = Twitter::Geo::Point.new
|
12
12
|
other = Twitter::Geo::Point.new
|
13
|
-
(point == other).
|
13
|
+
expect(point == other).to be_false
|
14
14
|
end
|
15
15
|
it "returns true when objects coordinates are the same" do
|
16
16
|
other = Twitter::Geo::Point.new(:coordinates => [-122.399983, 37.788299])
|
17
|
-
(@point == other).
|
17
|
+
expect(@point == other).to be_true
|
18
18
|
end
|
19
19
|
it "returns false when objects coordinates are different" do
|
20
20
|
other = Twitter::Geo::Point.new(:coordinates => [37.788299, -122.399983])
|
21
|
-
(@point == other).
|
21
|
+
expect(@point == 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.399983, 37.788299])
|
25
|
-
(@point == other).
|
25
|
+
expect(@point == other).to be_false
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#latitude" do
|
30
30
|
it "returns the latitude" do
|
31
|
-
@point.latitude.
|
31
|
+
expect(@point.latitude).to eq -122.399983
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "#longitude" do
|
36
36
|
it "returns the longitude" do
|
37
|
-
@point.longitude.
|
37
|
+
expect(@point.longitude).to eq 37.788299
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -10,19 +10,19 @@ describe Twitter::Geo::Polygon do
|
|
10
10
|
it "returns false for empty objects" do
|
11
11
|
polygon = Twitter::Geo::Polygon.new
|
12
12
|
other = Twitter::Geo::Polygon.new
|
13
|
-
(polygon == other).
|
13
|
+
expect(polygon == other).to be_false
|
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
|
-
(@polygon == other).
|
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
|
-
(@polygon == other).
|
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
|
-
(@polygon == other).
|
25
|
+
expect(@polygon == other).to be_false
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -5,16 +5,14 @@ describe Twitter::GeoFactory do
|
|
5
5
|
describe ".new" do
|
6
6
|
it "generates a Point" do
|
7
7
|
geo = Twitter::GeoFactory.fetch_or_new(:type => 'Point')
|
8
|
-
geo.
|
8
|
+
expect(geo).to be_a Twitter::Geo::Point
|
9
9
|
end
|
10
10
|
it "generates a Polygon" do
|
11
11
|
geo = Twitter::GeoFactory.fetch_or_new(:type => 'Polygon')
|
12
|
-
geo.
|
12
|
+
expect(geo).to be_a Twitter::Geo::Polygon
|
13
13
|
end
|
14
14
|
it "raises an ArgumentError when type is not specified" do
|
15
|
-
|
16
|
-
Twitter::GeoFactory.fetch_or_new
|
17
|
-
end.should raise_error(ArgumentError, "argument must have :type key")
|
15
|
+
expect{Twitter::GeoFactory.fetch_or_new}.to raise_error(ArgumentError, "argument must have :type key")
|
18
16
|
end
|
19
17
|
end
|
20
18
|
|
data/spec/twitter/geo_spec.rb
CHANGED
@@ -10,19 +10,19 @@ describe Twitter::Geo do
|
|
10
10
|
it "returns false for empty objects" do
|
11
11
|
geo = Twitter::Geo.new
|
12
12
|
other = Twitter::Geo.new
|
13
|
-
(geo == other).
|
13
|
+
expect(geo == other).to be_false
|
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
|
-
(@geo == other).
|
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
|
-
(@geo == other).
|
21
|
+
expect(@geo == other).to be_false
|
22
22
|
end
|
23
23
|
it "returns false 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
|
-
(@geo == other).
|
25
|
+
expect(@geo == other).to be_false
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -4,13 +4,11 @@ describe Twitter::Identity do
|
|
4
4
|
|
5
5
|
describe "#initialize" do
|
6
6
|
it "raises an ArgumentError when type is not specified" do
|
7
|
-
|
8
|
-
Twitter::Identity.new
|
9
|
-
end.should raise_error(ArgumentError, "argument must have an :id key")
|
7
|
+
expect{Twitter::Identity.new}.to raise_error(ArgumentError, "argument must have an :id key")
|
10
8
|
end
|
11
9
|
end
|
12
10
|
|
13
|
-
context
|
11
|
+
context "identity map enabled" do
|
14
12
|
before do
|
15
13
|
Twitter.identity_map = Twitter::IdentityMap
|
16
14
|
end
|
@@ -19,16 +17,14 @@ describe Twitter::Identity do
|
|
19
17
|
Twitter.identity_map = false
|
20
18
|
end
|
21
19
|
|
22
|
-
describe
|
23
|
-
it
|
20
|
+
describe ".fetch" do
|
21
|
+
it "returns existing objects" do
|
24
22
|
Twitter::Identity.store(Twitter::Identity.new(:id => 1))
|
25
|
-
Twitter::Identity.fetch(:id => 1).
|
23
|
+
expect(Twitter::Identity.fetch(:id => 1)).to be
|
26
24
|
end
|
27
25
|
|
28
26
|
it "raises an error on objects that don't exist" do
|
29
|
-
|
30
|
-
Twitter::Identity.fetch(:id => 6)
|
31
|
-
}.should raise_error(Twitter::Error::IdentityMapKeyError)
|
27
|
+
expect{Twitter::Identity.fetch(:id => 6)}.to raise_error(Twitter::Error::IdentityMapKeyError)
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
@@ -37,17 +33,17 @@ describe Twitter::Identity do
|
|
37
33
|
it "returns true when objects IDs are the same" do
|
38
34
|
one = Twitter::Identity.new(:id => 1, :screen_name => "sferik")
|
39
35
|
two = Twitter::Identity.new(:id => 1, :screen_name => "garybernhardt")
|
40
|
-
(one == two).
|
36
|
+
expect(one == two).to be_true
|
41
37
|
end
|
42
38
|
it "returns false when objects IDs are different" do
|
43
39
|
one = Twitter::Identity.new(:id => 1)
|
44
40
|
two = Twitter::Identity.new(:id => 2)
|
45
|
-
(one == two).
|
41
|
+
expect(one == two).to be_false
|
46
42
|
end
|
47
43
|
it "returns false when classes are different" do
|
48
44
|
one = Twitter::Identity.new(:id => 1)
|
49
45
|
two = Twitter::Base.new(:id => 1)
|
50
|
-
(one == two).
|
46
|
+
expect(one == two).to be_false
|
51
47
|
end
|
52
48
|
end
|
53
49
|
|
data/spec/twitter/list_spec.rb
CHANGED
@@ -6,39 +6,39 @@ 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
|
-
(list == other).
|
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
|
-
(list == other).
|
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
|
-
(list == other).
|
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
25
|
user = Twitter::List.new(:id => 8863586, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
|
26
|
-
user.created_at.
|
26
|
+
expect(user.created_at).to be_a Time
|
27
27
|
end
|
28
28
|
it "returns nil when created_at is not set" do
|
29
29
|
user = Twitter::List.new(:id => 8863586)
|
30
|
-
user.created_at.
|
30
|
+
expect(user.created_at).to be_nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "#user" do
|
35
35
|
it "returns a User when user is set" do
|
36
36
|
user = Twitter::List.new(:id => 8863586, :user => {:id => 7505382}).user
|
37
|
-
user.
|
37
|
+
expect(user).to be_a Twitter::User
|
38
38
|
end
|
39
39
|
it "returns nil when status is not set" do
|
40
40
|
user = Twitter::List.new(:id => 8863586).user
|
41
|
-
user.
|
41
|
+
expect(user).to be_nil
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -6,29 +6,29 @@ describe Twitter::Media::Photo do
|
|
6
6
|
it "returns true when objects IDs are the same" do
|
7
7
|
photo = Twitter::Media::Photo.new(:id => 1, :url => "foo")
|
8
8
|
other = Twitter::Media::Photo.new(:id => 1, :url => "bar")
|
9
|
-
(photo == other).
|
9
|
+
expect(photo == other).to be_true
|
10
10
|
end
|
11
11
|
it "returns false when objects IDs are different" do
|
12
12
|
photo = Twitter::Media::Photo.new(:id => 1)
|
13
13
|
other = Twitter::Media::Photo.new(:id => 2)
|
14
|
-
(photo == other).
|
14
|
+
expect(photo == other).to be_false
|
15
15
|
end
|
16
16
|
it "returns false when classes are different" do
|
17
17
|
photo = Twitter::Media::Photo.new(:id => 1)
|
18
18
|
other = Twitter::Identity.new(:id => 1)
|
19
|
-
(photo == other).
|
19
|
+
expect(photo == other).to be_false
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "#sizes" do
|
24
24
|
it "returns a hash of Sizes when sizes is set" do
|
25
25
|
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
|
-
sizes.
|
27
|
-
sizes[:small].
|
26
|
+
expect(sizes).to be_a Hash
|
27
|
+
expect(sizes[:small]).to be_a Twitter::Size
|
28
28
|
end
|
29
29
|
it "is empty when sizes is not set" do
|
30
30
|
sizes = Twitter::Media::Photo.new(:id => 110102452988157952).sizes
|
31
|
-
sizes.
|
31
|
+
expect(sizes).to be_empty
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -5,12 +5,10 @@ describe Twitter::MediaFactory do
|
|
5
5
|
describe ".new" do
|
6
6
|
it "generates a Photo" do
|
7
7
|
media = Twitter::MediaFactory.fetch_or_new(:id => 1, :type => 'photo')
|
8
|
-
media.
|
8
|
+
expect(media).to be_a Twitter::Media::Photo
|
9
9
|
end
|
10
10
|
it "raises an ArgumentError when type is not specified" do
|
11
|
-
|
12
|
-
Twitter::MediaFactory.fetch_or_new
|
13
|
-
end.should raise_error(ArgumentError, "argument must have :type key")
|
11
|
+
expect{Twitter::MediaFactory.fetch_or_new}.to raise_error(ArgumentError, "argument must have :type key")
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
data/spec/twitter/oembed_spec.rb
CHANGED
@@ -5,142 +5,142 @@ describe Twitter::OEmbed do
|
|
5
5
|
describe "#author_url" do
|
6
6
|
it "returns the author's url" do
|
7
7
|
oembed = Twitter::OEmbed.new(:author_url => 'https://twitter.com/sferik')
|
8
|
-
oembed.author_url.
|
8
|
+
expect(oembed.author_url).to eq "https://twitter.com/sferik"
|
9
9
|
end
|
10
10
|
|
11
11
|
it "returns nil when not set" do
|
12
12
|
author_url = Twitter::OEmbed.new.author_url
|
13
|
-
author_url.
|
13
|
+
expect(author_url).to be_nil
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#author_name" do
|
18
18
|
it "returns the author's name" do
|
19
19
|
oembed = Twitter::OEmbed.new(:author_name => 'Erik Michaels-Ober')
|
20
|
-
oembed.author_name.
|
20
|
+
expect(oembed.author_name).to eq "Erik Michaels-Ober"
|
21
21
|
end
|
22
22
|
|
23
23
|
it "returns nil when not set" do
|
24
24
|
author_name = Twitter::OEmbed.new.author_name
|
25
|
-
author_name.
|
25
|
+
expect(author_name).to be_nil
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#cache_age" do
|
30
30
|
it "returns the cache_age" do
|
31
31
|
oembed = Twitter::OEmbed.new(:cache_age => '31536000000')
|
32
|
-
oembed.cache_age.
|
32
|
+
expect(oembed.cache_age).to eq "31536000000"
|
33
33
|
end
|
34
34
|
|
35
35
|
it "returns nil when not set" do
|
36
36
|
cache_age = Twitter::OEmbed.new.cache_age
|
37
|
-
cache_age.
|
37
|
+
expect(cache_age).to be_nil
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "#height" do
|
42
42
|
it "returns the height" do
|
43
43
|
oembed = Twitter::OEmbed.new(:height => 200)
|
44
|
-
oembed.height.
|
44
|
+
expect(oembed.height).to eq 200
|
45
45
|
end
|
46
46
|
|
47
47
|
it "returns it as an Integer" do
|
48
48
|
oembed = Twitter::OEmbed.new(:height => 200)
|
49
|
-
oembed.height.
|
49
|
+
expect(oembed.height).to be_an Integer
|
50
50
|
end
|
51
51
|
|
52
52
|
it "returns nil when not set" do
|
53
53
|
height = Twitter::OEmbed.new.height
|
54
|
-
height.
|
54
|
+
expect(height).to be_nil
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "#html" do
|
59
59
|
it "returns the html" do
|
60
60
|
oembed = Twitter::OEmbed.new(:html => '<blockquote>all my <b>witty tweet</b> stuff here</blockquote>')
|
61
|
-
oembed.html.
|
61
|
+
expect(oembed.html).to eq "<blockquote>all my <b>witty tweet</b> stuff here</blockquote>"
|
62
62
|
end
|
63
63
|
|
64
64
|
it "returns nil when not set" do
|
65
65
|
html = Twitter::OEmbed.new.html
|
66
|
-
html.
|
66
|
+
expect(html).to be_nil
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "#provider_name" do
|
71
71
|
it "returns the provider_name" do
|
72
72
|
oembed = Twitter::OEmbed.new(:provider_name => 'Twitter')
|
73
|
-
oembed.provider_name.
|
73
|
+
expect(oembed.provider_name).to eq "Twitter"
|
74
74
|
end
|
75
75
|
|
76
76
|
it "returns nil when not set" do
|
77
77
|
provider_name = Twitter::OEmbed.new.provider_name
|
78
|
-
provider_name.
|
78
|
+
expect(provider_name).to be_nil
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
describe "#provider_url" do
|
83
83
|
it "returns the provider_url" do
|
84
84
|
oembed = Twitter::OEmbed.new(:provider_url => 'http://twitter.com')
|
85
|
-
oembed.provider_url.
|
85
|
+
expect(oembed.provider_url).to eq "http://twitter.com"
|
86
86
|
end
|
87
87
|
|
88
88
|
it "returns nil when not set" do
|
89
89
|
provider_url = Twitter::OEmbed.new.provider_url
|
90
|
-
provider_url.
|
90
|
+
expect(provider_url).to be_nil
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
describe "#type" do
|
95
95
|
it "returns the type" do
|
96
96
|
oembed = Twitter::OEmbed.new(:type => 'rich')
|
97
|
-
oembed.type.
|
97
|
+
expect(oembed.type).to eq "rich"
|
98
98
|
end
|
99
99
|
|
100
100
|
it "returns nil when not set" do
|
101
101
|
type = Twitter::OEmbed.new.type
|
102
|
-
type.
|
102
|
+
expect(type).to be_nil
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
106
|
describe "#width" do
|
107
107
|
it "returns the width" do
|
108
108
|
oembed = Twitter::OEmbed.new(:width => 550)
|
109
|
-
oembed.width.
|
109
|
+
expect(oembed.width).to eq 550
|
110
110
|
end
|
111
111
|
|
112
112
|
it "returns it as an Integer" do
|
113
113
|
oembed = Twitter::OEmbed.new(:width => 550)
|
114
|
-
oembed.width.
|
114
|
+
expect(oembed.width).to be_an Integer
|
115
115
|
end
|
116
116
|
|
117
117
|
it "returns nil when not set" do
|
118
118
|
width = Twitter::OEmbed.new.width
|
119
|
-
width.
|
119
|
+
expect(width).to be_nil
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
123
|
describe "#url" do
|
124
124
|
it "returns the url" do
|
125
125
|
oembed = Twitter::OEmbed.new(:url => 'https://twitter.com/twitterapi/status/133640144317198338')
|
126
|
-
oembed.url.
|
126
|
+
expect(oembed.url).to eq "https://twitter.com/twitterapi/status/133640144317198338"
|
127
127
|
end
|
128
128
|
|
129
129
|
it "returns nil when not set" do
|
130
130
|
url = Twitter::OEmbed.new.url
|
131
|
-
url.
|
131
|
+
expect(url).to be_nil
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
describe "#version" do
|
136
136
|
it "returns the version" do
|
137
137
|
oembed = Twitter::OEmbed.new(:version => '1.0')
|
138
|
-
oembed.version.
|
138
|
+
expect(oembed.version).to eq "1.0"
|
139
139
|
end
|
140
140
|
|
141
141
|
it "returns nil when not set" do
|
142
142
|
version = Twitter::OEmbed.new.version
|
143
|
-
version.
|
143
|
+
expect(version).to be_nil
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|