{"action":"opened","number":8,"pull_request":{"url":"https://api.github.com/repos/alto/assert_json/pulls/8","id":33612598,"html_url":"https://github.com/alto/assert_json/pull/8","diff_url":"https://github.com/alto/assert_json/pull/8.diff","patch_url":"https://github.com/alto/assert_json/pull/8.patch","issue_url":"https://api.github.com/repos/alto/assert_json/issues/8","number":8,"state":"open","locked":false,"title":"has_only: enforce a fixed sets of JSON object properties","user":{"login":"derek-watson","id":334285,"avatar_url":"https://avatars.githubusercontent.com/u/334285?v=3","gravatar_id":"","url":"https://api.github.com/users/derek-watson","html_url":"https://github.com/derek-watson","followers_url":"https://api.github.com/users/derek-watson/followers","following_url":"https://api.github.com/users/derek-watson/following{/other_user}","gists_url":"https://api.github.com/users/derek-watson/gists{/gist_id}","starred_url":"https://api.github.com/users/derek-watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derek-watson/subscriptions","organizations_url":"https://api.github.com/users/derek-watson/orgs","repos_url":"https://api.github.com/users/derek-watson/repos","events_url":"https://api.github.com/users/derek-watson/events{/privacy}","received_events_url":"https://api.github.com/users/derek-watson/received_events","type":"User","site_admin":false},"body":"I sometimes need to guarantee nothing gets accidentally added to a JSON response. I can't predict what might get accidentally added with `has_not`, so I've added a `has_only` method, which will cause any properties that have not been tested with `has` to throw an exception.\r\n\r\nThis applies to the object you add the call to, as well as any nested objects.\r\n\r\n```ruby\r\nassert_json '[{\"id\":1, \"key\":\"test\", \"name\":\"test\"}, {\"id\":2, \"key\":\"test\", \"name\":\"test\"}, {\"id\":3, \"key\":\"test\", \"name\":\"test\"}]' do\r\n  has_only\r\n  item 0 do\r\n    has :id, 1\r\n    has :key, 'test'\r\n    has :name, 'test'\r\n  end\r\n  item 1 do\r\n    has 'id', 2\r\n    has 'key', 'test'\r\n  end\r\nend\r\n\r\n// Failure: element 1 has unexpected keys: name\r\n```\r\n","created_at":"2015-04-19T02:55:05Z","updated_at":"2015-04-19T02:55:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alto/assert_json/pulls/8/commits","review_comments_url":"https://api.github.com/repos/alto/assert_json/pulls/8/comments","review_comment_url":"https://api.github.com/repos/alto/assert_json/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alto/assert_json/issues/8/comments","statuses_url":"https://api.github.com/repos/alto/assert_json/statuses/d0beee6820f6115802f1d8e19036cb452ad218ec","head":{"label":"derek-watson:feature/has_only","ref":"feature/has_only","sha":"d0beee6820f6115802f1d8e19036cb452ad218ec","user":{"login":"derek-watson","id":334285,"avatar_url":"https://avatars.githubusercontent.com/u/334285?v=3","gravatar_id":"","url":"https://api.github.com/users/derek-watson","html_url":"https://github.com/derek-watson","followers_url":"https://api.github.com/users/derek-watson/followers","following_url":"https://api.github.com/users/derek-watson/following{/other_user}","gists_url":"https://api.github.com/users/derek-watson/gists{/gist_id}","starred_url":"https://api.github.com/users/derek-watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derek-watson/subscriptions","organizations_url":"https://api.github.com/users/derek-watson/orgs","repos_url":"https://api.github.com/users/derek-watson/repos","events_url":"https://api.github.com/users/derek-watson/events{/privacy}","received_events_url":"https://api.github.com/users/derek-watson/received_events","type":"User","site_admin":false},"repo":{"id":34176286,"name":"assert_json","full_name":"derek-watson/assert_json","owner":{"login":"derek-watson","id":334285,"avatar_url":"https://avatars.githubusercontent.com/u/334285?v=3","gravatar_id":"","url":"https://api.github.com/users/derek-watson","html_url":"https://github.com/derek-watson","followers_url":"https://api.github.com/users/derek-watson/followers","following_url":"https://api.github.com/users/derek-watson/following{/other_user}","gists_url":"https://api.github.com/users/derek-watson/gists{/gist_id}","starred_url":"https://api.github.com/users/derek-watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derek-watson/subscriptions","organizations_url":"https://api.github.com/users/derek-watson/orgs","repos_url":"https://api.github.com/users/derek-watson/repos","events_url":"https://api.github.com/users/derek-watson/events{/privacy}","received_events_url":"https://api.github.com/users/derek-watson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/derek-watson/assert_json","description":"Provide an easy way to test json strings","fork":true,"url":"https://api.github.com/repos/derek-watson/assert_json","forks_url":"https://api.github.com/repos/derek-watson/assert_json/forks","keys_url":"https://api.github.com/repos/derek-watson/assert_json/keys{/key_id}","collaborators_url":"https://api.github.com/repos/derek-watson/assert_json/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/derek-watson/assert_json/teams","hooks_url":"https://api.github.com/repos/derek-watson/assert_json/hooks","issue_events_url":"https://api.github.com/repos/derek-watson/assert_json/issues/events{/number}","events_url":"https://api.github.com/repos/derek-watson/assert_json/events","assignees_url":"https://api.github.com/repos/derek-watson/assert_json/assignees{/user}","branches_url":"https://api.github.com/repos/derek-watson/assert_json/branches{/branch}","tags_url":"https://api.github.com/repos/derek-watson/assert_json/tags","blobs_url":"https://api.github.com/repos/derek-watson/assert_json/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/derek-watson/assert_json/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/derek-watson/assert_json/git/refs{/sha}","trees_url":"https://api.github.com/repos/derek-watson/assert_json/git/trees{/sha}","statuses_url":"https://api.github.com/repos/derek-watson/assert_json/statuses/{sha}","languages_url":"https://api.github.com/repos/derek-watson/assert_json/languages","stargazers_url":"https://api.github.com/repos/derek-watson/assert_json/stargazers","contributors_url":"https://api.github.com/repos/derek-watson/assert_json/contributors","subscribers_url":"https://api.github.com/repos/derek-watson/assert_json/subscribers","subscription_url":"https://api.github.com/repos/derek-watson/assert_json/subscription","commits_url":"https://api.github.com/repos/derek-watson/assert_json/commits{/sha}","git_commits_url":"https://api.github.com/repos/derek-watson/assert_json/git/commits{/sha}","comments_url":"https://api.github.com/repos/derek-watson/assert_json/comments{/number}","issue_comment_url":"https://api.github.com/repos/derek-watson/assert_json/issues/comments{/number}","contents_url":"https://api.github.com/repos/derek-watson/assert_json/contents/{+path}","compare_url":"https://api.github.com/repos/derek-watson/assert_json/compare/{base}...{head}","merges_url":"https://api.github.com/repos/derek-watson/assert_json/merges","archive_url":"https://api.github.com/repos/derek-watson/assert_json/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/derek-watson/assert_json/downloads","issues_url":"https://api.github.com/repos/derek-watson/assert_json/issues{/number}","pulls_url":"https://api.github.com/repos/derek-watson/assert_json/pulls{/number}","milestones_url":"https://api.github.com/repos/derek-watson/assert_json/milestones{/number}","notifications_url":"https://api.github.com/repos/derek-watson/assert_json/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/derek-watson/assert_json/labels{/name}","releases_url":"https://api.github.com/repos/derek-watson/assert_json/releases{/id}","created_at":"2015-04-18T17:54:18Z","updated_at":"2015-04-18T17:54:19Z","pushed_at":"2015-04-19T02:49:16Z","git_url":"git://github.com/derek-watson/assert_json.git","ssh_url":"git@github.com:derek-watson/assert_json.git","clone_url":"https://github.com/derek-watson/assert_json.git","svn_url":"https://github.com/derek-watson/assert_json","homepage":"","size":123,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"alto:master","ref":"master","sha":"743ddbe1765cc397e8fdace2f0412d99585d118b","user":{"login":"alto","id":3209,"avatar_url":"https://avatars.githubusercontent.com/u/3209?v=3","gravatar_id":"","url":"https://api.github.com/users/alto","html_url":"https://github.com/alto","followers_url":"https://api.github.com/users/alto/followers","following_url":"https://api.github.com/users/alto/following{/other_user}","gists_url":"https://api.github.com/users/alto/gists{/gist_id}","starred_url":"https://api.github.com/users/alto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alto/subscriptions","organizations_url":"https://api.github.com/users/alto/orgs","repos_url":"https://api.github.com/users/alto/repos","events_url":"https://api.github.com/users/alto/events{/privacy}","received_events_url":"https://api.github.com/users/alto/received_events","type":"User","site_admin":false},"repo":{"id":386675,"name":"assert_json","full_name":"alto/assert_json","owner":{"login":"alto","id":3209,"avatar_url":"https://avatars.githubusercontent.com/u/3209?v=3","gravatar_id":"","url":"https://api.github.com/users/alto","html_url":"https://github.com/alto","followers_url":"https://api.github.com/users/alto/followers","following_url":"https://api.github.com/users/alto/following{/other_user}","gists_url":"https://api.github.com/users/alto/gists{/gist_id}","starred_url":"https://api.github.com/users/alto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alto/subscriptions","organizations_url":"https://api.github.com/users/alto/orgs","repos_url":"https://api.github.com/users/alto/repos","events_url":"https://api.github.com/users/alto/events{/privacy}","received_events_url":"https://api.github.com/users/alto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alto/assert_json","description":"Provide an easy way to test json strings","fork":false,"url":"https://api.github.com/repos/alto/assert_json","forks_url":"https://api.github.com/repos/alto/assert_json/forks","keys_url":"https://api.github.com/repos/alto/assert_json/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alto/assert_json/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alto/assert_json/teams","hooks_url":"https://api.github.com/repos/alto/assert_json/hooks","issue_events_url":"https://api.github.com/repos/alto/assert_json/issues/events{/number}","events_url":"https://api.github.com/repos/alto/assert_json/events","assignees_url":"https://api.github.com/repos/alto/assert_json/assignees{/user}","branches_url":"https://api.github.com/repos/alto/assert_json/branches{/branch}","tags_url":"https://api.github.com/repos/alto/assert_json/tags","blobs_url":"https://api.github.com/repos/alto/assert_json/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alto/assert_json/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alto/assert_json/git/refs{/sha}","trees_url":"https://api.github.com/repos/alto/assert_json/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alto/assert_json/statuses/{sha}","languages_url":"https://api.github.com/repos/alto/assert_json/languages","stargazers_url":"https://api.github.com/repos/alto/assert_json/stargazers","contributors_url":"https://api.github.com/repos/alto/assert_json/contributors","subscribers_url":"https://api.github.com/repos/alto/assert_json/subscribers","subscription_url":"https://api.github.com/repos/alto/assert_json/subscription","commits_url":"https://api.github.com/repos/alto/assert_json/commits{/sha}","git_commits_url":"https://api.github.com/repos/alto/assert_json/git/commits{/sha}","comments_url":"https://api.github.com/repos/alto/assert_json/comments{/number}","issue_comment_url":"https://api.github.com/repos/alto/assert_json/issues/comments{/number}","contents_url":"https://api.github.com/repos/alto/assert_json/contents/{+path}","compare_url":"https://api.github.com/repos/alto/assert_json/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alto/assert_json/merges","archive_url":"https://api.github.com/repos/alto/assert_json/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alto/assert_json/downloads","issues_url":"https://api.github.com/repos/alto/assert_json/issues{/number}","pulls_url":"https://api.github.com/repos/alto/assert_json/pulls{/number}","milestones_url":"https://api.github.com/repos/alto/assert_json/milestones{/number}","notifications_url":"https://api.github.com/repos/alto/assert_json/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alto/assert_json/labels{/name}","releases_url":"https://api.github.com/repos/alto/assert_json/releases{/id}","created_at":"2009-11-26T17:03:02Z","updated_at":"2015-04-16T11:07:29Z","pushed_at":"2014-10-14T21:51:48Z","git_url":"git://github.com/alto/assert_json.git","ssh_url":"git@github.com:alto/assert_json.git","clone_url":"https://github.com/alto/assert_json.git","svn_url":"https://github.com/alto/assert_json","homepage":"","size":360,"stargazers_count":21,"watchers_count":21,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alto/assert_json/pulls/8"},"html":{"href":"https://github.com/alto/assert_json/pull/8"},"issue":{"href":"https://api.github.com/repos/alto/assert_json/issues/8"},"comments":{"href":"https://api.github.com/repos/alto/assert_json/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/alto/assert_json/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/alto/assert_json/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alto/assert_json/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/alto/assert_json/statuses/d0beee6820f6115802f1d8e19036cb452ad218ec"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":151,"deletions":1,"changed_files":3}}