|
19 | 19 | end |
20 | 20 |
|
21 | 21 | it "builds the correct request" do |
22 | | - subject.exchange_authorization_for_token(code, client_id, client_secret, state: state) |
| 22 | + subject.exchange_authorization_for_token(code, client_id, client_secret, state:) |
23 | 23 |
|
24 | 24 | expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token") |
25 | | - .with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, grant_type: "authorization_code" }) |
| 25 | + .with(body: { client_id:, client_secret:, code:, state:, grant_type: "authorization_code" }) |
26 | 26 | .with(headers: { "Accept" => "application/json" }) |
27 | 27 | end |
28 | 28 |
|
29 | 29 | it "returns oauth token" do |
30 | | - result = subject.exchange_authorization_for_token(code, client_id, client_secret, state: state) |
| 30 | + result = subject.exchange_authorization_for_token(code, client_id, client_secret, state:) |
31 | 31 |
|
32 | 32 | expect(result).to be_a(Dnsimple::Struct::OauthToken) |
33 | 33 | expect(result.access_token).to eq("zKQ7OLqF5N1gylcJweA9WodA000BUNJD") |
|
39 | 39 | let(:redirect_uri) { "super-redirect-uri" } |
40 | 40 |
|
41 | 41 | it "builds the correct request" do |
42 | | - subject.exchange_authorization_for_token(code, client_id, client_secret, state: state, redirect_uri: redirect_uri) |
| 42 | + subject.exchange_authorization_for_token(code, client_id, client_secret, state:, redirect_uri:) |
43 | 43 |
|
44 | 44 | expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token") |
45 | | - .with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, redirect_uri: redirect_uri, grant_type: "authorization_code" }) |
| 45 | + .with(body: { client_id:, client_secret:, code:, state:, redirect_uri:, grant_type: "authorization_code" }) |
46 | 46 | .with(headers: { "Accept" => "application/json" }) |
47 | 47 | end |
48 | 48 | end |
|
55 | 55 |
|
56 | 56 | it "raises OAuthInvalidRequestError" do |
57 | 57 | expect { |
58 | | - subject.exchange_authorization_for_token(code, client_id, client_secret, state: state) |
| 58 | + subject.exchange_authorization_for_token(code, client_id, client_secret, state:) |
59 | 59 | }.to raise_error(Dnsimple::OAuthInvalidRequestError) do |e| |
60 | 60 | error = "invalid_request" |
61 | 61 | error_description = "Invalid \"state\": value doesn't match the \"state\" in the authorization request" |
|
0 commit comments