twitter 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/spec/twitter/place_spec.rb
CHANGED
@@ -6,69 +6,69 @@ describe Twitter::Place do
|
|
6
6
|
it "returns true when objects IDs are the same" do
|
7
7
|
place = Twitter::Place.new(:id => 1, :name => "foo")
|
8
8
|
other = Twitter::Place.new(:id => 1, :name => "bar")
|
9
|
-
(place == other).
|
9
|
+
expect(place == other).to be_true
|
10
10
|
end
|
11
11
|
it "returns false when objects IDs are different" do
|
12
12
|
place = Twitter::Place.new(:id => 1)
|
13
13
|
other = Twitter::Place.new(:id => 2)
|
14
|
-
(place == other).
|
14
|
+
expect(place == other).to be_false
|
15
15
|
end
|
16
16
|
it "returns false when classes are different" do
|
17
17
|
place = Twitter::Place.new(:id => 1)
|
18
18
|
other = Twitter::Identity.new(:id => 1)
|
19
|
-
(place == other).
|
19
|
+
expect(place == other).to be_false
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "#bounding_box" do
|
24
24
|
it "returns a Twitter::Place when set" do
|
25
25
|
place = Twitter::Place.new(:id => "247f43d441defc03", :bounding_box => {:type => 'Polygon', :coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]]})
|
26
|
-
place.bounding_box.
|
26
|
+
expect(place.bounding_box).to be_a Twitter::Geo::Polygon
|
27
27
|
end
|
28
28
|
it "returns nil when not set" do
|
29
29
|
place = Twitter::Place.new(:id => "247f43d441defc03")
|
30
|
-
place.bounding_box.
|
30
|
+
expect(place.bounding_box).to be_nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "#country_code" do
|
35
35
|
it "returns a country code when set with country_code" do
|
36
36
|
place = Twitter::Place.new(:id => "247f43d441defc03", :country_code => 'US')
|
37
|
-
place.country_code.
|
37
|
+
expect(place.country_code).to eq 'US'
|
38
38
|
end
|
39
39
|
it "returns a country code when set with countryCode" do
|
40
40
|
place = Twitter::Place.new(:id => "247f43d441defc03", :countryCode => 'US')
|
41
|
-
place.country_code.
|
41
|
+
expect(place.country_code).to eq 'US'
|
42
42
|
end
|
43
43
|
it "returns nil when not set" do
|
44
44
|
place = Twitter::Place.new(:id => "247f43d441defc03")
|
45
|
-
place.country_code.
|
45
|
+
expect(place.country_code).to be_nil
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "#parent_id" do
|
50
50
|
it "returns a parent ID when set with parentid" do
|
51
51
|
place = Twitter::Place.new(:id => "247f43d441defc03", :parentid => 1)
|
52
|
-
place.parent_id.
|
52
|
+
expect(place.parent_id).to eq 1
|
53
53
|
end
|
54
54
|
it "returns nil when not set" do
|
55
55
|
place = Twitter::Place.new(:id => "247f43d441defc03")
|
56
|
-
place.parent_id.
|
56
|
+
expect(place.parent_id).to be_nil
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
describe "#place_type" do
|
61
61
|
it "returns a place type when set with place_type" do
|
62
62
|
place = Twitter::Place.new(:id => "247f43d441defc03", :place_type => 'city')
|
63
|
-
place.place_type.
|
63
|
+
expect(place.place_type).to eq 'city'
|
64
64
|
end
|
65
65
|
it "returns a place type when set with placeType[name]" do
|
66
66
|
place = Twitter::Place.new(:id => "247f43d441defc03", :placeType => {:name => 'Town'})
|
67
|
-
place.place_type.
|
67
|
+
expect(place.place_type).to eq 'Town'
|
68
68
|
end
|
69
69
|
it "returns nil when not set" do
|
70
70
|
place = Twitter::Place.new(:id => "247f43d441defc03")
|
71
|
-
place.place_type.
|
71
|
+
expect(place.place_type).to be_nil
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -5,36 +5,36 @@ describe Twitter::RateLimit do
|
|
5
5
|
describe "#limit" do
|
6
6
|
it "returns an Integer when x-rate-limit-limit header is set" do
|
7
7
|
rate_limit = Twitter::RateLimit.new('x-rate-limit-limit' => "150")
|
8
|
-
rate_limit.limit.
|
9
|
-
rate_limit.limit.
|
8
|
+
expect(rate_limit.limit).to be_an Integer
|
9
|
+
expect(rate_limit.limit).to eq 150
|
10
10
|
end
|
11
11
|
it "returns nil when x-rate-limit-limit header is not set" do
|
12
12
|
rate_limit = Twitter::RateLimit.new
|
13
|
-
rate_limit.limit.
|
13
|
+
expect(rate_limit.limit).to be_nil
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#remaining" do
|
18
18
|
it "returns an Integer when x-rate-limit-remaining header is set" do
|
19
19
|
rate_limit = Twitter::RateLimit.new('x-rate-limit-remaining' => "149")
|
20
|
-
rate_limit.remaining.
|
21
|
-
rate_limit.remaining.
|
20
|
+
expect(rate_limit.remaining).to be_an Integer
|
21
|
+
expect(rate_limit.remaining).to eq 149
|
22
22
|
end
|
23
23
|
it "returns nil when x-rate-limit-remaining header is not set" do
|
24
24
|
rate_limit = Twitter::RateLimit.new
|
25
|
-
rate_limit.remaining.
|
25
|
+
expect(rate_limit.remaining).to be_nil
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#reset_at" do
|
30
30
|
it "returns a Time when x-rate-limit-reset header is set" do
|
31
31
|
rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => "1339019097")
|
32
|
-
rate_limit.reset_at.
|
33
|
-
rate_limit.reset_at.
|
32
|
+
expect(rate_limit.reset_at).to be_a Time
|
33
|
+
expect(rate_limit.reset_at).to eq Time.at(1339019097)
|
34
34
|
end
|
35
35
|
it "returns nil when x-rate-limit-reset header is not set" do
|
36
36
|
rate_limit = Twitter::RateLimit.new
|
37
|
-
rate_limit.reset_at.
|
37
|
+
expect(rate_limit.reset_at).to be_nil
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -47,12 +47,12 @@ describe Twitter::RateLimit do
|
|
47
47
|
end
|
48
48
|
it "returns an Integer when x-rate-limit-reset header is set" do
|
49
49
|
rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => "1339019097")
|
50
|
-
rate_limit.reset_in.
|
51
|
-
rate_limit.reset_in.
|
50
|
+
expect(rate_limit.reset_in).to be_an Integer
|
51
|
+
expect(rate_limit.reset_in).to eq 15777
|
52
52
|
end
|
53
53
|
it "returns nil when x-rate-limit-reset header is not set" do
|
54
54
|
rate_limit = Twitter::RateLimit.new
|
55
|
-
rate_limit.reset_in.
|
55
|
+
expect(rate_limit.reset_in).to be_nil
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -65,11 +65,11 @@ describe Twitter::RateLimit do
|
|
65
65
|
end
|
66
66
|
it "updates a rate limit" do
|
67
67
|
rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => "1339019097")
|
68
|
-
rate_limit.reset_in.
|
69
|
-
rate_limit.reset_in.
|
68
|
+
expect(rate_limit.reset_in).to be_an Integer
|
69
|
+
expect(rate_limit.reset_in).to eq 15777
|
70
70
|
rate_limit.update({'x-rate-limit-reset' => "1339019098"})
|
71
|
-
rate_limit.reset_in.
|
72
|
-
rate_limit.reset_in.
|
71
|
+
expect(rate_limit.reset_in).to be_an Integer
|
72
|
+
expect(rate_limit.reset_in).to eq 15778
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -5,22 +5,22 @@ describe Twitter::Relationship do
|
|
5
5
|
describe "#source" do
|
6
6
|
it "returns a User when source is set" do
|
7
7
|
source = Twitter::Relationship.new(:relationship => {:source => {:id => 7505382}}).source
|
8
|
-
source.
|
8
|
+
expect(source).to be_a Twitter::SourceUser
|
9
9
|
end
|
10
10
|
it "returns nil when source is not set" do
|
11
11
|
source = Twitter::Relationship.new(:relationship => {}).source
|
12
|
-
source.
|
12
|
+
expect(source).to be_nil
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#target" do
|
17
17
|
it "returns a User when target is set" do
|
18
18
|
target = Twitter::Relationship.new(:relationship => {:target => {:id => 7505382}}).target
|
19
|
-
target.
|
19
|
+
expect(target).to be_a Twitter::TargetUser
|
20
20
|
end
|
21
21
|
it "returns nil when target is not set" do
|
22
22
|
target = Twitter::Relationship.new(:relationship => {}).target
|
23
|
-
target.
|
23
|
+
expect(target).to be_nil
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -28,7 +28,7 @@ describe Twitter::Relationship do
|
|
28
28
|
it "updates a relationship" do
|
29
29
|
relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7505382}})
|
30
30
|
relationship.update(:relationship => {:target => {:id => 14100886}})
|
31
|
-
relationship.target.id.
|
31
|
+
expect(relationship.target.id).to eq 14100886
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -6,28 +6,28 @@ describe Twitter::SavedSearch do
|
|
6
6
|
it "returns true when objects IDs are the same" do
|
7
7
|
saved_search = Twitter::SavedSearch.new(:id => 1, :name => "foo")
|
8
8
|
other = Twitter::SavedSearch.new(:id => 1, :name => "bar")
|
9
|
-
(saved_search == other).
|
9
|
+
expect(saved_search == other).to be_true
|
10
10
|
end
|
11
11
|
it "returns false when objects IDs are different" do
|
12
12
|
saved_search = Twitter::SavedSearch.new(:id => 1)
|
13
13
|
other = Twitter::SavedSearch.new(:id => 2)
|
14
|
-
(saved_search == other).
|
14
|
+
expect(saved_search == other).to be_false
|
15
15
|
end
|
16
16
|
it "returns false when classes are different" do
|
17
17
|
saved_search = Twitter::SavedSearch.new(:id => 1)
|
18
18
|
other = Twitter::Identity.new(:id => 1)
|
19
|
-
(saved_search == other).
|
19
|
+
expect(saved_search == 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
|
saved_search = Twitter::SavedSearch.new(:id => 16129012, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
|
26
|
-
saved_search.created_at.
|
26
|
+
expect(saved_search.created_at).to be_a Time
|
27
27
|
end
|
28
28
|
it "returns nil when created_at is not set" do
|
29
29
|
saved_search = Twitter::SavedSearch.new(:id => 16129012)
|
30
|
-
saved_search.created_at.
|
30
|
+
expect(saved_search.created_at).to be_nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -5,84 +5,84 @@ describe Twitter::SearchResults do
|
|
5
5
|
describe "#statuses" do
|
6
6
|
it "returns an array of Tweets" do
|
7
7
|
statuses = Twitter::SearchResults.new(:statuses => [{:id => 25938088801, :text => 'tweet!'}]).statuses
|
8
|
-
statuses.
|
9
|
-
statuses.first.
|
8
|
+
expect(statuses).to be_an Array
|
9
|
+
expect(statuses.first).to be_a Twitter::Tweet
|
10
10
|
end
|
11
11
|
it "is empty when not set" do
|
12
12
|
statuses = Twitter::SearchResults.new.statuses
|
13
|
-
statuses.
|
13
|
+
expect(statuses).to be_empty
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#completed_in" do
|
18
18
|
it "returns a number of seconds" do
|
19
19
|
completed_in = Twitter::SearchResults.new(:search_metadata => {:completed_in => 0.029}).completed_in
|
20
|
-
completed_in.
|
21
|
-
completed_in.
|
20
|
+
expect(completed_in).to be_a Float
|
21
|
+
expect(completed_in).to eq 0.029
|
22
22
|
end
|
23
23
|
it "is nil when not set" do
|
24
24
|
completed_in = Twitter::SearchResults.new.completed_in
|
25
|
-
completed_in.
|
25
|
+
expect(completed_in).to be_nil
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#max_id" do
|
30
30
|
it "returns an ID" do
|
31
31
|
max_id = Twitter::SearchResults.new(:search_metadata => {:max_id => 250126199840518145}).max_id
|
32
|
-
max_id.
|
33
|
-
max_id.
|
32
|
+
expect(max_id).to be_an Integer
|
33
|
+
expect(max_id).to eq 250126199840518145
|
34
34
|
end
|
35
35
|
it "is nil when not set" do
|
36
36
|
max_id = Twitter::SearchResults.new.max_id
|
37
|
-
max_id.
|
37
|
+
expect(max_id).to be_nil
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "#page" do
|
42
42
|
it "returns page number" do
|
43
43
|
page = Twitter::SearchResults.new(:search_metadata => {:page => 1}).page
|
44
|
-
page.
|
45
|
-
page.
|
44
|
+
expect(page).to be_an Integer
|
45
|
+
expect(page).to eq 1
|
46
46
|
end
|
47
47
|
it "is nil when not set" do
|
48
48
|
page = Twitter::SearchResults.new.page
|
49
|
-
page.
|
49
|
+
expect(page).to be_nil
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe "#query" do
|
54
54
|
it "returns the query" do
|
55
55
|
query = Twitter::SearchResults.new(:search_metadata => {:query => "%23freebandnames"}).query
|
56
|
-
query.
|
57
|
-
query.
|
56
|
+
expect(query).to be_a String
|
57
|
+
expect(query).to eq "%23freebandnames"
|
58
58
|
end
|
59
59
|
it "is nil when not set" do
|
60
60
|
query = Twitter::SearchResults.new.query
|
61
|
-
query.
|
61
|
+
expect(query).to be_nil
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe "#results_per_page" do
|
66
66
|
it "returns the number of results per page" do
|
67
67
|
results_per_page = Twitter::SearchResults.new(:search_metadata => {:results_per_page => 4}).results_per_page
|
68
|
-
results_per_page.
|
69
|
-
results_per_page.
|
68
|
+
expect(results_per_page).to be_an Integer
|
69
|
+
expect(results_per_page).to eq 4
|
70
70
|
end
|
71
71
|
it "is nil when not set" do
|
72
72
|
results_per_page = Twitter::SearchResults.new.results_per_page
|
73
|
-
results_per_page.
|
73
|
+
expect(results_per_page).to be_nil
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
describe "#since_id" do
|
78
78
|
it "returns an ID" do
|
79
79
|
since_id = Twitter::SearchResults.new(:search_metadata => {:since_id => 250126199840518145}).since_id
|
80
|
-
since_id.
|
81
|
-
since_id.
|
80
|
+
expect(since_id).to be_an Integer
|
81
|
+
expect(since_id).to eq 250126199840518145
|
82
82
|
end
|
83
83
|
it "is nil when not set" do
|
84
84
|
since_id = Twitter::SearchResults.new.since_id
|
85
|
-
since_id.
|
85
|
+
expect(since_id).to be_nil
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -5,11 +5,11 @@ describe Twitter::Settings do
|
|
5
5
|
describe "#trend_location" do
|
6
6
|
it "returns a Twitter::Place when set" do
|
7
7
|
place = Twitter::Settings.new(:trend_location => [{:countryCode => 'US', :name => 'San Francisco', :country => 'United States', :placeType => {:name => 'Town', :code => 7}, :woeid => 2487956, :parentid => 23424977, :url => 'http://where.yahooapis.com/v1/place/2487956'}])
|
8
|
-
place.trend_location.
|
8
|
+
expect(place.trend_location).to be_a Twitter::Place
|
9
9
|
end
|
10
10
|
it "returns nil when not set" do
|
11
11
|
place = Twitter::Settings.new
|
12
|
-
place.trend_location.
|
12
|
+
expect(place.trend_location).to be_nil
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/spec/twitter/size_spec.rb
CHANGED
@@ -6,32 +6,32 @@ describe Twitter::Size do
|
|
6
6
|
it "returns false for empty objects" do
|
7
7
|
size = Twitter::Size.new
|
8
8
|
other = Twitter::Size.new
|
9
|
-
(size == other).
|
9
|
+
expect(size == other).to be_false
|
10
10
|
end
|
11
11
|
it "returns true when objects height and width are the same" do
|
12
12
|
size = Twitter::Size.new(:h => 1, :w => 1, :resize => true)
|
13
13
|
other = Twitter::Size.new(:h => 1, :w => 1, :resize => false)
|
14
|
-
(size == other).
|
14
|
+
expect(size == other).to be_true
|
15
15
|
end
|
16
16
|
it "returns false when objects height or width are different" do
|
17
17
|
size = Twitter::Size.new(:h => 1, :w => 1)
|
18
18
|
other = Twitter::Size.new(:h => 1, :w => 2)
|
19
|
-
(size == other).
|
19
|
+
expect(size == other).to be_false
|
20
20
|
end
|
21
21
|
it "returns false when classes are different" do
|
22
22
|
size = Twitter::Size.new(:h => 1, :w => 1)
|
23
23
|
other = Twitter::Base.new(:h => 1, :w => 1)
|
24
|
-
(size == other).
|
24
|
+
expect(size == other).to be_false
|
25
25
|
end
|
26
26
|
it "returns true when objects non-height and width attributes are the same" do
|
27
27
|
size = Twitter::Size.new(:resize => true)
|
28
28
|
other = Twitter::Size.new(:resize => true)
|
29
|
-
(size == other).
|
29
|
+
expect(size == other).to be_true
|
30
30
|
end
|
31
31
|
it "returns false when objects non-height and width attributes are different" do
|
32
32
|
size = Twitter::Size.new(:resize => true)
|
33
33
|
other = Twitter::Size.new(:resize => false)
|
34
|
-
(size == other).
|
34
|
+
expect(size == other).to be_false
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -6,17 +6,17 @@ describe Twitter::SourceUser do
|
|
6
6
|
it "returns true when objects IDs are the same" do
|
7
7
|
saved_search = Twitter::SourceUser.new(:id => 1, :name => "foo")
|
8
8
|
other = Twitter::SourceUser.new(:id => 1, :name => "bar")
|
9
|
-
(saved_search == other).
|
9
|
+
expect(saved_search == other).to be_true
|
10
10
|
end
|
11
11
|
it "returns false when objects IDs are different" do
|
12
12
|
saved_search = Twitter::SourceUser.new(:id => 1)
|
13
13
|
other = Twitter::SourceUser.new(:id => 2)
|
14
|
-
(saved_search == other).
|
14
|
+
expect(saved_search == other).to be_false
|
15
15
|
end
|
16
16
|
it "returns false when classes are different" do
|
17
17
|
saved_search = Twitter::SourceUser.new(:id => 1)
|
18
18
|
other = Twitter::Identity.new(:id => 1)
|
19
|
-
(saved_search == other).
|
19
|
+
expect(saved_search == other).to be_false
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -6,44 +6,44 @@ describe Twitter::Suggestion do
|
|
6
6
|
it "returns false for empty objects" do
|
7
7
|
suggestion = Twitter::Suggestion.new
|
8
8
|
other = Twitter::Suggestion.new
|
9
|
-
(suggestion == other).
|
9
|
+
expect(suggestion == other).to be_false
|
10
10
|
end
|
11
11
|
it "returns true when objects slugs are the same" do
|
12
12
|
suggestion = Twitter::Suggestion.new(:slug => 1, :name => "foo")
|
13
13
|
other = Twitter::Suggestion.new(:slug => 1, :name => "bar")
|
14
|
-
(suggestion == other).
|
14
|
+
expect(suggestion == other).to be_true
|
15
15
|
end
|
16
16
|
it "returns false when objects slugs are different" do
|
17
17
|
suggestion = Twitter::Suggestion.new(:slug => 1)
|
18
18
|
other = Twitter::Suggestion.new(:slug => 2)
|
19
|
-
(suggestion == other).
|
19
|
+
expect(suggestion == other).to be_false
|
20
20
|
end
|
21
21
|
it "returns false when classes are different" do
|
22
22
|
suggestion = Twitter::Suggestion.new(:slug => 1)
|
23
23
|
other = Twitter::Base.new(:slug => 1)
|
24
|
-
(suggestion == other).
|
24
|
+
expect(suggestion == other).to be_false
|
25
25
|
end
|
26
26
|
it "returns true when objects non-slug attributes are the same" do
|
27
27
|
suggestion = Twitter::Suggestion.new(:name => "foo")
|
28
28
|
other = Twitter::Suggestion.new(:name => "foo")
|
29
|
-
(suggestion == other).
|
29
|
+
expect(suggestion == other).to be_true
|
30
30
|
end
|
31
31
|
it "returns false when objects non-slug attributes are different" do
|
32
32
|
suggestion = Twitter::Suggestion.new(:name => "foo")
|
33
33
|
other = Twitter::Suggestion.new(:name => "bar")
|
34
|
-
(suggestion == other).
|
34
|
+
expect(suggestion == other).to be_false
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "#users" do
|
39
39
|
it "returns a User when user is set" do
|
40
40
|
users = Twitter::Suggestion.new(:users => [{:id => 7505382}]).users
|
41
|
-
users.
|
42
|
-
users.first.
|
41
|
+
expect(users).to be_an Array
|
42
|
+
expect(users.first).to be_a Twitter::User
|
43
43
|
end
|
44
44
|
it "is empty when not set" do
|
45
45
|
users = Twitter::Suggestion.new.users
|
46
|
-
users.
|
46
|
+
expect(users).to be_empty
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|