Skip to content

Commit de7224e

Browse files
authored
Handle rspec should deprecation (#128)
1 parent 38ba07a commit de7224e

File tree

2 files changed

+195
-195
lines changed

2 files changed

+195
-195
lines changed

spec/client_spec.rb

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,81 +13,81 @@
1313

1414
it 'feed returns a Feed instance with id' do
1515
client = Stream::Client.new('key', 'secret')
16-
client.api_key.should eq 'key'
17-
client.api_secret.should eq 'secret'
16+
expect(client.api_key).to eq 'key'
17+
expect(client.api_secret).to eq 'secret'
1818
feed = client.feed('feed', '42')
1919
expect(feed).to be_instance_of Stream::Feed
20-
feed.user_id.should eq '42'
21-
feed.slug.should eq 'feed'
22-
feed.id.should eq 'feed:42'
20+
expect(feed.user_id).to eq '42'
21+
expect(feed.slug).to eq 'feed'
22+
expect(feed.id).to eq 'feed:42'
2323
end
2424

2525
it 'check user_token' do
2626
client = Stream::Client.new('key', 'secret')
2727
user_token = client.create_user_session_token('user')
28-
user_token.should eq 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidXNlciJ9.vSdu-exEFUWts57olfk9X_I1CytXuXrRF7A0LpQmoaM'
28+
expect(user_token).to eq 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidXNlciJ9.vSdu-exEFUWts57olfk9X_I1CytXuXrRF7A0LpQmoaM'
2929
payload = JWT.decode(user_token, 'secret', 'HS256')
30-
payload[0]['user_id'].should eq 'user'
30+
expect(payload[0]['user_id']).to eq 'user'
3131
user_token = client.create_user_token('user')
32-
user_token.should eq 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidXNlciJ9.vSdu-exEFUWts57olfk9X_I1CytXuXrRF7A0LpQmoaM'
32+
expect(user_token).to eq 'eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidXNlciJ9.vSdu-exEFUWts57olfk9X_I1CytXuXrRF7A0LpQmoaM'
3333
payload = JWT.decode(user_token, 'secret', 'HS256')
34-
payload[0]['user_id'].should eq 'user'
34+
expect(payload[0]['user_id']).to eq 'user'
3535
user_token = client.create_user_token('user', { 'client' => 'ruby', 'testing' => true })
36-
user_token.should eq 'eyJhbGciOiJIUzI1NiJ9.eyJjbGllbnQiOiJydWJ5IiwidGVzdGluZyI6dHJ1ZSwidXNlcl9pZCI6InVzZXIifQ.cDEffbaTeBO6HWH602wHA6RCKTo5K0gFR50vzfQdW8k'
36+
expect(user_token).to eq 'eyJhbGciOiJIUzI1NiJ9.eyJjbGllbnQiOiJydWJ5IiwidGVzdGluZyI6dHJ1ZSwidXNlcl9pZCI6InVzZXIifQ.cDEffbaTeBO6HWH602wHA6RCKTo5K0gFR50vzfQdW8k'
3737
payload = JWT.decode(user_token, 'secret', 'HS256')
38-
payload[0]['user_id'].should eq 'user'
39-
payload[0]['client'].should eq 'ruby'
40-
payload[0]['testing'].should eq true
38+
expect(payload[0]['user_id']).to eq 'user'
39+
expect(payload[0]['client']).to eq 'ruby'
40+
expect(payload[0]['testing']).to eq true
4141
end
4242

4343
it 'on heroku we connect using environment variables' do
4444
ENV['STREAM_URL'] = 'https://thierry:[email protected]/?app_id=1'
4545
client = Stream::Client.new
46-
client.api_key.should eq 'thierry'
47-
client.api_secret.should eq 'pass'
48-
client.app_id.should eq '1'
49-
client.client_options[:location].should eq nil
50-
client.get_http_client.conn.url_prefix.to_s.should eq 'https://api.stream-io-api.com/api/v1.0'
46+
expect(client.api_key).to eq 'thierry'
47+
expect(client.api_secret).to eq 'pass'
48+
expect(client.app_id).to eq '1'
49+
expect(client.client_options[:location]).to be_nil
50+
expect(client.get_http_client.conn.url_prefix.to_s).to eq 'https://api.stream-io-api.com/api/v1.0'
5151
end
5252

5353
it 'old heroku url' do
5454
ENV['STREAM_URL'] = 'https://thierry:[email protected]/?app_id=1'
5555
client = Stream::Client.new
56-
client.api_key.should eq 'thierry'
57-
client.api_secret.should eq 'pass'
58-
client.app_id.should eq '1'
59-
client.client_options[:location].should eq nil
60-
client.get_http_client.conn.url_prefix.to_s.should eq 'https://api.stream-io-api.com/api/v1.0'
56+
expect(client.api_key).to eq 'thierry'
57+
expect(client.api_secret).to eq 'pass'
58+
expect(client.app_id).to eq '1'
59+
expect(client.client_options[:location]).to be_nil
60+
expect(client.get_http_client.conn.url_prefix.to_s).to eq 'https://api.stream-io-api.com/api/v1.0'
6161
end
6262

6363
it 'heroku url with location' do
6464
ENV['STREAM_URL'] = 'https://thierry:[email protected]/?app_id=1'
6565
client = Stream::Client.new
66-
client.api_key.should eq 'thierry'
67-
client.api_secret.should eq 'pass'
68-
client.app_id.should eq '1'
69-
client.client_options[:location].should eq 'eu-west'
70-
client.get_http_client.conn.url_prefix.to_s.should eq 'https://eu-west-api.stream-io-api.com/api/v1.0'
66+
expect(client.api_key).to eq 'thierry'
67+
expect(client.api_secret).to eq 'pass'
68+
expect(client.app_id).to eq '1'
69+
expect(client.client_options[:location]).to eq 'eu-west'
70+
expect(client.get_http_client.conn.url_prefix.to_s).to eq 'https://eu-west-api.stream-io-api.com/api/v1.0'
7171
end
7272

7373
it 'heroku with getstream.io url with location' do
7474
ENV['STREAM_URL'] = 'https://thierry:[email protected]/?app_id=1'
7575
client = Stream::Client.new
76-
client.api_key.should eq 'thierry'
77-
client.api_secret.should eq 'pass'
78-
client.app_id.should eq '1'
79-
client.client_options[:location].should eq 'eu-west'
80-
client.get_http_client.conn.url_prefix.to_s.should eq 'https://eu-west-api.getstream.io/api/v1.0'
76+
expect(client.api_key).to eq 'thierry'
77+
expect(client.api_secret).to eq 'pass'
78+
expect(client.app_id).to eq '1'
79+
expect(client.client_options[:location]).to eq 'eu-west'
80+
expect(client.get_http_client.conn.url_prefix.to_s).to eq 'https://eu-west-api.getstream.io/api/v1.0'
8181
end
8282

8383
it 'heroku url with location and extra vars' do
8484
ENV['STREAM_URL'] = 'https://thierry:[email protected]/?something_else=2&app_id=1&something_more=3'
8585
client = Stream::Client.new
86-
client.api_key.should eq 'thierry'
87-
client.api_secret.should eq 'pass'
88-
client.app_id.should eq '1'
89-
client.client_options[:location].should eq 'eu-west'
90-
client.get_http_client.conn.url_prefix.to_s.should eq 'https://eu-west-api.stream-io-api.com/api/v1.0'
86+
expect(client.api_key).to eq 'thierry'
87+
expect(client.api_secret).to eq 'pass'
88+
expect(client.app_id).to eq '1'
89+
expect(client.client_options[:location]).to eq 'eu-west'
90+
expect(client.get_http_client.conn.url_prefix.to_s).to eq 'https://eu-west-api.stream-io-api.com/api/v1.0'
9191
end
9292

9393
it 'wrong heroku vars' do
@@ -98,45 +98,45 @@
9898
it 'but overwriting environment variables should be possible' do
9999
ENV['STREAM_URL'] = 'https://thierry:[email protected]/?app_id=1'
100100
client = Stream::Client.new('1', '2', '3')
101-
client.api_key.should eq '1'
102-
client.api_secret.should eq '2'
103-
client.app_id.should eq '3'
101+
expect(client.api_key).to eq '1'
102+
expect(client.api_secret).to eq '2'
103+
expect(client.app_id).to eq '3'
104104
ENV.delete 'STREAM_URL'
105105
end
106106

107107
it 'should handle different api versions if specified' do
108108
client = Stream::Client.new('1', '2', nil, api_version: 'v2.345')
109109
http_client = client.get_http_client
110-
http_client.conn.url_prefix.to_s.should eq 'https://api.stream-io-api.com/api/v2.345'
110+
expect(http_client.conn.url_prefix.to_s).to eq 'https://api.stream-io-api.com/api/v2.345'
111111
end
112112

113113
it 'should handle default location as api.stream-io-api.com' do
114114
client = Stream::Client.new('1', '2')
115115
http_client = client.get_http_client
116-
http_client.conn.url_prefix.to_s.should eq 'https://api.stream-io-api.com/api/v1.0'
116+
expect(http_client.conn.url_prefix.to_s).to eq 'https://api.stream-io-api.com/api/v1.0'
117117
end
118118

119119
it 'should handle overriding default hostname as api.getstream.io to test SNI' do
120120
client = Stream::Client.new('1', '2', nil, api_hostname: 'getstream.io')
121121
http_client = client.get_http_client
122-
http_client.conn.url_prefix.to_s.should eq 'https://api.getstream.io/api/v1.0'
122+
expect(http_client.conn.url_prefix.to_s).to eq 'https://api.getstream.io/api/v1.0'
123123
end
124124

125125
it 'should handle us-east location as api.stream-io-api.com' do
126126
client = Stream::Client.new('1', '2', nil, location: 'us-east')
127127
http_client = client.get_http_client
128-
http_client.conn.url_prefix.to_s.should eq 'https://us-east-api.stream-io-api.com/api/v1.0'
128+
expect(http_client.conn.url_prefix.to_s).to eq 'https://us-east-api.stream-io-api.com/api/v1.0'
129129
end
130130

131131
it 'should have 3s default timeout' do
132132
client = Stream::Client.new('1', '2', nil)
133133
http_client = client.get_http_client
134-
http_client.conn.options[:timeout].should eq 3
134+
expect(http_client.conn.options[:timeout]).to eq 3
135135
end
136136

137137
it 'should be possible to change timeout' do
138138
client = Stream::Client.new('1', '2', nil, default_timeout: 5)
139139
http_client = client.get_http_client
140-
http_client.conn.options[:timeout].should eq 5
140+
expect(http_client.conn.options[:timeout]).to eq 5
141141
end
142142
end

0 commit comments

Comments
 (0)