{"action":"created","comment":{"url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/comments/56751650","id":56751650,"diff_hunk":"@@ -0,0 +1,48 @@\n+require 'test_helper'\n+\n+class GlobalValidationOptionsTest < ActiveSupport::TestCase\n+\n+  test 'As a user I want to be able to set validation options globally when defining the schema' do\n+\n+    test_schema = EasyJSONMatcher::SchemaGenerator.new(global_opts: { required: true }) { |schema|\n+      schema.has_boolean key: :implicitly_required\n+      schema.contains_node key: :also_implicitly_required do |n|\n+        n.has_boolean key: :nested_implicitly_required\n+      end\n+    }.generate_schema\n+\n+    invalid = {\n+      also_implicitly_required: {\n+      }\n+    }.to_json\n+\n+    assert_not(test_schema.valid?invalid)\n+    implicitly_required_error = test_schema.get_errors[:implicitly_required][0]\n+    nested_implicitly_required_error = test_schema.get_errors[:also_implicitly_required][:nested_implicitly_required][0]\n+    error_message = /Value was not present/\n+    assert_match(error_message, implicitly_required_error)\n+    assert_match(error_message, nested_implicitly_required_error)\n+  end\n+\n+  test 'As a user I want to be able to override global validation options for specific node' do\n+\n+    test_schema = EasyJSONMatcher::SchemaGenerator.new(global_opts: { required: true }) { |schema|\n+      schema.has_boolean key: :implicitly_required\n+      schema.contains_node key: :also_implicitly_required do |n|\n+        n.has_boolean key: :nested_implicitly_required, opts: {required: false}\n+      end\n+    }.generate_schema\n+\n+    invalid = {\n+      also_implicitly_required: {\n+      }\n+    }.to_json\n+\n+    assert_not(test_schema.valid?invalid)","path":"test/global_validation_options_test.rb","position":41,"original_position":41,"commit_id":"487da5006b19fba2b139f3dcd797a9545661df58","original_commit_id":"487da5006b19fba2b139f3dcd797a9545661df58","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Add parentheses to nested method call `test_schema.valid?invalid`.","created_at":"2016-03-19T17:01:46Z","updated_at":"2016-03-19T17:01:46Z","html_url":"https://github.com/wjdhamilton/easy-json-matcher/pull/37#discussion_r56751650","pull_request_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/comments/56751650"},"html":{"href":"https://github.com/wjdhamilton/easy-json-matcher/pull/37#discussion_r56751650"},"pull_request":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37","id":63472716,"html_url":"https://github.com/wjdhamilton/easy-json-matcher/pull/37","diff_url":"https://github.com/wjdhamilton/easy-json-matcher/pull/37.diff","patch_url":"https://github.com/wjdhamilton/easy-json-matcher/pull/37.patch","issue_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/37","number":37,"state":"closed","locked":false,"title":"Issue 35 global validation options","user":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-19T17:01:38Z","updated_at":"2016-03-19T17:01:48Z","closed_at":"2016-03-19T17:01:48Z","merged_at":"2016-03-19T17:01:48Z","merge_commit_sha":"c0eec540470c126d1b69d69101dcf9acd8996a93","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37/commits","review_comments_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37/comments","review_comment_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/37/comments","statuses_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/statuses/487da5006b19fba2b139f3dcd797a9545661df58","head":{"label":"wjdhamilton:issue_35_global_validation_options","ref":"issue_35_global_validation_options","sha":"487da5006b19fba2b139f3dcd797a9545661df58","user":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"repo":{"id":51373774,"name":"easy-json-matcher","full_name":"wjdhamilton/easy-json-matcher","owner":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wjdhamilton/easy-json-matcher","description":"Validate JSONAPI output in Ruby","fork":false,"url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher","forks_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/forks","keys_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/teams","hooks_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/hooks","issue_events_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/events{/number}","events_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/events","assignees_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/assignees{/user}","branches_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/branches{/branch}","tags_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/tags","blobs_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/statuses/{sha}","languages_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/languages","stargazers_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/stargazers","contributors_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/contributors","subscribers_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/subscribers","subscription_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/subscription","commits_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/contents/{+path}","compare_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/merges","archive_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/downloads","issues_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues{/number}","pulls_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls{/number}","milestones_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/milestones{/number}","notifications_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/labels{/name}","releases_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/releases{/id}","deployments_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/deployments","created_at":"2016-02-09T14:58:39Z","updated_at":"2016-02-10T16:52:31Z","pushed_at":"2016-03-19T17:01:48Z","git_url":"git://github.com/wjdhamilton/easy-json-matcher.git","ssh_url":"git@github.com:wjdhamilton/easy-json-matcher.git","clone_url":"https://github.com/wjdhamilton/easy-json-matcher.git","svn_url":"https://github.com/wjdhamilton/easy-json-matcher","homepage":null,"size":83,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"wjdhamilton:master","ref":"master","sha":"33b6117223b690d42d8d4e31feef430786422244","user":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"repo":{"id":51373774,"name":"easy-json-matcher","full_name":"wjdhamilton/easy-json-matcher","owner":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wjdhamilton/easy-json-matcher","description":"Validate JSONAPI output in Ruby","fork":false,"url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher","forks_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/forks","keys_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/teams","hooks_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/hooks","issue_events_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/events{/number}","events_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/events","assignees_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/assignees{/user}","branches_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/branches{/branch}","tags_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/tags","blobs_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/statuses/{sha}","languages_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/languages","stargazers_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/stargazers","contributors_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/contributors","subscribers_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/subscribers","subscription_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/subscription","commits_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/contents/{+path}","compare_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/merges","archive_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/downloads","issues_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues{/number}","pulls_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls{/number}","milestones_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/milestones{/number}","notifications_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/labels{/name}","releases_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/releases{/id}","deployments_url":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/deployments","created_at":"2016-02-09T14:58:39Z","updated_at":"2016-02-10T16:52:31Z","pushed_at":"2016-03-19T17:01:48Z","git_url":"git://github.com/wjdhamilton/easy-json-matcher.git","ssh_url":"git@github.com:wjdhamilton/easy-json-matcher.git","clone_url":"https://github.com/wjdhamilton/easy-json-matcher.git","svn_url":"https://github.com/wjdhamilton/easy-json-matcher","homepage":null,"size":83,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37"},"html":{"href":"https://github.com/wjdhamilton/easy-json-matcher/pull/37"},"issue":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/37"},"comments":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/wjdhamilton/easy-json-matcher/statuses/487da5006b19fba2b139f3dcd797a9545661df58"}}}}