signet 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,9 +45,9 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
45
45
  end
46
46
 
47
47
  it 'should raise an error if scope is omitted' do
48
- (lambda do
48
+ expect(lambda do
49
49
  @client.fetch_temporary_credential!
50
- end).should raise_error(Signet::AuthorizationError)
50
+ end).to raise_error(Signet::AuthorizationError)
51
51
  end
52
52
 
53
53
  it 'should raise an error if the server gives an unexpected status' do
@@ -56,7 +56,7 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
56
56
  [509, {}, 'Rate limit hit or something.']
57
57
  end
58
58
  end
59
- (lambda do
59
+ expect(lambda do
60
60
  connection = Faraday.new(:url => 'https://www.google.com') do |builder|
61
61
  builder.adapter(:test, stubs)
62
62
  end
@@ -66,7 +66,7 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
66
66
  :scope => 'https://www.google.com/m8/feeds/'
67
67
  }
68
68
  )
69
- end).should raise_error(Signet::AuthorizationError)
69
+ end).to raise_error(Signet::AuthorizationError)
70
70
  stubs.verify_stubbed_calls
71
71
  end
72
72
 
@@ -74,35 +74,35 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
74
74
  @client.fetch_temporary_credential!(:additional_parameters => {
75
75
  :scope => 'https://www.google.com/m8/feeds/'
76
76
  })
77
- @client.temporary_credential_key.size.should > 0
78
- @client.temporary_credential_secret.size.should > 0
77
+ expect(@client.temporary_credential_key.size).to be > 0
78
+ expect(@client.temporary_credential_secret.size).to be > 0
79
79
  end
80
80
 
81
81
  it 'should have the correct authorization URI' do
82
82
  @client.fetch_temporary_credential!(:additional_parameters => {
83
83
  :scope => 'https://www.google.com/m8/feeds/'
84
84
  })
85
- @client.authorization_uri.query_values["oauth_token"].should ==
86
- @client.temporary_credential_key
85
+ expect(@client.authorization_uri.query_values["oauth_token"]).to eq(
86
+ @client.temporary_credential_key)
87
87
  end
88
88
 
89
89
  it 'should raise an error if the temporary credentials are bogus' do
90
- (lambda do
90
+ expect(lambda do
91
91
  @client.temporary_credential_key = '12345'
92
92
  @client.temporary_credential_secret = '12345'
93
93
  @client.fetch_token_credential!(:verifier => 'XbVKagBShNsAGBRJWoC4gtFR')
94
- end).should raise_error(Signet::AuthorizationError)
94
+ end).to raise_error(Signet::AuthorizationError)
95
95
  end
96
96
 
97
97
  it 'should raise an error if the token credentials are bogus' do
98
- (lambda do
98
+ expect(lambda do
99
99
  @client.token_credential_key = '12345'
100
100
  @client.token_credential_secret = '12345'
101
101
  @client.fetch_protected_resource(
102
102
  :uri =>
103
103
  'https://www.google.com/m8/feeds/'
104
104
  )
105
- end).should raise_error(Signet::AuthorizationError)
105
+ end).to raise_error(Signet::AuthorizationError)
106
106
  end
107
107
 
108
108
  # We have to stub responses for the token credentials
@@ -130,9 +130,8 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
130
130
  :scope => 'https://www.google.com/m8/feeds/'
131
131
  }
132
132
  )
133
- @client.token_credential_key.should ==
134
- '1/YFw6UH2Dn7W691-qAbCfsmqEHQrPb7ptIvYx9m6YkUQ'
135
- @client.token_credential_secret.should == 'Ew3YHAY4bcBryiOUvbdHGa57'
133
+ expect(@client.token_credential_key).to eq '1/YFw6UH2Dn7W691-qAbCfsmqEHQrPb7ptIvYx9m6YkUQ'
134
+ expect(@client.token_credential_secret).to eq 'Ew3YHAY4bcBryiOUvbdHGa57'
136
135
  stubs.verify_stubbed_calls
137
136
  end
138
137
 
@@ -142,7 +141,7 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
142
141
  [509, {}, 'Rate limit hit or something.']
143
142
  end
144
143
  end
145
- (lambda do
144
+ expect(lambda do
146
145
  connection = Faraday.new(:url => 'https://www.google.com') do |builder|
147
146
  builder.adapter(:test, stubs)
148
147
  end
@@ -155,7 +154,7 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
155
154
  :scope => 'https://www.google.com/m8/feeds/'
156
155
  }
157
156
  )
158
- end).should raise_error(Signet::AuthorizationError)
157
+ end).to raise_error(Signet::AuthorizationError)
159
158
  stubs.verify_stubbed_calls
160
159
  end
161
160
 
@@ -182,9 +181,9 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
182
181
  :uri =>
183
182
  'http://www-opensocial.googleusercontent.com/api/people/@me/@self'
184
183
  )
185
- response.status.should == 200
186
- response.headers['Content-Type'].should == 'application/json'
187
- response.body.should == '{"data":"goes here"}'
184
+ expect(response.status).to eq 200
185
+ expect(response.headers['Content-Type']).to eq 'application/json'
186
+ expect(response.body).to eq '{"data":"goes here"}'
188
187
  end
189
188
 
190
189
  it 'should correctly fetch the protected resource' do
@@ -213,9 +212,9 @@ describe Signet::OAuth1::Client, 'configured for standard Google APIs' do
213
212
  )
214
213
  end
215
214
  )
216
- response.status.should == 200
217
- response.headers['Content-Type'].should == 'application/json'
218
- response.body.should == '{"data":"goes here"}'
215
+ expect(response.status).to eq 200
216
+ expect(response.headers['Content-Type']).to eq 'application/json'
217
+ expect(response.body).to eq '{"data":"goes here"}'
219
218
  end
220
219
  end
221
220
 
@@ -229,11 +228,11 @@ describe Signet::OAuth1::Client, 'configured for two-legged OAuth' do
229
228
  end
230
229
 
231
230
  it 'should raise an error if the client credentials are bogus' do
232
- (lambda do
231
+ expect(lambda do
233
232
  @client.fetch_protected_resource(
234
233
  :uri =>
235
234
  'https://www.google.com/m8/feeds/'
236
235
  )
237
- end).should raise_error(Signet::AuthorizationError)
236
+ end).to raise_error(Signet::AuthorizationError)
238
237
  end
239
238
  end
@@ -38,9 +38,9 @@ describe Signet::OAuth1::HMACSHA1 do
38
38
  client_credential_secret = "kd94hf93k423kf44"
39
39
  token_credential_secret = "pfkkdhi9sl3r4s00"
40
40
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
41
- Signet::OAuth1::HMACSHA1.generate_signature(
41
+ expect(Signet::OAuth1::HMACSHA1.generate_signature(
42
42
  base_string, client_credential_secret, token_credential_secret
43
- ).should == "tR3+Ty81lMeYAr/Fid0kMTYa/WM="
43
+ )).to eq "tR3+Ty81lMeYAr/Fid0kMTYa/WM="
44
44
  end
45
45
 
46
46
  it 'should correctly generate a signature' do
@@ -59,8 +59,8 @@ describe Signet::OAuth1::HMACSHA1 do
59
59
  client_credential_secret = "Kv+o2XXL/9RxkQW3lO3QTVlH"
60
60
  token_credential_secret = "QllSuL9eQ5FXFO1Z/HcgL4ON"
61
61
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
62
- Signet::OAuth1::HMACSHA1.generate_signature(
62
+ expect(Signet::OAuth1::HMACSHA1.generate_signature(
63
63
  base_string, client_credential_secret, token_credential_secret
64
- ).should == "G/nkdbmbpEA+6RD1Sc5uIefhFfQ="
64
+ )).to eq "G/nkdbmbpEA+6RD1Sc5uIefhFfQ="
65
65
  end
66
66
  end
@@ -38,9 +38,9 @@ describe Signet::OAuth1::PLAINTEXT do
38
38
  client_credential_secret = "kd94hf93k423kf44"
39
39
  token_credential_secret = "pfkkdhi9sl3r4s00"
40
40
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
41
- Signet::OAuth1::PLAINTEXT.generate_signature(
41
+ expect(Signet::OAuth1::PLAINTEXT.generate_signature(
42
42
  base_string, client_credential_secret, token_credential_secret
43
- ).should == "kd94hf93k423kf44%26pfkkdhi9sl3r4s00"
43
+ )).to eq "kd94hf93k423kf44%26pfkkdhi9sl3r4s00"
44
44
  end
45
45
 
46
46
  it 'should correctly generate a signature' do
@@ -59,8 +59,8 @@ describe Signet::OAuth1::PLAINTEXT do
59
59
  client_credential_secret = "Kv+o2XXL/9RxkQW3lO3QTVlH"
60
60
  token_credential_secret = "QllSuL9eQ5FXFO1Z/HcgL4ON"
61
61
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
62
- Signet::OAuth1::PLAINTEXT.generate_signature(
62
+ expect(Signet::OAuth1::PLAINTEXT.generate_signature(
63
63
  base_string, client_credential_secret, token_credential_secret
64
- ).should == "Kv%252Bo2XXL%252F9RxkQW3lO3QTVlH%26QllSuL9eQ5FXFO1Z%252FHcgL4ON"
64
+ )).to eq "Kv%252Bo2XXL%252F9RxkQW3lO3QTVlH%26QllSuL9eQ5FXFO1Z%252FHcgL4ON"
65
65
  end
66
66
  end
@@ -51,9 +51,9 @@ Lw03eHTNQghS0A==
51
51
  token_credential_secret = "pfkkdhi9sl3r4s00"
52
52
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
53
53
 
54
- Signet::OAuth1::RSASHA1.generate_signature(
54
+ expect(Signet::OAuth1::RSASHA1.generate_signature(
55
55
  base_string, client_credential_secret, token_credential_secret
56
- ).should == "P72T4RS8dVBneQPJSY71D3iLEjge2tiivxEasPVoaoDldDgPdwpQfhS1q0th19jB3B3+9P6tBWjpWaVPxrNZe3ssBCiwS/EmXZ/6VCJGU3YoDHMtz+0jCd36NjHj5I6TpLVQ8/rtfy6+EzpdUMz7ydnhKXYqJFPOWnNv8HM1W7I="
56
+ )).to eq "P72T4RS8dVBneQPJSY71D3iLEjge2tiivxEasPVoaoDldDgPdwpQfhS1q0th19jB3B3+9P6tBWjpWaVPxrNZe3ssBCiwS/EmXZ/6VCJGU3YoDHMtz+0jCd36NjHj5I6TpLVQ8/rtfy6+EzpdUMz7ydnhKXYqJFPOWnNv8HM1W7I="
57
57
  end
58
58
  end
59
59
 
@@ -89,9 +89,9 @@ Lw03eHTNQghS0A==
89
89
  token_credential_secret = "pfkkdhi9sl3r4s00"
90
90
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
91
91
 
92
- Signet::OAuth1::RSASHA1.generate_signature(
92
+ expect(Signet::OAuth1::RSASHA1.generate_signature(
93
93
  base_string, client_credential_secret, token_credential_secret
94
- ).should == "jvTp/wX1TYtByB1m+Pbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2/9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW//e+RinhejgCuzoH26dyF8iY2ZZ/5D1ilgeijhV/vBka5twt399mXwaYdCwFYE="
94
+ )).to eq "jvTp/wX1TYtByB1m+Pbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2/9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW//e+RinhejgCuzoH26dyF8iY2ZZ/5D1ilgeijhV/vBka5twt399mXwaYdCwFYE="
95
95
  end
96
96
 
97
97
 
@@ -124,9 +124,9 @@ Lw03eHTNQghS0A==
124
124
  -----END PRIVATE KEY-----"
125
125
  token_credential_secret = "QllSuL9eQ5FXFO1Z/HcgL4ON"
126
126
  base_string = Signet::OAuth1.generate_base_string(method, uri, parameters)
127
- Signet::OAuth1::RSASHA1.generate_signature(
127
+ expect(Signet::OAuth1::RSASHA1.generate_signature(
128
128
  base_string, client_credential_secret, token_credential_secret
129
- ).should == "Q1O7Ovi0jdacl/OTJoH3MAyOO/9H/tTXmoJzP/YqiKEJ+/wfShXo1RXX0xmlcjDR1XYxB1RMgHkFWQYYwz1qGCUhkXlH1c/to2qxPksptfPHRe7PJTxRClrdqLFOlhN7w2kO7tHVCeEp8IJIKON9q7cdXroTP7ctPPS+Q883SS0="
129
+ )).to eq "Q1O7Ovi0jdacl/OTJoH3MAyOO/9H/tTXmoJzP/YqiKEJ+/wfShXo1RXX0xmlcjDR1XYxB1RMgHkFWQYYwz1qGCUhkXlH1c/to2qxPksptfPHRe7PJTxRClrdqLFOlhN7w2kO7tHVCeEp8IJIKON9q7cdXroTP7ctPPS+Q883SS0="
130
130
  end
131
131
 
132
132
  end