{"action":"created","comment":{"url":"https://api.github.com/repos/3scale/apisonator/pulls/comments/223648694","pull_request_review_id":162824166,"id":223648694,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzY0ODY5NA==","diff_hunk":"@@ -78,6 +78,31 @@ module Transactor\n                 expect(result).to eq expected\n               end\n             end\n+\n+            context 'and one of them has a remaining of 0' do\n+              let(:time) { Time.now.utc }\n+\n+              let(:report_with_some_remaining) do\n+                double(period: Period::Day.new(time),","path":"spec/unit/limit_headers_spec.rb","position":9,"original_position":9,"commit_id":"e2128fce261bfacb7bc79397eba24f90c4444030","original_commit_id":"e2128fce261bfacb7bc79397eba24f90c4444030","user":{"login":"mikz","id":154571,"node_id":"MDQ6VXNlcjE1NDU3MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/154571?v=4","gravatar_id":"","url":"https://api.github.com/users/mikz","html_url":"https://github.com/mikz","followers_url":"https://api.github.com/users/mikz/followers","following_url":"https://api.github.com/users/mikz/following{/other_user}","gists_url":"https://api.github.com/users/mikz/gists{/gist_id}","starred_url":"https://api.github.com/users/mikz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikz/subscriptions","organizations_url":"https://api.github.com/users/mikz/orgs","repos_url":"https://api.github.com/users/mikz/repos","events_url":"https://api.github.com/users/mikz/events{/privacy}","received_events_url":"https://api.github.com/users/mikz/received_events","type":"User","site_admin":false},"body":"From rspec-mock view, I think is is really, really necessary to use object/instance mocks and turn on their verification to prevent them going stale:\r\n\r\nhttps://relishapp.com/rspec/rspec-mocks/v/3-8/docs/verifying-doubles/using-an-object-double\r\nhttps://relishapp.com/rspec/rspec-mocks/v/3-8/docs/verifying-doubles/using-an-instance-double\r\n\r\nIf it is too much trouble to set up, ok, but something to bear in mind. When using mocks it is super important to verify the mocked interface.","created_at":"2018-10-09T10:44:29Z","updated_at":"2018-10-09T10:49:50Z","html_url":"https://github.com/3scale/apisonator/pull/55#discussion_r223648694","pull_request_url":"https://api.github.com/repos/3scale/apisonator/pulls/55","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/comments/223648694"},"html":{"href":"https://github.com/3scale/apisonator/pull/55#discussion_r223648694"},"pull_request":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/3scale/apisonator/pulls/55","id":221387962,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxMzg3OTYy","html_url":"https://github.com/3scale/apisonator/pull/55","diff_url":"https://github.com/3scale/apisonator/pull/55.diff","patch_url":"https://github.com/3scale/apisonator/pull/55.patch","issue_url":"https://api.github.com/repos/3scale/apisonator/issues/55","number":55,"state":"open","locked":false,"title":"Fix rate-limit headers information when rate-limited","user":{"login":"davidor","id":907223,"node_id":"MDQ6VXNlcjkwNzIyMw==","avatar_url":"https://avatars2.githubusercontent.com/u/907223?v=4","gravatar_id":"","url":"https://api.github.com/users/davidor","html_url":"https://github.com/davidor","followers_url":"https://api.github.com/users/davidor/followers","following_url":"https://api.github.com/users/davidor/following{/other_user}","gists_url":"https://api.github.com/users/davidor/gists{/gist_id}","starred_url":"https://api.github.com/users/davidor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidor/subscriptions","organizations_url":"https://api.github.com/users/davidor/orgs","repos_url":"https://api.github.com/users/davidor/repos","events_url":"https://api.github.com/users/davidor/events{/privacy}","received_events_url":"https://api.github.com/users/davidor/received_events","type":"User","site_admin":false},"body":"Fixes #54 \r\n\r\nThe problem is that when calculating the remaining quota for a `usage_report`, we were taking into account the information from the `status`. In particular, we were returning a remaining of 0 if the status was not authorized. \r\n\r\nSuppose that we have several `usage_reports` for the same `status`. If the status is unauthorized, all of them with return a remaining of 0. This is a problem because we cannot properly compare them to figure out which one of them is causing the \"unauthorized\" status. We could have a report that goes over limits and another that does not.","created_at":"2018-10-09T10:34:32Z","updated_at":"2018-10-09T10:49:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6413f1dad65b22878237843d8e5fafc198dcdf9e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"eguzki","id":881529,"node_id":"MDQ6VXNlcjg4MTUyOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/881529?v=4","gravatar_id":"","url":"https://api.github.com/users/eguzki","html_url":"https://github.com/eguzki","followers_url":"https://api.github.com/users/eguzki/followers","following_url":"https://api.github.com/users/eguzki/following{/other_user}","gists_url":"https://api.github.com/users/eguzki/gists{/gist_id}","starred_url":"https://api.github.com/users/eguzki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eguzki/subscriptions","organizations_url":"https://api.github.com/users/eguzki/orgs","repos_url":"https://api.github.com/users/eguzki/repos","events_url":"https://api.github.com/users/eguzki/events{/privacy}","received_events_url":"https://api.github.com/users/eguzki/received_events","type":"User","site_admin":false},{"login":"miguelsorianod","id":37954906,"node_id":"MDQ6VXNlcjM3OTU0OTA2","avatar_url":"https://avatars3.githubusercontent.com/u/37954906?v=4","gravatar_id":"","url":"https://api.github.com/users/miguelsorianod","html_url":"https://github.com/miguelsorianod","followers_url":"https://api.github.com/users/miguelsorianod/followers","following_url":"https://api.github.com/users/miguelsorianod/following{/other_user}","gists_url":"https://api.github.com/users/miguelsorianod/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelsorianod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelsorianod/subscriptions","organizations_url":"https://api.github.com/users/miguelsorianod/orgs","repos_url":"https://api.github.com/users/miguelsorianod/repos","events_url":"https://api.github.com/users/miguelsorianod/events{/privacy}","received_events_url":"https://api.github.com/users/miguelsorianod/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/3scale/apisonator/pulls/55/commits","review_comments_url":"https://api.github.com/repos/3scale/apisonator/pulls/55/comments","review_comment_url":"https://api.github.com/repos/3scale/apisonator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/3scale/apisonator/issues/55/comments","statuses_url":"https://api.github.com/repos/3scale/apisonator/statuses/e2128fce261bfacb7bc79397eba24f90c4444030","head":{"label":"3scale:fix-rate-limit-headers","ref":"fix-rate-limit-headers","sha":"e2128fce261bfacb7bc79397eba24f90c4444030","user":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":119402246,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk0MDIyNDY=","name":"apisonator","full_name":"3scale/apisonator","private":false,"owner":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/3scale/apisonator","description":"Red Hat 3scale API Management Apisonator backend","fork":false,"url":"https://api.github.com/repos/3scale/apisonator","forks_url":"https://api.github.com/repos/3scale/apisonator/forks","keys_url":"https://api.github.com/repos/3scale/apisonator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/apisonator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/apisonator/teams","hooks_url":"https://api.github.com/repos/3scale/apisonator/hooks","issue_events_url":"https://api.github.com/repos/3scale/apisonator/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/apisonator/events","assignees_url":"https://api.github.com/repos/3scale/apisonator/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/apisonator/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/apisonator/tags","blobs_url":"https://api.github.com/repos/3scale/apisonator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/apisonator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/apisonator/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/apisonator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/apisonator/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/apisonator/languages","stargazers_url":"https://api.github.com/repos/3scale/apisonator/stargazers","contributors_url":"https://api.github.com/repos/3scale/apisonator/contributors","subscribers_url":"https://api.github.com/repos/3scale/apisonator/subscribers","subscription_url":"https://api.github.com/repos/3scale/apisonator/subscription","commits_url":"https://api.github.com/repos/3scale/apisonator/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/apisonator/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/apisonator/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/apisonator/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/apisonator/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/apisonator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/apisonator/merges","archive_url":"https://api.github.com/repos/3scale/apisonator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/apisonator/downloads","issues_url":"https://api.github.com/repos/3scale/apisonator/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/apisonator/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/apisonator/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/apisonator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/apisonator/labels{/name}","releases_url":"https://api.github.com/repos/3scale/apisonator/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/apisonator/deployments","created_at":"2018-01-29T15:37:15Z","updated_at":"2018-09-27T13:33:26Z","pushed_at":"2018-10-09T10:34:33Z","git_url":"git://github.com/3scale/apisonator.git","ssh_url":"git@github.com:3scale/apisonator.git","clone_url":"https://github.com/3scale/apisonator.git","svn_url":"https://github.com/3scale/apisonator","homepage":"https://3scale.net","size":3191,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":3,"open_issues":7,"watchers":15,"default_branch":"master"}},"base":{"label":"3scale:master","ref":"master","sha":"fe2bd23fe970e44f42c3ba3ff1a556be6f8043fb","user":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"repo":{"id":119402246,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk0MDIyNDY=","name":"apisonator","full_name":"3scale/apisonator","private":false,"owner":{"login":"3scale","id":21415,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxNDE1","avatar_url":"https://avatars0.githubusercontent.com/u/21415?v=4","gravatar_id":"","url":"https://api.github.com/users/3scale","html_url":"https://github.com/3scale","followers_url":"https://api.github.com/users/3scale/followers","following_url":"https://api.github.com/users/3scale/following{/other_user}","gists_url":"https://api.github.com/users/3scale/gists{/gist_id}","starred_url":"https://api.github.com/users/3scale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3scale/subscriptions","organizations_url":"https://api.github.com/users/3scale/orgs","repos_url":"https://api.github.com/users/3scale/repos","events_url":"https://api.github.com/users/3scale/events{/privacy}","received_events_url":"https://api.github.com/users/3scale/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/3scale/apisonator","description":"Red Hat 3scale API Management Apisonator backend","fork":false,"url":"https://api.github.com/repos/3scale/apisonator","forks_url":"https://api.github.com/repos/3scale/apisonator/forks","keys_url":"https://api.github.com/repos/3scale/apisonator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3scale/apisonator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3scale/apisonator/teams","hooks_url":"https://api.github.com/repos/3scale/apisonator/hooks","issue_events_url":"https://api.github.com/repos/3scale/apisonator/issues/events{/number}","events_url":"https://api.github.com/repos/3scale/apisonator/events","assignees_url":"https://api.github.com/repos/3scale/apisonator/assignees{/user}","branches_url":"https://api.github.com/repos/3scale/apisonator/branches{/branch}","tags_url":"https://api.github.com/repos/3scale/apisonator/tags","blobs_url":"https://api.github.com/repos/3scale/apisonator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3scale/apisonator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3scale/apisonator/git/refs{/sha}","trees_url":"https://api.github.com/repos/3scale/apisonator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3scale/apisonator/statuses/{sha}","languages_url":"https://api.github.com/repos/3scale/apisonator/languages","stargazers_url":"https://api.github.com/repos/3scale/apisonator/stargazers","contributors_url":"https://api.github.com/repos/3scale/apisonator/contributors","subscribers_url":"https://api.github.com/repos/3scale/apisonator/subscribers","subscription_url":"https://api.github.com/repos/3scale/apisonator/subscription","commits_url":"https://api.github.com/repos/3scale/apisonator/commits{/sha}","git_commits_url":"https://api.github.com/repos/3scale/apisonator/git/commits{/sha}","comments_url":"https://api.github.com/repos/3scale/apisonator/comments{/number}","issue_comment_url":"https://api.github.com/repos/3scale/apisonator/issues/comments{/number}","contents_url":"https://api.github.com/repos/3scale/apisonator/contents/{+path}","compare_url":"https://api.github.com/repos/3scale/apisonator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3scale/apisonator/merges","archive_url":"https://api.github.com/repos/3scale/apisonator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3scale/apisonator/downloads","issues_url":"https://api.github.com/repos/3scale/apisonator/issues{/number}","pulls_url":"https://api.github.com/repos/3scale/apisonator/pulls{/number}","milestones_url":"https://api.github.com/repos/3scale/apisonator/milestones{/number}","notifications_url":"https://api.github.com/repos/3scale/apisonator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3scale/apisonator/labels{/name}","releases_url":"https://api.github.com/repos/3scale/apisonator/releases{/id}","deployments_url":"https://api.github.com/repos/3scale/apisonator/deployments","created_at":"2018-01-29T15:37:15Z","updated_at":"2018-09-27T13:33:26Z","pushed_at":"2018-10-09T10:34:33Z","git_url":"git://github.com/3scale/apisonator.git","ssh_url":"git@github.com:3scale/apisonator.git","clone_url":"https://github.com/3scale/apisonator.git","svn_url":"https://github.com/3scale/apisonator","homepage":"https://3scale.net","size":3191,"stargazers_count":15,"watchers_count":15,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":3,"open_issues":7,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/55"},"html":{"href":"https://github.com/3scale/apisonator/pull/55"},"issue":{"href":"https://api.github.com/repos/3scale/apisonator/issues/55"},"comments":{"href":"https://api.github.com/repos/3scale/apisonator/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/3scale/apisonator/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/3scale/apisonator/statuses/e2128fce261bfacb7bc79397eba24f90c4444030"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mikz"}}