{"action":"created","comment":{"url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/comments/27458555","id":27458555,"diff_hunk":"@@ -0,0 +1,57 @@\n+require 'spec_helper'\n+\n+require 'securerandom'\n+\n+RSpec.describe OpenIDTokenProxy::Client do\n+  subject { described_class.new config }\n+  let(:config) { OpenIDTokenProxy::Config.new }\n+\n+  describe '#config' do\n+    it 'defaults to Config.instance' do\n+      client = described_class.new\n+      expect(client.config).to eq OpenIDTokenProxy::Config.instance\n+    end\n+\n+    it 'may be given explicitly' do\n+      expect(subject.config).to eq config\n+    end\n+  end\n+\n+  describe '#authorization_uri' do\n+    it 'may be explicitly set through environment' do\n+      stub_env('OPENID_AUTHORIZATION_URI', 'from env')\n+      expect(subject.authorization_uri).to eq 'from env'\n+    end\n+\n+    context 'when resource given' do\n+      it 'defaults to OpenID authorization URI' do\n+        authorization_uri = subject.authorization_uri\n+        expect(authorization_uri).not_to be_blank\n+        expect(authorization_uri).not_to include 'resource='\n+        expect(authorization_uri).not_to include 'redirect_uri='\n+      end\n+    end\n+\n+    context 'when resource given' do\n+      it 'includes resource' do\n+        config.resource = id = SecureRandom.hex\n+        expect(subject.authorization_uri).to include \"resource=#{id}\"\n+      end\n+    end\n+\n+    context 'when redirect_uri given' do\n+      it 'includes redirect_uri' do\n+        config.redirect_uri = id = SecureRandom.hex\n+        expect(subject.authorization_uri).to include \"redirect_uri=#{id}\"\n+      end\n+    end\n+  end\n+\n+  describe '::instance' do\n+    it 'returns global client' do\n+      instance = described_class.instance\n+      expect(instance).to eq described_class.instance\n+      expect(instance).to be_a described_class","path":"spec/lib/openid_token_proxy/client_spec.rb","position":54,"original_position":54,"commit_id":"dd2855b528d86fda85b87e80340ae2fffec8a654","original_commit_id":"dd2855b528d86fda85b87e80340ae2fffec8a654","user":{"login":"timkurvers","id":378235,"avatar_url":"https://avatars.githubusercontent.com/u/378235?v=3","gravatar_id":"","url":"https://api.github.com/users/timkurvers","html_url":"https://github.com/timkurvers","followers_url":"https://api.github.com/users/timkurvers/followers","following_url":"https://api.github.com/users/timkurvers/following{/other_user}","gists_url":"https://api.github.com/users/timkurvers/gists{/gist_id}","starred_url":"https://api.github.com/users/timkurvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkurvers/subscriptions","organizations_url":"https://api.github.com/users/timkurvers/orgs","repos_url":"https://api.github.com/users/timkurvers/repos","events_url":"https://api.github.com/users/timkurvers/events{/privacy}","received_events_url":"https://api.github.com/users/timkurvers/received_events","type":"User","site_admin":false},"body":"https://www.omniref.com/blog/blog/2014/11/17/matz-at-rubyconf-2014-will-ruby-3-dot-0-be-statically-typed/ :open_mouth: ","created_at":"2015-03-31T07:51:37Z","updated_at":"2015-03-31T07:51:37Z","html_url":"https://github.com/hyperoslo/openid-token-proxy/pull/7#discussion_r27458555","pull_request_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/comments/27458555"},"html":{"href":"https://github.com/hyperoslo/openid-token-proxy/pull/7#discussion_r27458555"},"pull_request":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7","id":32225373,"html_url":"https://github.com/hyperoslo/openid-token-proxy/pull/7","diff_url":"https://github.com/hyperoslo/openid-token-proxy/pull/7.diff","patch_url":"https://github.com/hyperoslo/openid-token-proxy/pull/7.patch","issue_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/7","number":7,"state":"open","locked":false,"title":"Add initial client","user":{"login":"timkurvers","id":378235,"avatar_url":"https://avatars.githubusercontent.com/u/378235?v=3","gravatar_id":"","url":"https://api.github.com/users/timkurvers","html_url":"https://github.com/timkurvers","followers_url":"https://api.github.com/users/timkurvers/followers","following_url":"https://api.github.com/users/timkurvers/following{/other_user}","gists_url":"https://api.github.com/users/timkurvers/gists{/gist_id}","starred_url":"https://api.github.com/users/timkurvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timkurvers/subscriptions","organizations_url":"https://api.github.com/users/timkurvers/orgs","repos_url":"https://api.github.com/users/timkurvers/repos","events_url":"https://api.github.com/users/timkurvers/events{/privacy}","received_events_url":"https://api.github.com/users/timkurvers/received_events","type":"User","site_admin":false},"body":"This currently relies on some ENV variables, will add them to Travis.","created_at":"2015-03-30T13:20:34Z","updated_at":"2015-03-31T07:51:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36a0244d113ad7d1ece32af53f19c73a73566e8a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7/commits","review_comments_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7/comments","review_comment_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/7/comments","statuses_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/statuses/dd2855b528d86fda85b87e80340ae2fffec8a654","head":{"label":"hyperoslo:feature/client","ref":"feature/client","sha":"dd2855b528d86fda85b87e80340ae2fffec8a654","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":32930678,"name":"openid-token-proxy","full_name":"hyperoslo/openid-token-proxy","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/openid-token-proxy","description":"Retrieves and refreshes OpenID tokens on behalf of a user when dealing with complex authentication schemes, such as client-side certificates","fork":false,"url":"https://api.github.com/repos/hyperoslo/openid-token-proxy","forks_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/forks","keys_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/teams","hooks_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/events","assignees_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/tags","blobs_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/subscription","commits_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/merges","archive_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/downloads","issues_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/releases{/id}","created_at":"2015-03-26T14:01:57Z","updated_at":"2015-03-30T14:25:03Z","pushed_at":"2015-03-30T14:25:04Z","git_url":"git://github.com/hyperoslo/openid-token-proxy.git","ssh_url":"git@github.com:hyperoslo/openid-token-proxy.git","clone_url":"https://github.com/hyperoslo/openid-token-proxy.git","svn_url":"https://github.com/hyperoslo/openid-token-proxy","homepage":"","size":0,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"hyperoslo:master","ref":"master","sha":"7ff57ad4418cf322183e612b22dabd8bafd558cb","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":32930678,"name":"openid-token-proxy","full_name":"hyperoslo/openid-token-proxy","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=3","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/openid-token-proxy","description":"Retrieves and refreshes OpenID tokens on behalf of a user when dealing with complex authentication schemes, such as client-side certificates","fork":false,"url":"https://api.github.com/repos/hyperoslo/openid-token-proxy","forks_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/forks","keys_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/teams","hooks_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/events","assignees_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/tags","blobs_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/subscription","commits_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/merges","archive_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/downloads","issues_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/openid-token-proxy/releases{/id}","created_at":"2015-03-26T14:01:57Z","updated_at":"2015-03-30T14:25:03Z","pushed_at":"2015-03-30T14:25:04Z","git_url":"git://github.com/hyperoslo/openid-token-proxy.git","ssh_url":"git@github.com:hyperoslo/openid-token-proxy.git","clone_url":"https://github.com/hyperoslo/openid-token-proxy.git","svn_url":"https://github.com/hyperoslo/openid-token-proxy","homepage":"","size":0,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7"},"html":{"href":"https://github.com/hyperoslo/openid-token-proxy/pull/7"},"issue":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/7"},"comments":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/hyperoslo/openid-token-proxy/statuses/dd2855b528d86fda85b87e80340ae2fffec8a654"}}}}