Skip to content

Commit

Permalink
Use the stack for .root because it's not a ❄️
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwynn committed Nov 14, 2013
1 parent 4d3ac13 commit 0c8d96a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/octokit/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def agent
#
# @return [Sawyer::Resource]
def root
agent.start.data
get "/"
end

# Response for last HTTP request
Expand Down
11 changes: 10 additions & 1 deletion spec/octokit/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
assert_requested :get, github_url('/user')
end
end
describe "when application authenticated", :vcr do
describe "when application authenticated" do
it "makes authenticated calls" do
client = Octokit.client
client.client_id = '97b4937b385eb63d1f46'
Expand Down Expand Up @@ -257,6 +257,15 @@
expect(root.rels[:issues].href).to eq "https://api.github.com/issues"
end
end

it "passes app creds in the query string" do
root_request = stub_get("/?client_id=97b4937b385eb63d1f46&client_secret=d255197b4937b385eb63d1f4677e3ffee61fbaea")
client = Octokit.client
client.client_id = '97b4937b385eb63d1f46'
client.client_secret = 'd255197b4937b385eb63d1f4677e3ffee61fbaea'
client.root
assert_requested root_request
end
end

describe ".last_response", :vcr do
Expand Down

0 comments on commit 0c8d96a

Please sign in to comment.