GitHub PullRequestReviewCommentEvent at 2014-11-10 21:15:27
Repository: apivore
Actor: hornc
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hornc/apivore/pulls/comments/20113327","id":20113327,"diff_hunk":"@@ -9,56 +10,58 @@ module RspecBuilder\n \n     def apivore_setup(path, method, response, &block)\n       @@setups ||= {}\n-      @@setups[path] ||= {}\n-      @@setups[path][method] ||= {}\n-      @@setups[path][method][response] = block\n+      @@setups[path + method + response] = block\n+    end\n+\n+    def run_apivore_setup(path, method, response_code, base_path)\n+      key = path + method + response_code\n+      if @@setups[key]\n+        @@setups[key].call.each do |key, data|\n+          path = path.gsub \"{#{key}}\", data.to_s\n+        end\n+      end\n+      base_path + path\n+    end\n+\n+    def apivore_swagger(swagger_path)\n+      session = ActionDispatch::Integration::Session.new(Rails.application)\n+      session.get swagger_path\n+      Apivore::Swagger.new JSON.parse(session.response.body)\n     end\n \n     def validate(swagger_path)\n \n       describe \"the swagger documentation\" do\n-        before {\n-          get swagger_path\n-        }\n+        before { get swagger_path }\n         subject { body }\n-        it { should be_valid_swagger '2.0' }\n-        it { should have_models_for_all_get_endpoints } # this is not required by the swagger spec, but is helpful for these tests for the momemt\n+        it { should be_valid_swagger }\n+        it { should have_models_for_all_get_endpoints }\n       end\n \n-      describe \"GET paths\" do\n-        # Build the various path tests by reading the swagger.json and iterating through the paths BEFORE the rspec tests are run\n-        session = ActionDispatch::Integration::Session.new(Rails.application)\n-        session.get swagger_path\n-        swagger = Apivore::ApiDescription.new(session.response.body)\n+      swagger = apivore_swagger(swagger_path)\n+      swagger.each_response do |path, method, response_code, schema|\n \n-        method = 'get'\n-        http_response = '200'\n-        swagger.paths(method).each do |path|\n+        describe \"path #{path} metthod #{method} response #{response_code}\" do","path":"lib/apivore/rspec_builder.rb","position":59,"original_position":59,"commit_id":"0170694bdca735562ce0f7fecde2b8de2595b9a9","original_commit_id":"0170694bdca735562ce0f7fecde2b8de2595b9a9","user":{"login":"hornc","id":905545,"avatar_url":"https://avatars.githubusercontent.com/u/905545?v=3","gravatar_id":"","url":"https://api.github.com/users/hornc","html_url":"https://github.com/hornc","followers_url":"https://api.github.com/users/hornc/followers","following_url":"https://api.github.com/users/hornc/following{/other_user}","gists_url":"https://api.github.com/users/hornc/gists{/gist_id}","starred_url":"https://api.github.com/users/hornc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hornc/subscriptions","organizations_url":"https://api.github.com/users/hornc/orgs","repos_url":"https://api.github.com/users/hornc/repos","events_url":"https://api.github.com/users/hornc/events{/privacy}","received_events_url":"https://api.github.com/users/hornc/received_events","type":"User","site_admin":false},"body":"typo:   'metthod'","created_at":"2014-11-10T21:15:27Z","updated_at":"2014-11-10T21:15:27Z","html_url":"https://github.com/hornc/apivore/pull/2#discussion_r20113327","pull_request_url":"https://api.github.com/repos/hornc/apivore/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/hornc/apivore/pulls/comments/20113327"},"html":{"href":"https://github.com/hornc/apivore/pull/2#discussion_r20113327"},"pull_request":{"href":"https://api.github.com/repos/hornc/apivore/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/hornc/apivore/pulls/2","id":24118717,"html_url":"https://github.com/hornc/apivore/pull/2","diff_url":"https://github.com/hornc/apivore/pull/2.diff","patch_url":"https://github.com/hornc/apivore/pull/2.patch","issue_url":"https://api.github.com/repos/hornc/apivore/issues/2","number":2,"state":"open","locked":false,"title":"Refactor","user":{"login":"leondewey","id":24807,"avatar_url":"https://avatars.githubusercontent.com/u/24807?v=3","gravatar_id":"","url":"https://api.github.com/users/leondewey","html_url":"https://github.com/leondewey","followers_url":"https://api.github.com/users/leondewey/followers","following_url":"https://api.github.com/users/leondewey/following{/other_user}","gists_url":"https://api.github.com/users/leondewey/gists{/gist_id}","starred_url":"https://api.github.com/users/leondewey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leondewey/subscriptions","organizations_url":"https://api.github.com/users/leondewey/orgs","repos_url":"https://api.github.com/users/leondewey/repos","events_url":"https://api.github.com/users/leondewey/events{/privacy}","received_events_url":"https://api.github.com/users/leondewey/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-11-09T20:29:01Z","updated_at":"2014-11-10T21:15:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b0258c350f50b1a4a060ae7c7ad8c7079ef07b5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hornc/apivore/pulls/2/commits","review_comments_url":"https://api.github.com/repos/hornc/apivore/pulls/2/comments","review_comment_url":"https://api.github.com/repos/hornc/apivore/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hornc/apivore/issues/2/comments","statuses_url":"https://api.github.com/repos/hornc/apivore/statuses/0170694bdca735562ce0f7fecde2b8de2595b9a9","head":{"label":"leondewey:refactor","ref":"refactor","sha":"0170694bdca735562ce0f7fecde2b8de2595b9a9","user":{"login":"leondewey","id":24807,"avatar_url":"https://avatars.githubusercontent.com/u/24807?v=3","gravatar_id":"","url":"https://api.github.com/users/leondewey","html_url":"https://github.com/leondewey","followers_url":"https://api.github.com/users/leondewey/followers","following_url":"https://api.github.com/users/leondewey/following{/other_user}","gists_url":"https://api.github.com/users/leondewey/gists{/gist_id}","starred_url":"https://api.github.com/users/leondewey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leondewey/subscriptions","organizations_url":"https://api.github.com/users/leondewey/orgs","repos_url":"https://api.github.com/users/leondewey/repos","events_url":"https://api.github.com/users/leondewey/events{/privacy}","received_events_url":"https://api.github.com/users/leondewey/received_events","type":"User","site_admin":false},"repo":{"id":26250892,"name":"apivore","full_name":"leondewey/apivore","owner":{"login":"leondewey","id":24807,"avatar_url":"https://avatars.githubusercontent.com/u/24807?v=3","gravatar_id":"","url":"https://api.github.com/users/leondewey","html_url":"https://github.com/leondewey","followers_url":"https://api.github.com/users/leondewey/followers","following_url":"https://api.github.com/users/leondewey/following{/other_user}","gists_url":"https://api.github.com/users/leondewey/gists{/gist_id}","starred_url":"https://api.github.com/users/leondewey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leondewey/subscriptions","organizations_url":"https://api.github.com/users/leondewey/orgs","repos_url":"https://api.github.com/users/leondewey/repos","events_url":"https://api.github.com/users/leondewey/events{/privacy}","received_events_url":"https://api.github.com/users/leondewey/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/leondewey/apivore","description":"","fork":true,"url":"https://api.github.com/repos/leondewey/apivore","forks_url":"https://api.github.com/repos/leondewey/apivore/forks","keys_url":"https://api.github.com/repos/leondewey/apivore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leondewey/apivore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leondewey/apivore/teams","hooks_url":"https://api.github.com/repos/leondewey/apivore/hooks","issue_events_url":"https://api.github.com/repos/leondewey/apivore/issues/events{/number}","events_url":"https://api.github.com/repos/leondewey/apivore/events","assignees_url":"https://api.github.com/repos/leondewey/apivore/assignees{/user}","branches_url":"https://api.github.com/repos/leondewey/apivore/branches{/branch}","tags_url":"https://api.github.com/repos/leondewey/apivore/tags","blobs_url":"https://api.github.com/repos/leondewey/apivore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leondewey/apivore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leondewey/apivore/git/refs{/sha}","trees_url":"https://api.github.com/repos/leondewey/apivore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leondewey/apivore/statuses/{sha}","languages_url":"https://api.github.com/repos/leondewey/apivore/languages","stargazers_url":"https://api.github.com/repos/leondewey/apivore/stargazers","contributors_url":"https://api.github.com/repos/leondewey/apivore/contributors","subscribers_url":"https://api.github.com/repos/leondewey/apivore/subscribers","subscription_url":"https://api.github.com/repos/leondewey/apivore/subscription","commits_url":"https://api.github.com/repos/leondewey/apivore/commits{/sha}","git_commits_url":"https://api.github.com/repos/leondewey/apivore/git/commits{/sha}","comments_url":"https://api.github.com/repos/leondewey/apivore/comments{/number}","issue_comment_url":"https://api.github.com/repos/leondewey/apivore/issues/comments/{number}","contents_url":"https://api.github.com/repos/leondewey/apivore/contents/{+path}","compare_url":"https://api.github.com/repos/leondewey/apivore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leondewey/apivore/merges","archive_url":"https://api.github.com/repos/leondewey/apivore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leondewey/apivore/downloads","issues_url":"https://api.github.com/repos/leondewey/apivore/issues{/number}","pulls_url":"https://api.github.com/repos/leondewey/apivore/pulls{/number}","milestones_url":"https://api.github.com/repos/leondewey/apivore/milestones{/number}","notifications_url":"https://api.github.com/repos/leondewey/apivore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leondewey/apivore/labels{/name}","releases_url":"https://api.github.com/repos/leondewey/apivore/releases{/id}","created_at":"2014-11-06T02:52:05Z","updated_at":"2014-11-06T03:33:08Z","pushed_at":"2014-11-09T20:28:50Z","git_url":"git://github.com/leondewey/apivore.git","ssh_url":"git@github.com:leondewey/apivore.git","clone_url":"https://github.com/leondewey/apivore.git","svn_url":"https://github.com/leondewey/apivore","homepage":null,"size":134,"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":"hornc:master","ref":"master","sha":"397886f40658d9582bfd480473e478056349445f","user":{"login":"hornc","id":905545,"avatar_url":"https://avatars.githubusercontent.com/u/905545?v=3","gravatar_id":"","url":"https://api.github.com/users/hornc","html_url":"https://github.com/hornc","followers_url":"https://api.github.com/users/hornc/followers","following_url":"https://api.github.com/users/hornc/following{/other_user}","gists_url":"https://api.github.com/users/hornc/gists{/gist_id}","starred_url":"https://api.github.com/users/hornc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hornc/subscriptions","organizations_url":"https://api.github.com/users/hornc/orgs","repos_url":"https://api.github.com/users/hornc/repos","events_url":"https://api.github.com/users/hornc/events{/privacy}","received_events_url":"https://api.github.com/users/hornc/received_events","type":"User","site_admin":false},"repo":{"id":25453128,"name":"apivore","full_name":"hornc/apivore","owner":{"login":"hornc","id":905545,"avatar_url":"https://avatars.githubusercontent.com/u/905545?v=3","gravatar_id":"","url":"https://api.github.com/users/hornc","html_url":"https://github.com/hornc","followers_url":"https://api.github.com/users/hornc/followers","following_url":"https://api.github.com/users/hornc/following{/other_user}","gists_url":"https://api.github.com/users/hornc/gists{/gist_id}","starred_url":"https://api.github.com/users/hornc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hornc/subscriptions","organizations_url":"https://api.github.com/users/hornc/orgs","repos_url":"https://api.github.com/users/hornc/repos","events_url":"https://api.github.com/users/hornc/events{/privacy}","received_events_url":"https://api.github.com/users/hornc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hornc/apivore","description":"","fork":false,"url":"https://api.github.com/repos/hornc/apivore","forks_url":"https://api.github.com/repos/hornc/apivore/forks","keys_url":"https://api.github.com/repos/hornc/apivore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hornc/apivore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hornc/apivore/teams","hooks_url":"https://api.github.com/repos/hornc/apivore/hooks","issue_events_url":"https://api.github.com/repos/hornc/apivore/issues/events{/number}","events_url":"https://api.github.com/repos/hornc/apivore/events","assignees_url":"https://api.github.com/repos/hornc/apivore/assignees{/user}","branches_url":"https://api.github.com/repos/hornc/apivore/branches{/branch}","tags_url":"https://api.github.com/repos/hornc/apivore/tags","blobs_url":"https://api.github.com/repos/hornc/apivore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hornc/apivore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hornc/apivore/git/refs{/sha}","trees_url":"https://api.github.com/repos/hornc/apivore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hornc/apivore/statuses/{sha}","languages_url":"https://api.github.com/repos/hornc/apivore/languages","stargazers_url":"https://api.github.com/repos/hornc/apivore/stargazers","contributors_url":"https://api.github.com/repos/hornc/apivore/contributors","subscribers_url":"https://api.github.com/repos/hornc/apivore/subscribers","subscription_url":"https://api.github.com/repos/hornc/apivore/subscription","commits_url":"https://api.github.com/repos/hornc/apivore/commits{/sha}","git_commits_url":"https://api.github.com/repos/hornc/apivore/git/commits{/sha}","comments_url":"https://api.github.com/repos/hornc/apivore/comments{/number}","issue_comment_url":"https://api.github.com/repos/hornc/apivore/issues/comments/{number}","contents_url":"https://api.github.com/repos/hornc/apivore/contents/{+path}","compare_url":"https://api.github.com/repos/hornc/apivore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hornc/apivore/merges","archive_url":"https://api.github.com/repos/hornc/apivore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hornc/apivore/downloads","issues_url":"https://api.github.com/repos/hornc/apivore/issues{/number}","pulls_url":"https://api.github.com/repos/hornc/apivore/pulls{/number}","milestones_url":"https://api.github.com/repos/hornc/apivore/milestones{/number}","notifications_url":"https://api.github.com/repos/hornc/apivore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hornc/apivore/labels{/name}","releases_url":"https://api.github.com/repos/hornc/apivore/releases{/id}","created_at":"2014-10-20T06:11:43Z","updated_at":"2014-10-20T06:12:27Z","pushed_at":"2014-11-05T04:05:01Z","git_url":"git://github.com/hornc/apivore.git","ssh_url":"git@github.com:hornc/apivore.git","clone_url":"https://github.com/hornc/apivore.git","svn_url":"https://github.com/hornc/apivore","homepage":null,"size":263,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hornc/apivore/pulls/2"},"html":{"href":"https://github.com/hornc/apivore/pull/2"},"issue":{"href":"https://api.github.com/repos/hornc/apivore/issues/2"},"comments":{"href":"https://api.github.com/repos/hornc/apivore/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/hornc/apivore/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/hornc/apivore/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hornc/apivore/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/hornc/apivore/statuses/0170694bdca735562ce0f7fecde2b8de2595b9a9"}}}}