Skip to content

Commit 90fdee9

Browse files
committed
Fix tests
1 parent 6343c9f commit 90fdee9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

spec/unit/endpoint/authorization_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@
4848
end
4949

5050
describe 'evil hackers messing with the state' do
51+
before do
52+
WebMock.stub_request(:post, "https://foobar.com/access_token_path").
53+
with(
54+
body: "{\"client_id\":\"client-id\",\"scope\":\"public_repo,user:email,new_scope\",\"redirect_uri\":\"http://example.org/auth/handshake\",\"state\":\"github-state\",\"code\":\"oauth-code\",\"client_secret\":\"client-secret\"}",
55+
headers: {
56+
'Accept' => '*/*',
57+
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
58+
'Connection' => 'keep-alive',
59+
'Content-Type' => 'application/json',
60+
'Keep-Alive' => '30',
61+
'User-Agent' => 'Faraday v0.17.3'
62+
}).
63+
to_return(status: 200, body: "", headers: {})
64+
end
65+
5166
it 'does not succeed if state cookie mismatches' do
5267
Travis.redis.sadd('github:states', 'github-state')
5368
response = get '/auth/handshake?state=github-state&code=oauth-code'

0 commit comments

Comments
 (0)