{"action":"created","comment":{"url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/comments/25759007","id":25759007,"diff_hunk":"@@ -0,0 +1,47 @@\n+require \"minitest_helper\"\n+\n+module CollectionJson\n+  class Serializer\n+    class TestTemplateValidation < Minitest::Test\n+      include TestHelper\n+\n+      def setup\n+        @user = User.new(name: \"Carles Jove\", email: \"hola@carlus.cat\")\n+        @serializer = empty_serializer_for(@user)\n+        @serializer.class._extensions = [:template_validation]\n+        @serializer.class._template = [\n+          email: {\n+            regexp: \"^[a-zA-Z0-9]*$\",\n+            required: true\n+          }\n+        ]\n+      end\n+\n+      def test_that_serializer_is_valid_using_template_validations\n+        assert @serializer.valid?, \"should be valid using :template_validation\"\n+      end\n+\n+      def test_that_a_collection_can_be_built_using_template_validations\n+        builder = Builder.new(@serializer)\n+        expected = {\n+          collection: {\n+            version: \"1.0\",\n+            template: {\n+              data: [\n+                {\n+                  name: \"email\",\n+                  value: \"\",\n+                  regexp: \"^[a-zA-Z0-9]*$\",\n+                  required: true\n+                }\n+              ]\n+            }\n+          }\n+        }\n+\n+        assert_equal JSON(expected.to_json), JSON(builder.to_json)\n+      end\n+    end\n+  end\n+end\n+","path":"test/extensions/template_validation_test.rb","position":47,"original_position":47,"commit_id":"f39ee181faa03318e75c6ed91d7cb30ca35581f2","original_commit_id":"f39ee181faa03318e75c6ed91d7cb30ca35581f2","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"1 trailing blank lines detected.","created_at":"2015-03-04T08:41:54Z","updated_at":"2015-03-04T08:41:54Z","html_url":"https://github.com/carlesjove/collection_json_serializer/pull/48#discussion_r25759007","pull_request_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/comments/25759007"},"html":{"href":"https://github.com/carlesjove/collection_json_serializer/pull/48#discussion_r25759007"},"pull_request":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48","id":30446874,"html_url":"https://github.com/carlesjove/collection_json_serializer/pull/48","diff_url":"https://github.com/carlesjove/collection_json_serializer/pull/48.diff","patch_url":"https://github.com/carlesjove/collection_json_serializer/pull/48.patch","issue_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/48","number":48,"state":"open","locked":false,"title":"Extension: template validation","user":{"login":"carlesjove","id":1800981,"avatar_url":"https://avatars.githubusercontent.com/u/1800981?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesjove","html_url":"https://github.com/carlesjove","followers_url":"https://api.github.com/users/carlesjove/followers","following_url":"https://api.github.com/users/carlesjove/following{/other_user}","gists_url":"https://api.github.com/users/carlesjove/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesjove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesjove/subscriptions","organizations_url":"https://api.github.com/users/carlesjove/orgs","repos_url":"https://api.github.com/users/carlesjove/repos","events_url":"https://api.github.com/users/carlesjove/events{/privacy}","received_events_url":"https://api.github.com/users/carlesjove/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-04T08:41:49Z","updated_at":"2015-03-04T08:41:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7050d79ff4c3cea77c7ca2d7bbdbb85118cf69a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48/commits","review_comments_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48/comments","review_comment_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/48/comments","statuses_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/statuses/f39ee181faa03318e75c6ed91d7cb30ca35581f2","head":{"label":"carlesjove:extension_template_validation","ref":"extension_template_validation","sha":"f39ee181faa03318e75c6ed91d7cb30ca35581f2","user":{"login":"carlesjove","id":1800981,"avatar_url":"https://avatars.githubusercontent.com/u/1800981?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesjove","html_url":"https://github.com/carlesjove","followers_url":"https://api.github.com/users/carlesjove/followers","following_url":"https://api.github.com/users/carlesjove/following{/other_user}","gists_url":"https://api.github.com/users/carlesjove/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesjove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesjove/subscriptions","organizations_url":"https://api.github.com/users/carlesjove/orgs","repos_url":"https://api.github.com/users/carlesjove/repos","events_url":"https://api.github.com/users/carlesjove/events{/privacy}","received_events_url":"https://api.github.com/users/carlesjove/received_events","type":"User","site_admin":false},"repo":{"id":25838775,"name":"collection_json_serializer","full_name":"carlesjove/collection_json_serializer","owner":{"login":"carlesjove","id":1800981,"avatar_url":"https://avatars.githubusercontent.com/u/1800981?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesjove","html_url":"https://github.com/carlesjove","followers_url":"https://api.github.com/users/carlesjove/followers","following_url":"https://api.github.com/users/carlesjove/following{/other_user}","gists_url":"https://api.github.com/users/carlesjove/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesjove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesjove/subscriptions","organizations_url":"https://api.github.com/users/carlesjove/orgs","repos_url":"https://api.github.com/users/carlesjove/repos","events_url":"https://api.github.com/users/carlesjove/events{/privacy}","received_events_url":"https://api.github.com/users/carlesjove/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carlesjove/collection_json_serializer","description":"A Rails gem to respond with Collection+JSON","fork":false,"url":"https://api.github.com/repos/carlesjove/collection_json_serializer","forks_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/forks","keys_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/teams","hooks_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/hooks","issue_events_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/events{/number}","events_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/events","assignees_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/assignees{/user}","branches_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/branches{/branch}","tags_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/tags","blobs_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/refs{/sha}","trees_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/statuses/{sha}","languages_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/languages","stargazers_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/stargazers","contributors_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/contributors","subscribers_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/subscribers","subscription_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/subscription","commits_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/commits{/sha}","git_commits_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/commits{/sha}","comments_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/comments{/number}","issue_comment_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/comments{/number}","contents_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/contents/{+path}","compare_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/merges","archive_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/downloads","issues_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues{/number}","pulls_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls{/number}","milestones_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/milestones{/number}","notifications_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/labels{/name}","releases_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/releases{/id}","created_at":"2014-10-27T20:55:58Z","updated_at":"2015-02-17T11:48:37Z","pushed_at":"2015-03-04T08:41:01Z","git_url":"git://github.com/carlesjove/collection_json_serializer.git","ssh_url":"git@github.com:carlesjove/collection_json_serializer.git","clone_url":"https://github.com/carlesjove/collection_json_serializer.git","svn_url":"https://github.com/carlesjove/collection_json_serializer","homepage":null,"size":981,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":10,"forks":1,"open_issues":10,"watchers":1,"default_branch":"master"}},"base":{"label":"carlesjove:dev","ref":"dev","sha":"5bff89122af7be456082d7c7186a4acfe30f31c8","user":{"login":"carlesjove","id":1800981,"avatar_url":"https://avatars.githubusercontent.com/u/1800981?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesjove","html_url":"https://github.com/carlesjove","followers_url":"https://api.github.com/users/carlesjove/followers","following_url":"https://api.github.com/users/carlesjove/following{/other_user}","gists_url":"https://api.github.com/users/carlesjove/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesjove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesjove/subscriptions","organizations_url":"https://api.github.com/users/carlesjove/orgs","repos_url":"https://api.github.com/users/carlesjove/repos","events_url":"https://api.github.com/users/carlesjove/events{/privacy}","received_events_url":"https://api.github.com/users/carlesjove/received_events","type":"User","site_admin":false},"repo":{"id":25838775,"name":"collection_json_serializer","full_name":"carlesjove/collection_json_serializer","owner":{"login":"carlesjove","id":1800981,"avatar_url":"https://avatars.githubusercontent.com/u/1800981?v=3","gravatar_id":"","url":"https://api.github.com/users/carlesjove","html_url":"https://github.com/carlesjove","followers_url":"https://api.github.com/users/carlesjove/followers","following_url":"https://api.github.com/users/carlesjove/following{/other_user}","gists_url":"https://api.github.com/users/carlesjove/gists{/gist_id}","starred_url":"https://api.github.com/users/carlesjove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlesjove/subscriptions","organizations_url":"https://api.github.com/users/carlesjove/orgs","repos_url":"https://api.github.com/users/carlesjove/repos","events_url":"https://api.github.com/users/carlesjove/events{/privacy}","received_events_url":"https://api.github.com/users/carlesjove/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carlesjove/collection_json_serializer","description":"A Rails gem to respond with Collection+JSON","fork":false,"url":"https://api.github.com/repos/carlesjove/collection_json_serializer","forks_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/forks","keys_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/teams","hooks_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/hooks","issue_events_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/events{/number}","events_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/events","assignees_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/assignees{/user}","branches_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/branches{/branch}","tags_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/tags","blobs_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/refs{/sha}","trees_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/statuses/{sha}","languages_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/languages","stargazers_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/stargazers","contributors_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/contributors","subscribers_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/subscribers","subscription_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/subscription","commits_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/commits{/sha}","git_commits_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/git/commits{/sha}","comments_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/comments{/number}","issue_comment_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/comments{/number}","contents_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/contents/{+path}","compare_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/merges","archive_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/downloads","issues_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues{/number}","pulls_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls{/number}","milestones_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/milestones{/number}","notifications_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/labels{/name}","releases_url":"https://api.github.com/repos/carlesjove/collection_json_serializer/releases{/id}","created_at":"2014-10-27T20:55:58Z","updated_at":"2015-02-17T11:48:37Z","pushed_at":"2015-03-04T08:41:01Z","git_url":"git://github.com/carlesjove/collection_json_serializer.git","ssh_url":"git@github.com:carlesjove/collection_json_serializer.git","clone_url":"https://github.com/carlesjove/collection_json_serializer.git","svn_url":"https://github.com/carlesjove/collection_json_serializer","homepage":null,"size":981,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":10,"forks":1,"open_issues":10,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48"},"html":{"href":"https://github.com/carlesjove/collection_json_serializer/pull/48"},"issue":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/48"},"comments":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/carlesjove/collection_json_serializer/statuses/f39ee181faa03318e75c6ed91d7cb30ca35581f2"}}}}