{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/49281699","id":49281699,"diff_hunk":"@@ -47,50 +47,53 @@ def test_serializer_option_not_passed_to_each_serializer\n \n       def test_root_default\n         @serializer = collection_serializer.new([@comment, @post])\n-        assert_equal @serializer.root, nil\n+        assert_nil @serializer.root\n       end\n \n       def test_root\n         expected =  'custom_root'\n         @serializer = collection_serializer.new([@comment, @post], root: expected)\n-        assert_equal @serializer.root, expected\n+        assert_equal expected, @serializer.root\n       end\n \n       def test_root_with_no_serializers\n         expected =  'custom_root'\n         @serializer = collection_serializer.new([], root: expected)\n-        assert_equal @serializer.root, expected\n+        assert_equal expected, @serializer.root\n       end\n \n-      def test_json_key\n-        assert_equal @serializer.json_key, 'comments'\n+      def test_json_key_with_resource_with_serializer\n+        singular_key = @serializer.send(:serializers).first.json_key\n+        assert_equal singular_key.pluralize, @serializer.json_key\n       end\n \n       def test_json_key_with_resource_with_name_and_no_serializers\n         serializer = collection_serializer.new(build_named_collection)\n-        assert_equal serializer.json_key, 'me_resources'\n+        assert_equal 'me_resources', serializer.json_key\n       end\n \n       def test_json_key_with_resource_with_nil_name_and_no_serializers\n         resource = []\n         resource.define_singleton_method(:name) { nil }\n         serializer = collection_serializer.new(resource)\n-        assert_equal serializer.json_key, nil\n+        assert_nil serializer.json_key\n       end\n \n       def test_json_key_with_resource_without_name_and_no_serializers\n         serializer = collection_serializer.new([])\n-        assert_equal serializer.json_key, nil\n+        assert_nil serializer.json_key","path":"test/collection_serializer_test.rb","position":55,"original_position":55,"commit_id":"047f11fbf7b6637127100af43d04fd2285d71d63","original_commit_id":"047f11fbf7b6637127100af43d04fd2285d71d63","user":{"login":"bf4","id":142914,"avatar_url":"https://avatars.githubusercontent.com/u/142914?v=3","gravatar_id":"","url":"https://api.github.com/users/bf4","html_url":"https://github.com/bf4","followers_url":"https://api.github.com/users/bf4/followers","following_url":"https://api.github.com/users/bf4/following{/other_user}","gists_url":"https://api.github.com/users/bf4/gists{/gist_id}","starred_url":"https://api.github.com/users/bf4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bf4/subscriptions","organizations_url":"https://api.github.com/users/bf4/orgs","repos_url":"https://api.github.com/users/bf4/repos","events_url":"https://api.github.com/users/bf4/events{/privacy}","received_events_url":"https://api.github.com/users/bf4/received_events","type":"User","site_admin":false},"body":"Why this change? Besides being out of scope, it's a better failure failure message 'expected foo to be nil but what bar' over  'expected foo to be nil',no? ","created_at":"2016-01-10T21:23:30Z","updated_at":"2016-01-10T21:23:30Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1418#discussion_r49281699","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/49281699"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1418#discussion_r49281699"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418","id":55381319,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1418","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1418.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1418.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1418","number":1418,"state":"open","locked":false,"title":"Don't pluralize the CollectionSerializer#root for #json_key","user":{"login":"Empact","id":5470,"avatar_url":"https://avatars.githubusercontent.com/u/5470?v=3","gravatar_id":"","url":"https://api.github.com/users/Empact","html_url":"https://github.com/Empact","followers_url":"https://api.github.com/users/Empact/followers","following_url":"https://api.github.com/users/Empact/following{/other_user}","gists_url":"https://api.github.com/users/Empact/gists{/gist_id}","starred_url":"https://api.github.com/users/Empact/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Empact/subscriptions","organizations_url":"https://api.github.com/users/Empact/orgs","repos_url":"https://api.github.com/users/Empact/repos","events_url":"https://api.github.com/users/Empact/events{/privacy}","received_events_url":"https://api.github.com/users/Empact/received_events","type":"User","site_admin":false},"body":"One of three constituents is used to provide the CollectionSerializer's #json_key:\r\n1) the :root option - controlled by the caller\r\n2) the #name of the first resource serializer - the root or\r\n   underscored model name\r\n3) the underscored #name of the resources object - generally\r\n   equivalent to the underscored model name of #2\r\n\r\nOf the three, only the latter 2 are out of the callers control, and\r\nonly the latter two are expected to be singular by default. Not\r\npluralizing the root gives the caller additional flexibility in\r\ndefining the desired root, whether conventionally plural,\r\nunconventionally plural (e.g. objects_received:) or singular.","created_at":"2016-01-07T19:47:36Z","updated_at":"2016-01-10T21:23:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb354ef1360391fc897d4c839b658510482aed22","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418/comments","review_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1418/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/047f11fbf7b6637127100af43d04fd2285d71d63","head":{"label":"brigade:collection-pluralize","ref":"collection-pluralize","sha":"047f11fbf7b6637127100af43d04fd2285d71d63","user":{"login":"brigade","id":7872961,"avatar_url":"https://avatars.githubusercontent.com/u/7872961?v=3","gravatar_id":"","url":"https://api.github.com/users/brigade","html_url":"https://github.com/brigade","followers_url":"https://api.github.com/users/brigade/followers","following_url":"https://api.github.com/users/brigade/following{/other_user}","gists_url":"https://api.github.com/users/brigade/gists{/gist_id}","starred_url":"https://api.github.com/users/brigade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brigade/subscriptions","organizations_url":"https://api.github.com/users/brigade/orgs","repos_url":"https://api.github.com/users/brigade/repos","events_url":"https://api.github.com/users/brigade/events{/privacy}","received_events_url":"https://api.github.com/users/brigade/received_events","type":"Organization","site_admin":false},"repo":{"id":45276385,"name":"active_model_serializers","full_name":"brigade/active_model_serializers","owner":{"login":"brigade","id":7872961,"avatar_url":"https://avatars.githubusercontent.com/u/7872961?v=3","gravatar_id":"","url":"https://api.github.com/users/brigade","html_url":"https://github.com/brigade","followers_url":"https://api.github.com/users/brigade/followers","following_url":"https://api.github.com/users/brigade/following{/other_user}","gists_url":"https://api.github.com/users/brigade/gists{/gist_id}","starred_url":"https://api.github.com/users/brigade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brigade/subscriptions","organizations_url":"https://api.github.com/users/brigade/orgs","repos_url":"https://api.github.com/users/brigade/repos","events_url":"https://api.github.com/users/brigade/events{/privacy}","received_events_url":"https://api.github.com/users/brigade/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brigade/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/brigade/active_model_serializers","forks_url":"https://api.github.com/repos/brigade/active_model_serializers/forks","keys_url":"https://api.github.com/repos/brigade/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brigade/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brigade/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/brigade/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/brigade/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/brigade/active_model_serializers/events","assignees_url":"https://api.github.com/repos/brigade/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/brigade/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/brigade/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/brigade/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brigade/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brigade/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/brigade/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brigade/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/brigade/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/brigade/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/brigade/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/brigade/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/brigade/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/brigade/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/brigade/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/brigade/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/brigade/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/brigade/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/brigade/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brigade/active_model_serializers/merges","archive_url":"https://api.github.com/repos/brigade/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brigade/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/brigade/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/brigade/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/brigade/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/brigade/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brigade/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/brigade/active_model_serializers/releases{/id}","created_at":"2015-10-30T21:02:52Z","updated_at":"2015-10-30T21:02:54Z","pushed_at":"2016-01-07T20:22:06Z","git_url":"git://github.com/brigade/active_model_serializers.git","ssh_url":"git@github.com:brigade/active_model_serializers.git","clone_url":"https://github.com/brigade/active_model_serializers.git","svn_url":"https://github.com/brigade/active_model_serializers","homepage":"","size":2216,"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":"rails-api:master","ref":"master","sha":"7d4f0c5c8af93c32bd69ed36b2433de42243f93c","user":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"repo":{"id":2889230,"name":"active_model_serializers","full_name":"rails-api/active_model_serializers","owner":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails-api/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":false,"url":"https://api.github.com/repos/rails-api/active_model_serializers","forks_url":"https://api.github.com/repos/rails-api/active_model_serializers/forks","keys_url":"https://api.github.com/repos/rails-api/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails-api/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails-api/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/rails-api/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/events","assignees_url":"https://api.github.com/repos/rails-api/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/rails-api/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/rails-api/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/rails-api/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/rails-api/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails-api/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/rails-api/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails-api/active_model_serializers/merges","archive_url":"https://api.github.com/repos/rails-api/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails-api/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/rails-api/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/rails-api/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/rails-api/active_model_serializers/releases{/id}","created_at":"2011-12-01T06:39:26Z","updated_at":"2016-01-08T15:42:32Z","pushed_at":"2016-01-09T23:00:32Z","git_url":"git://github.com/rails-api/active_model_serializers.git","ssh_url":"git@github.com:rails-api/active_model_serializers.git","clone_url":"https://github.com/rails-api/active_model_serializers.git","svn_url":"https://github.com/rails-api/active_model_serializers","homepage":"","size":3629,"stargazers_count":3245,"watchers_count":3245,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":767,"mirror_url":null,"open_issues_count":191,"forks":767,"open_issues":191,"watchers":3245,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1418"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1418"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1418/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418/comments"},"review_comment":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1418/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/047f11fbf7b6637127100af43d04fd2285d71d63"}}}}