twitter 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/README.md +11 -9
  3. data/lib/twitter/api.rb +3 -5
  4. data/lib/twitter/base.rb +1 -4
  5. data/lib/twitter/geo/point.rb +2 -2
  6. data/lib/twitter/request/multipart_with_file.rb +1 -1
  7. data/lib/twitter/tweet.rb +9 -1
  8. data/lib/twitter/user.rb +2 -0
  9. data/lib/twitter/version.rb +1 -1
  10. data/spec/fixtures/status.json +1 -1
  11. data/spec/helper.rb +6 -0
  12. data/spec/twitter/action/favorite_spec.rb +6 -6
  13. data/spec/twitter/action/follow_spec.rb +6 -6
  14. data/spec/twitter/action/list_member_added_spec.rb +9 -9
  15. data/spec/twitter/action/mention_spec.rb +11 -11
  16. data/spec/twitter/action/reply_spec.rb +9 -9
  17. data/spec/twitter/action/retweet_spec.rb +9 -9
  18. data/spec/twitter/action_factory_spec.rb +7 -9
  19. data/spec/twitter/action_spec.rb +2 -2
  20. data/spec/twitter/api/account_spec.rb +38 -66
  21. data/spec/twitter/api/activity_spec.rb +6 -10
  22. data/spec/twitter/api/blocks_spec.rb +38 -83
  23. data/spec/twitter/api/direct_messages_spec.rb +33 -55
  24. data/spec/twitter/api/friendships_spec.rb +124 -266
  25. data/spec/twitter/api/geo_spec.rb +18 -36
  26. data/spec/twitter/api/help_spec.rb +15 -23
  27. data/spec/twitter/api/lists_spec.rb +172 -402
  28. data/spec/twitter/api/report_spam_spec.rb +5 -9
  29. data/spec/twitter/api/saved_searches_spec.rb +23 -35
  30. data/spec/twitter/api/search_spec.rb +15 -25
  31. data/spec/twitter/api/statuses_spec.rb +137 -235
  32. data/spec/twitter/api/trends_spec.rb +17 -29
  33. data/spec/twitter/api/users_spec.rb +90 -181
  34. data/spec/twitter/base_spec.rb +38 -40
  35. data/spec/twitter/basic_user_spec.rb +3 -3
  36. data/spec/twitter/client_spec.rb +28 -46
  37. data/spec/twitter/configuration_spec.rb +3 -3
  38. data/spec/twitter/cursor_spec.rb +16 -32
  39. data/spec/twitter/direct_message_spec.rb +9 -9
  40. data/spec/twitter/error/client_error_spec.rb +4 -12
  41. data/spec/twitter/error/server_error_spec.rb +2 -6
  42. data/spec/twitter/error_spec.rb +2 -2
  43. data/spec/twitter/geo/point_spec.rb +6 -6
  44. data/spec/twitter/geo/polygon_spec.rb +4 -4
  45. data/spec/twitter/geo_factory_spec.rb +3 -5
  46. data/spec/twitter/geo_spec.rb +4 -4
  47. data/spec/twitter/identifiable_spec.rb +9 -13
  48. data/spec/twitter/list_spec.rb +7 -7
  49. data/spec/twitter/media/photo_spec.rb +6 -6
  50. data/spec/twitter/media_factory_spec.rb +2 -4
  51. data/spec/twitter/oembed_spec.rb +24 -24
  52. data/spec/twitter/place_spec.rb +13 -13
  53. data/spec/twitter/rate_limit_spec.rb +16 -16
  54. data/spec/twitter/relationship_spec.rb +5 -5
  55. data/spec/twitter/saved_search_spec.rb +5 -5
  56. data/spec/twitter/search_results_spec.rb +21 -21
  57. data/spec/twitter/settings_spec.rb +2 -2
  58. data/spec/twitter/size_spec.rb +6 -6
  59. data/spec/twitter/source_user_spec.rb +3 -3
  60. data/spec/twitter/suggestion_spec.rb +9 -9
  61. data/spec/twitter/target_user_spec.rb +3 -3
  62. data/spec/twitter/trend_spec.rb +6 -6
  63. data/spec/twitter/tweet_spec.rb +69 -69
  64. data/spec/twitter/user_spec.rb +43 -43
  65. data/spec/twitter_spec.rb +12 -16
  66. metadata +2 -2
@@ -2,7 +2,7 @@ require 'helper'
2
2
 
3
3
  describe Twitter::Base do
4
4
 
5
- context 'identity map enabled' do
5
+ context "identity map enabled" do
6
6
  before do
7
7
  Twitter.identity_map = Twitter::IdentityMap
8
8
  object = Twitter::Base.new(:id => 1)
@@ -13,70 +13,68 @@ describe Twitter::Base do
13
13
  Twitter.identity_map = false
14
14
  end
15
15
 
16
- describe '.identity_map' do
17
- it 'returns an instance of the identity map' do
18
- Twitter::Base.identity_map.should be_a Twitter::IdentityMap
16
+ describe ".identity_map" do
17
+ it "returns an instance of the identity map" do
18
+ expect(Twitter::Base.identity_map).to be_a Twitter::IdentityMap
19
19
  end
20
20
  end
21
21
 
22
- describe '.fetch' do
23
- it 'returns existing objects' do
24
- Twitter::Base.fetch(:id => 1).should be
22
+ describe ".fetch" do
23
+ it "returns existing objects" do
24
+ expect(Twitter::Base.fetch(:id => 1)).to be
25
25
  end
26
26
 
27
27
  it "raises an error on objects that don't exist" do
28
- lambda {
29
- Twitter::Base.fetch(:id => 6)
30
- }.should raise_error(Twitter::Error::IdentityMapKeyError)
28
+ expect{Twitter::Base.fetch(:id => 6)}.to raise_error(Twitter::Error::IdentityMapKeyError)
31
29
  end
32
30
  end
33
31
 
34
- describe '.store' do
35
- it 'stores Twitter::Base objects' do
32
+ describe ".store" do
33
+ it "stores Twitter::Base objects" do
36
34
  object = Twitter::Base.new(:id => 4)
37
- Twitter::Base.store(object).should be_a Twitter::Base
35
+ expect(Twitter::Base.store(object)).to be_a Twitter::Base
38
36
  end
39
37
  end
40
38
 
41
- describe '.fetch_or_new' do
42
- it 'returns existing objects' do
43
- Twitter::Base.fetch_or_new(:id => 1).should be
39
+ describe ".fetch_or_new" do
40
+ it "returns existing objects" do
41
+ expect(Twitter::Base.fetch_or_new(:id => 1)).to be
44
42
  end
45
- it 'creates new objects and stores them' do
46
- Twitter::Base.fetch_or_new(:id => 2).should be
47
- Twitter::Base.fetch(:id => 2).should be
43
+ it "creates new objects and stores them" do
44
+ expect(Twitter::Base.fetch_or_new(:id => 2)).to be
45
+ expect(Twitter::Base.fetch(:id => 2)).to be
48
46
  end
49
47
  end
50
48
 
51
49
  describe "#[]" do
52
50
  it "calls methods using [] with symbol" do
53
- @base[:object_id].should be_an Integer
51
+ expect(@base[:object_id]).to be_an Integer
54
52
  end
55
53
  it "calls methods using [] with string" do
56
- @base['object_id'].should be_an Integer
54
+ expect(@base['object_id']).to be_an Integer
57
55
  end
58
56
  it "returns nil for missing method" do
59
- @base[:foo].should be_nil
60
- @base['foo'].should be_nil
57
+ expect(@base[:foo]).to be_nil
58
+ expect(@base['foo']).to be_nil
61
59
  end
62
60
  end
63
61
 
64
62
  describe "#to_hash" do
65
63
  it "returns a hash" do
66
- @base.to_hash.should be_a Hash
67
- @base.to_hash[:id].should eq 1
64
+ expect(@base.to_hash).to be_a Hash
65
+ expect(@base.to_hash[:id]).to eq 1
68
66
  end
69
67
  end
70
68
 
71
69
  describe "identical objects" do
72
70
  it "have the same object_id" do
73
- @base.object_id.should eq Twitter::Base.fetch(:id => 1).object_id
71
+ expect(@base.object_id).to eq Twitter::Base.fetch(:id => 1).object_id
74
72
  end
75
73
  end
76
74
 
77
75
  end
78
76
 
79
- context 'identity map disabled' do
77
+ context "identity map disabled" do
80
78
  before(:all) do
81
79
  Twitter.identity_map = false
82
80
  end
@@ -84,28 +82,28 @@ describe Twitter::Base do
84
82
  Twitter.identity_map = Twitter::IdentityMap
85
83
  end
86
84
 
87
- describe '.identity_map' do
88
- it 'returns nil' do
89
- Twitter::Base.identity_map.should be_nil
85
+ describe ".identity_map" do
86
+ it "returns nil" do
87
+ expect(Twitter::Base.identity_map).to be_nil
90
88
  end
91
89
  end
92
90
 
93
- describe '.fetch' do
94
- it 'returns nil' do
95
- Twitter::Base.fetch(:id => 1).should be_nil
91
+ describe ".fetch" do
92
+ it "returns nil" do
93
+ expect(Twitter::Base.fetch(:id => 1)).to be_nil
96
94
  end
97
95
  end
98
96
 
99
- describe '.store' do
100
- it 'returns an instance of the object' do
101
- Twitter::Base.store(Twitter::Base.new(:id => 1)).should be_a Twitter::Base
97
+ describe ".store" do
98
+ it "returns an instance of the object" do
99
+ expect(Twitter::Base.store(Twitter::Base.new(:id => 1))).to be_a Twitter::Base
102
100
  end
103
101
  end
104
102
 
105
- describe '.fetch_or_new' do
106
- it 'creates new objects' do
107
- Twitter::Base.fetch_or_new(:id => 2).should be
108
- Twitter.identity_map.should be_false
103
+ describe ".fetch_or_new" do
104
+ it "creates new objects" do
105
+ expect(Twitter::Base.fetch_or_new(:id => 2)).to be
106
+ expect(Twitter.identity_map).to be_false
109
107
  end
110
108
  end
111
109
  end
@@ -6,17 +6,17 @@ describe Twitter::BasicUser do
6
6
  it "returns true when objects IDs are the same" do
7
7
  saved_search = Twitter::BasicUser.new(:id => 1, :name => "foo")
8
8
  other = Twitter::BasicUser.new(:id => 1, :name => "bar")
9
- (saved_search == other).should be_true
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::BasicUser.new(:id => 1)
13
13
  other = Twitter::BasicUser.new(:id => 2)
14
- (saved_search == other).should be_false
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::BasicUser.new(:id => 1)
18
18
  other = Twitter::Identity.new(:id => 1)
19
- (saved_search == other).should be_false
19
+ expect(saved_search == other).to be_false
20
20
  end
21
21
  end
22
22
 
@@ -25,7 +25,7 @@ describe Twitter::Client do
25
25
  it "inherits the module configuration" do
26
26
  client = Twitter::Client.new
27
27
  Twitter::Configurable.keys.each do |key|
28
- client.instance_variable_get(:"@#{key}").should eq key
28
+ expect(client.instance_variable_get(:"@#{key}")).to eq key
29
29
  end
30
30
  end
31
31
 
@@ -48,12 +48,12 @@ describe Twitter::Client do
48
48
  it "overrides the module configuration" do
49
49
  client = Twitter::Client.new(@configuration)
50
50
  Twitter::Configurable.keys.each do |key|
51
- client.instance_variable_get(:"@#{key}").should eq @configuration[key]
51
+ expect(client.instance_variable_get(:"@#{key}")).to eq @configuration[key]
52
52
  end
53
53
  end
54
54
  end
55
55
 
56
- context "after initilization" do
56
+ context "after initialization" do
57
57
  it "overrides the module configuration after initialization" do
58
58
  client = Twitter::Client.new
59
59
  client.configure do |config|
@@ -62,7 +62,7 @@ describe Twitter::Client do
62
62
  end
63
63
  end
64
64
  Twitter::Configurable.keys.each do |key|
65
- client.instance_variable_get(:"@#{key}").should eq @configuration[key]
65
+ expect(client.instance_variable_get(:"@#{key}")).to eq @configuration[key]
66
66
  end
67
67
  end
68
68
  end
@@ -71,91 +71,73 @@ describe Twitter::Client do
71
71
  end
72
72
 
73
73
  it "does not cache the screen name across clients" do
74
- stub_get("/1.1/account/verify_credentials.json").
75
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
74
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
76
75
  client1 = Twitter::Client.new
77
- client1.verify_credentials.id.should eq 7505382
78
- stub_get("/1.1/account/verify_credentials.json").
79
- to_return(:body => fixture("pengwynn.json"), :headers => {:content_type => "application/json; charset=utf-8"})
76
+ expect(client1.verify_credentials.id).to eq 7505382
77
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("pengwynn.json"), :headers => {:content_type => "application/json; charset=utf-8"})
80
78
  client2 = Twitter::Client.new
81
- client2.verify_credentials.id.should eq 14100886
79
+ expect(client2.verify_credentials.id).to eq 14100886
82
80
  end
83
81
 
84
82
  describe "#delete" do
85
83
  before do
86
- stub_delete("/custom/delete").
87
- with(:query => {:deleted => "object"})
84
+ stub_delete("/custom/delete").with(:query => {:deleted => "object"})
88
85
  end
89
86
  it "allows custom put requests" do
90
87
  subject.delete("/custom/delete", {:deleted => "object"})
91
- a_delete("/custom/delete").
92
- with(:query => {:deleted => "object"}).
93
- should have_been_made
88
+ expect(a_delete("/custom/delete").with(:query => {:deleted => "object"})).to have_been_made
94
89
  end
95
90
  end
96
91
 
97
92
  describe "#put" do
98
93
  before do
99
- stub_put("/custom/put").
100
- with(:body => {:updated => "object"})
94
+ stub_put("/custom/put").with(:body => {:updated => "object"})
101
95
  end
102
96
  it "allows custom put requests" do
103
97
  subject.put("/custom/put", {:updated => "object"})
104
- a_put("/custom/put").
105
- with(:body => {:updated => "object"}).
106
- should have_been_made
98
+ expect(a_put("/custom/put").with(:body => {:updated => "object"})).to have_been_made
107
99
  end
108
100
  end
109
101
 
110
102
  describe "#credentials?" do
111
103
  it "returns true if all credentials are present" do
112
104
  client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT', :oauth_token_secret => 'OS')
113
- client.credentials?.should be_true
105
+ expect(client.credentials?).to be_true
114
106
  end
115
107
  it "returns false if any credentials are missing" do
116
108
  client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT')
117
- client.credentials?.should be_false
109
+ expect(client.credentials?).to be_false
118
110
  end
119
111
  end
120
112
 
121
113
  describe "#connection" do
122
114
  it "looks like Faraday connection" do
123
- subject.connection.should respond_to(:run_request)
115
+ expect(subject.connection).to respond_to(:run_request)
124
116
  end
125
117
  it "memoizes the connection" do
126
118
  c1, c2 = subject.connection, subject.connection
127
- c1.object_id.should eq c2.object_id
119
+ expect(c1.object_id).to eq c2.object_id
128
120
  end
129
121
  end
130
122
 
131
123
  describe "#request" do
132
124
  it "encodes the entire body when no uploaded media is present" do
133
- stub_post("/1.1/statuses/update.json").
134
- with(:body => {:status => "Update"}).
135
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
125
+ stub_post("/1.1/statuses/update.json").with(:body => {:status => "Update"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
136
126
  subject.update("Update")
137
- a_post("/1.1/statuses/update.json").
138
- with(:body => {:status => "Update"}).
139
- should have_been_made
127
+ expect(a_post("/1.1/statuses/update.json").with(:body => {:status => "Update"})).to have_been_made
140
128
  end
141
129
  it "encodes none of the body when uploaded media is present" do
142
- stub_post("/1.1/statuses/update_with_media.json").
143
- to_return(:body => fixture("status_with_media.json"), :headers => {:content_type => "application/json; charset=utf-8"})
130
+ stub_post("/1.1/statuses/update_with_media.json").to_return(:body => fixture("status_with_media.json"), :headers => {:content_type => "application/json; charset=utf-8"})
144
131
  subject.update_with_media("Update", fixture("pbjt.gif"))
145
- a_post("/1.1/statuses/update_with_media.json").
146
- should have_been_made
132
+ expect(a_post("/1.1/statuses/update_with_media.json")).to have_been_made
147
133
  end
148
134
  it "catches Faraday errors" do
149
135
  subject.stub!(:connection).and_raise(Faraday::Error::ClientError.new("Oups"))
150
- lambda do
151
- subject.request(:get, "/path")
152
- end.should raise_error(Twitter::Error::ClientError, "Oups")
136
+ expect{subject.request(:get, "/path")}.to raise_error(Twitter::Error::ClientError, "Oups")
153
137
  end
154
138
  it "catches MultiJson::DecodeError errors" do
155
139
  subject.stub!(:connection).and_raise(MultiJson::DecodeError.new("unexpected token", [], "<!DOCTYPE html>"))
156
- lambda do
157
- subject.request(:get, "/path")
158
- end.should raise_error(Twitter::Error::DecodeError, "unexpected token")
140
+ expect{subject.request(:get, "/path")}.to raise_error(Twitter::Error::DecodeError, "unexpected token")
159
141
  end
160
142
  end
161
143
 
@@ -163,12 +145,12 @@ describe Twitter::Client do
163
145
  it "creates the correct auth headers" do
164
146
  uri = URI("https://api.twitter.com/1.1/direct_messages.json")
165
147
  authorization = subject.auth_header(:get, uri)
166
- authorization.options[:signature_method].should eq "HMAC-SHA1"
167
- authorization.options[:version].should eq "1.0"
168
- authorization.options[:consumer_key].should eq "CK"
169
- authorization.options[:consumer_secret].should eq "CS"
170
- authorization.options[:token].should eq "OT"
171
- authorization.options[:token_secret].should eq "OS"
148
+ expect(authorization.options[:signature_method]).to eq "HMAC-SHA1"
149
+ expect(authorization.options[:version]).to eq "1.0"
150
+ expect(authorization.options[:consumer_key]).to eq "CK"
151
+ expect(authorization.options[:consumer_secret]).to eq "CS"
152
+ expect(authorization.options[:token]).to eq "OT"
153
+ expect(authorization.options[:token_secret]).to eq "OS"
172
154
  end
173
155
  end
174
156
 
@@ -5,12 +5,12 @@ describe Twitter::Configuration do
5
5
  describe "#photo_sizes" do
6
6
  it "returns a hash of sizes when photo_sizes is set" do
7
7
  photo_sizes = Twitter::Configuration.new(:photo_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'}}).photo_sizes
8
- photo_sizes.should be_a Hash
9
- photo_sizes[:small].should be_a Twitter::Size
8
+ expect(photo_sizes).to be_a Hash
9
+ expect(photo_sizes[:small]).to be_a Twitter::Size
10
10
  end
11
11
  it "is empty when photo_sizes is not set" do
12
12
  photo_sizes = Twitter::Configuration.new.photo_sizes
13
- photo_sizes.should be_empty
13
+ expect(photo_sizes).to be_empty
14
14
  end
15
15
  end
16
16
 
@@ -5,59 +5,43 @@ describe Twitter::Cursor do
5
5
  describe "#collection" do
6
6
  it "returns a collection" do
7
7
  collection = Twitter::Cursor.new({:ids => [1, 2, 3, 4, 5]}, :ids, nil, Twitter::Client.new, :follower_ids, {}).collection
8
- collection.should be_an Array
9
- collection.first.should be_a Fixnum
8
+ expect(collection).to be_an Array
9
+ expect(collection.first).to be_a Fixnum
10
10
  end
11
11
  end
12
12
 
13
13
  describe "#all" do
14
14
  before do
15
15
  @client = Twitter::Client.new
16
- stub_get("/1.1/followers/ids.json").
17
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
18
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
19
- stub_get("/1.1/followers/ids.json").
20
- with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).
21
- to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
16
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
17
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
22
18
  end
23
19
  it "requests the correct resources" do
24
20
  @client.follower_ids("sferik").all
25
- a_get("/1.1/followers/ids.json").
26
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
27
- should have_been_made
28
- a_get("/1.1/followers/ids.json").
29
- with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).
30
- should have_been_made
21
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
22
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
31
23
  end
32
24
  it "fetches all" do
33
25
  follower_ids = @client.follower_ids("sferik").all
34
- follower_ids.size.should == 5993
26
+ expect(follower_ids.size).to eq 5993
35
27
  end
36
28
  end
37
29
 
38
30
  describe "#each" do
39
31
  before do
40
32
  @client = Twitter::Client.new
41
- stub_get("/1.1/followers/ids.json").
42
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
43
- to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
44
- stub_get("/1.1/followers/ids.json").
45
- with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).
46
- to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
33
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
34
+ stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
47
35
  end
48
36
  it "requests the correct resources" do
49
37
  @client.follower_ids("sferik").each{}
50
- a_get("/1.1/followers/ids.json").
51
- with(:query => {:cursor => "-1", :screen_name => "sferik"}).
52
- should have_been_made
53
- a_get("/1.1/followers/ids.json").
54
- with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).
55
- should have_been_made
38
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
39
+ expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
56
40
  end
57
41
  it "iterates" do
58
42
  count = 0
59
43
  @client.follower_ids("sferik").each{count += 1}
60
- count.should == 5993
44
+ expect(count).to eq 5993
61
45
  end
62
46
  end
63
47
 
@@ -67,7 +51,7 @@ describe Twitter::Cursor do
67
51
  @cursor = Twitter::Cursor.new({:previous_cursor => 0}, :ids, nil, Twitter::Client.new, :follower_ids, {})
68
52
  end
69
53
  it "returns true" do
70
- @cursor.first?.should be_true
54
+ expect(@cursor.first?).to be_true
71
55
  end
72
56
  end
73
57
  context "when previous cursor does not equal zero" do
@@ -75,7 +59,7 @@ describe Twitter::Cursor do
75
59
  @cursor = Twitter::Cursor.new({:previous_cursor => 1}, :ids, nil, Twitter::Client.new, :follower_ids, {})
76
60
  end
77
61
  it "returns true" do
78
- @cursor.first?.should be_false
62
+ expect(@cursor.first?).to be_false
79
63
  end
80
64
  end
81
65
  end
@@ -86,7 +70,7 @@ describe Twitter::Cursor do
86
70
  @cursor = Twitter::Cursor.new({:next_cursor => 0}, :ids, nil, Twitter::Client.new, :follower_ids, {})
87
71
  end
88
72
  it "returns true" do
89
- @cursor.last?.should be_true
73
+ expect(@cursor.last?).to be_true
90
74
  end
91
75
  end
92
76
  context "when next cursor does not equal zero" do
@@ -94,7 +78,7 @@ describe Twitter::Cursor do
94
78
  @cursor = Twitter::Cursor.new({:next_cursor => 1}, :ids, nil, Twitter::Client.new, :follower_ids, {})
95
79
  end
96
80
  it "returns false" do
97
- @cursor.last?.should be_false
81
+ expect(@cursor.last?).to be_false
98
82
  end
99
83
  end
100
84
  end
@@ -6,50 +6,50 @@ describe Twitter::DirectMessage do
6
6
  it "returns true when objects IDs are the same" do
7
7
  direct_message = Twitter::DirectMessage.new(:id => 1, :text => "foo")
8
8
  other = Twitter::DirectMessage.new(:id => 1, :text => "bar")
9
- (direct_message == other).should be_true
9
+ expect(direct_message == other).to be_true
10
10
  end
11
11
  it "returns false when objects IDs are different" do
12
12
  direct_message = Twitter::DirectMessage.new(:id => 1)
13
13
  other = Twitter::DirectMessage.new(:id => 2)
14
- (direct_message == other).should be_false
14
+ expect(direct_message == other).to be_false
15
15
  end
16
16
  it "returns false when classes are different" do
17
17
  direct_message = Twitter::DirectMessage.new(:id => 1)
18
18
  other = Twitter::Identity.new(:id => 1)
19
- (direct_message == other).should be_false
19
+ expect(direct_message == 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
  direct_message = Twitter::DirectMessage.new(:id => 1825786345, :created_at => "Mon Jul 16 12:59:01 +0000 2007")
26
- direct_message.created_at.should be_a Time
26
+ expect(direct_message.created_at).to be_a Time
27
27
  end
28
28
  it "returns nil when created_at is not set" do
29
29
  direct_message = Twitter::DirectMessage.new(:id => 1825786345)
30
- direct_message.created_at.should be_nil
30
+ expect(direct_message.created_at).to be_nil
31
31
  end
32
32
  end
33
33
 
34
34
  describe "#recipient" do
35
35
  it "returns a User when recipient is set" do
36
36
  recipient = Twitter::DirectMessage.new(:id => 1825786345, :recipient => {:id => 7505382}).recipient
37
- recipient.should be_a Twitter::User
37
+ expect(recipient).to be_a Twitter::User
38
38
  end
39
39
  it "returns nil when recipient is not set" do
40
40
  recipient = Twitter::DirectMessage.new(:id => 1825786345).recipient
41
- recipient.should be_nil
41
+ expect(recipient).to be_nil
42
42
  end
43
43
  end
44
44
 
45
45
  describe "#sender" do
46
46
  it "returns a User when sender is set" do
47
47
  sender = Twitter::DirectMessage.new(:id => 1825786345, :sender => {:id => 7505382}).sender
48
- sender.should be_a Twitter::User
48
+ expect(sender).to be_a Twitter::User
49
49
  end
50
50
  it "returns nil when sender is not set" do
51
51
  sender = Twitter::DirectMessage.new(:id => 1825786345).sender
52
- sender.should be_nil
52
+ expect(sender).to be_nil
53
53
  end
54
54
  end
55
55