{"action":"created","comment":{"url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/comments/62544957","id":62544957,"diff_hunk":"@@ -12,127 +12,131 @@\n \n module Cb\n   describe ResponseValidator do\n-    let(:response)          { double(HTTParty::Response) }\n-    let(:response_property) { double('HTTParty::Response.response') }\n+    let(:response)          { double(HTTParty::Response, response: response_property, code: response_code) }\n+    let(:response_property) { double('HTTParty::Response.response', body: response_body) }\n+    let(:response_body)     { nil }\n+    let(:response_code)     { 200 }\n \n-    before :each do\n-      allow(response).to receive(:response).and_return(response_property)\n-      allow(response).to receive(:code).and_return(200)\n-    end\n+    subject(:validation) { ResponseValidator.validate(response) }\n \n-    it 'should return empty hash when body is empty' do\n-      allow(response.response).to receive(:body).and_return('')\n-      validation = ResponseValidator.validate(response)\n-      expect(validation.empty?).to be_truthy\n-    end\n+    context 'with an empty body' do\n+      let(:response_body) { '' }\n \n-    it 'should return empty hash when body is improper json/xml' do\n-      allow(response.response).to receive(:body).and_return('json')\n-      validation = ResponseValidator.validate(response)\n-      expect(validation.empty?).to be_truthy\n+      it 'returns an empty hash' do\n+        expect(validation).to be_empty\n+      end\n     end\n \n-    it 'should return empty hash when response is nil' do\n-      response = nil\n-      validation = ResponseValidator.validate(response)\n-      expect(validation.empty?).to be_truthy\n-    end\n+    context 'with an invalid body' do\n+      let(:response_body) { 'json' }\n \n-    it 'should raise DocumentNotFound error if url is invalid' do\n-      allow(response.response).to receive(:body).and_return('<!DOCTYPE html></html>')\n-      allow(response).to receive(:code).and_return 404\n-      expect { ResponseValidator.validate(response) }.to raise_error(Cb::DocumentNotFoundError)\n+      it 'returns an empty hash' do\n+        expect(validation).to be_empty\n+      end\n     end\n \n-    it 'should return a full json hash when response status is not 200 and content is json' do\n-      allow(response.response).to receive(:body).and_return('{\"TestJson\":{\"Test\":\"True\"}}')\n-      validation = ResponseValidator.validate(response)\n-      expect(validation.empty?).to be_falsey\n-    end\n+    context 'with a nil body' do\n+      let(:response_body) { nil }\n \n-    it 'should return a blank json hash when status is not 200 and content is html' do\n-      allow(response.response).to receive(:body).and_return('<!DOCTYPE html></html>')\n-      validation = ResponseValidator.validate(response)\n-      expect(validation.empty?).to be_truthy\n+      it 'returns an empty hash' do\n+        expect(validation).to be_empty\n+      end\n     end\n \n-    context 'raises a ServiceUnavailableError' do\n-      it 'when status code is 503' do\n-        allow(response.response).to receive(:body).and_return('{\"errors\":[]}')\n-        allow(response).to receive(:code).and_return 503\n-        expect { ResponseValidator.validate(response) }.to raise_error(Cb::ServiceUnavailableError)\n+    context 'with an unsuccessful response status' do\n+      let(:response_code) { 500 }","path":"spec/cb/utils/validator_spec.rb","position":74,"original_position":74,"commit_id":"4208c92284f751190ce5ded1962acea9bbb116fd","original_commit_id":"4208c92284f751190ce5ded1962acea9bbb116fd","user":{"login":"oochelz","id":1957170,"avatar_url":"https://avatars.githubusercontent.com/u/1957170?v=3","gravatar_id":"","url":"https://api.github.com/users/oochelz","html_url":"https://github.com/oochelz","followers_url":"https://api.github.com/users/oochelz/followers","following_url":"https://api.github.com/users/oochelz/following{/other_user}","gists_url":"https://api.github.com/users/oochelz/gists{/gist_id}","starred_url":"https://api.github.com/users/oochelz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oochelz/subscriptions","organizations_url":"https://api.github.com/users/oochelz/orgs","repos_url":"https://api.github.com/users/oochelz/repos","events_url":"https://api.github.com/users/oochelz/events{/privacy}","received_events_url":"https://api.github.com/users/oochelz/received_events","type":"User","site_admin":false},"body":"Why set this if all other tests overwrite it?","created_at":"2016-05-09T18:08:21Z","updated_at":"2016-05-09T18:08:21Z","html_url":"https://github.com/careerbuilder/ruby-cb-api/pull/257#discussion_r62544957","pull_request_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257","_links":{"self":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/comments/62544957"},"html":{"href":"https://github.com/careerbuilder/ruby-cb-api/pull/257#discussion_r62544957"},"pull_request":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257"}}},"pull_request":{"url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257","id":69384341,"html_url":"https://github.com/careerbuilder/ruby-cb-api/pull/257","diff_url":"https://github.com/careerbuilder/ruby-cb-api/pull/257.diff","patch_url":"https://github.com/careerbuilder/ruby-cb-api/pull/257.patch","issue_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/257","number":257,"state":"open","locked":false,"title":"Refactor validator specs","user":{"login":"Casao","id":648055,"avatar_url":"https://avatars.githubusercontent.com/u/648055?v=3","gravatar_id":"","url":"https://api.github.com/users/Casao","html_url":"https://github.com/Casao","followers_url":"https://api.github.com/users/Casao/followers","following_url":"https://api.github.com/users/Casao/following{/other_user}","gists_url":"https://api.github.com/users/Casao/gists{/gist_id}","starred_url":"https://api.github.com/users/Casao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Casao/subscriptions","organizations_url":"https://api.github.com/users/Casao/orgs","repos_url":"https://api.github.com/users/Casao/repos","events_url":"https://api.github.com/users/Casao/events{/privacy}","received_events_url":"https://api.github.com/users/Casao/received_events","type":"User","site_admin":false},"body":"Refactors a gnarly spec with a lot of in-test setup (and multiple descriptions that outright lie).","created_at":"2016-05-09T17:55:42Z","updated_at":"2016-05-09T18:08:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7378d3b5501692db2a5ba0c05c3bdc7a94e85fb5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257/commits","review_comments_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257/comments","review_comment_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/257/comments","statuses_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/statuses/4208c92284f751190ce5ded1962acea9bbb116fd","head":{"label":"careerbuilder:refactor-validator-spec","ref":"refactor-validator-spec","sha":"4208c92284f751190ce5ded1962acea9bbb116fd","user":{"login":"careerbuilder","id":1043090,"avatar_url":"https://avatars.githubusercontent.com/u/1043090?v=3","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"repo":{"id":7954699,"name":"ruby-cb-api","full_name":"careerbuilder/ruby-cb-api","owner":{"login":"careerbuilder","id":1043090,"avatar_url":"https://avatars.githubusercontent.com/u/1043090?v=3","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/careerbuilder/ruby-cb-api","description":"Ruby wrapper around the CareerBuilder.com APIs","fork":false,"url":"https://api.github.com/repos/careerbuilder/ruby-cb-api","forks_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/forks","keys_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/teams","hooks_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/hooks","issue_events_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/events{/number}","events_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/events","assignees_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/assignees{/user}","branches_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/branches{/branch}","tags_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/tags","blobs_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/statuses/{sha}","languages_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/languages","stargazers_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/stargazers","contributors_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/contributors","subscribers_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/subscribers","subscription_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/subscription","commits_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/contents/{+path}","compare_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/merges","archive_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/downloads","issues_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues{/number}","pulls_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls{/number}","milestones_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/milestones{/number}","notifications_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/labels{/name}","releases_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/releases{/id}","deployments_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/deployments","created_at":"2013-02-01T08:44:41Z","updated_at":"2016-02-01T22:47:44Z","pushed_at":"2016-05-09T18:06:08Z","git_url":"git://github.com/careerbuilder/ruby-cb-api.git","ssh_url":"git@github.com:careerbuilder/ruby-cb-api.git","clone_url":"https://github.com/careerbuilder/ruby-cb-api.git","svn_url":"https://github.com/careerbuilder/ruby-cb-api","homepage":"","size":2474,"stargazers_count":9,"watchers_count":9,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":1,"forks":13,"open_issues":1,"watchers":9,"default_branch":"master"}},"base":{"label":"careerbuilder:master","ref":"master","sha":"d027295fa96496c8d282d3a9a79e16f30c5cb964","user":{"login":"careerbuilder","id":1043090,"avatar_url":"https://avatars.githubusercontent.com/u/1043090?v=3","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"repo":{"id":7954699,"name":"ruby-cb-api","full_name":"careerbuilder/ruby-cb-api","owner":{"login":"careerbuilder","id":1043090,"avatar_url":"https://avatars.githubusercontent.com/u/1043090?v=3","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/careerbuilder/ruby-cb-api","description":"Ruby wrapper around the CareerBuilder.com APIs","fork":false,"url":"https://api.github.com/repos/careerbuilder/ruby-cb-api","forks_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/forks","keys_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/teams","hooks_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/hooks","issue_events_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/events{/number}","events_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/events","assignees_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/assignees{/user}","branches_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/branches{/branch}","tags_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/tags","blobs_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/statuses/{sha}","languages_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/languages","stargazers_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/stargazers","contributors_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/contributors","subscribers_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/subscribers","subscription_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/subscription","commits_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/contents/{+path}","compare_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/merges","archive_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/downloads","issues_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues{/number}","pulls_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls{/number}","milestones_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/milestones{/number}","notifications_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/labels{/name}","releases_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/releases{/id}","deployments_url":"https://api.github.com/repos/careerbuilder/ruby-cb-api/deployments","created_at":"2013-02-01T08:44:41Z","updated_at":"2016-02-01T22:47:44Z","pushed_at":"2016-05-09T18:06:08Z","git_url":"git://github.com/careerbuilder/ruby-cb-api.git","ssh_url":"git@github.com:careerbuilder/ruby-cb-api.git","clone_url":"https://github.com/careerbuilder/ruby-cb-api.git","svn_url":"https://github.com/careerbuilder/ruby-cb-api","homepage":"","size":2474,"stargazers_count":9,"watchers_count":9,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":1,"forks":13,"open_issues":1,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257"},"html":{"href":"https://github.com/careerbuilder/ruby-cb-api/pull/257"},"issue":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/257"},"comments":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/issues/257/comments"},"review_comments":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257/comments"},"review_comment":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/pulls/257/commits"},"statuses":{"href":"https://api.github.com/repos/careerbuilder/ruby-cb-api/statuses/4208c92284f751190ce5ded1962acea9bbb116fd"}}}}