{"action":"created","comment":{"url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments/45706100","id":45706100,"diff_hunk":"@@ -0,0 +1,152 @@\n+require 'test_helper'\n+\n+class BrandenburgScraperTest < ActiveSupport::TestCase\n+  def setup\n+    @scraper = BrandenburgLandtagScraper\n+    @overview = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/brandenburg_scraper_overview.html')).force_encoding('windows-1252'))\n+    @detail = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/brandenburg_scraper_detail.html')).force_encoding('windows-1252'))\n+  end\n+\n+  # webpage states that it shows 671 results but actually displays 482\n+  test 'extract overview items' do\n+    body = @scraper.extract_body(@overview)\n+    items = @scraper.extract_overview_items(body)\n+    assert_equal 482, items.length\n+  end\n+\n+  test 'extract title from item row' do\n+    body = @scraper.extract_body(@detail)\n+    item = @scraper.extract_detail_item(body)\n+    title = @scraper.extract_title(item)\n+    assert_equal 'Umzug der Schulaufsicht von Perleberg nach Neuruppin', title\n+  end\n+\n+  test 'extract originators' do\n+    body = @scraper.extract_body(@detail)\n+    item = @scraper.extract_detail_item(body)\n+    meta = @scraper.extract_meta(item)\n+    originators = @scraper.extract_originators(meta.text, Paper::DOCTYPE_MINOR_INTERPELLATION)\n+    assert_equal 'Gordon Hoffmann', originators[:people][0]\n+    assert_equal 'CDU', originators[:parties][0]\n+  end\n+\n+  test 'extract published_at' do\n+    body = @scraper.extract_body(@detail)\n+    item = @scraper.extract_detail_item(body)\n+    meta = @scraper.extract_meta(item)\n+    published_at = @scraper.extract_published_at(meta.text)\n+    assert_equal Date.parse('2015-02-13'), published_at\n+  end\n+\n+  test 'extract overview paper' do\n+    body = @scraper.extract_body(@overview)\n+    item = @scraper.extract_overview_items(body).last\n+    paper = @scraper.extract_paper_overview(item)\n+\n+    assert_equal(\n+      {\n+        legislative_term: '6',\n+      full_reference: '6/39',\n+      reference: '39',\n+      url: 'http://www.parldok.brandenburg.de/parladoku/w6/drs/ab_0001/39.pdf',\n+      published_at: Date.parse('2014-11-03'),\n+      is_answer: true\n+    }, paper)","path":"test/scraper/bayern_landtag_scraper_test.rb","position":54,"original_position":54,"commit_id":"b5161847532ac642e42bbe6a1ae9f4250073f4af","original_commit_id":"b5161847532ac642e42bbe6a1ae9f4250073f4af","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":"Indent the right brace the same as the start of the line where the left brace is.","created_at":"2015-11-24T08:09:50Z","updated_at":"2015-11-24T08:09:50Z","html_url":"https://github.com/robbi5/kleineanfragen/pull/34#discussion_r45706100","pull_request_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments/45706100"},"html":{"href":"https://github.com/robbi5/kleineanfragen/pull/34#discussion_r45706100"},"pull_request":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34","id":51628108,"html_url":"https://github.com/robbi5/kleineanfragen/pull/34","diff_url":"https://github.com/robbi5/kleineanfragen/pull/34.diff","patch_url":"https://github.com/robbi5/kleineanfragen/pull/34.patch","issue_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues/34","number":34,"state":"open","locked":false,"title":"#33 get row with originators","user":{"login":"globalworming","id":2108984,"avatar_url":"https://avatars.githubusercontent.com/u/2108984?v=3","gravatar_id":"","url":"https://api.github.com/users/globalworming","html_url":"https://github.com/globalworming","followers_url":"https://api.github.com/users/globalworming/followers","following_url":"https://api.github.com/users/globalworming/following{/other_user}","gists_url":"https://api.github.com/users/globalworming/gists{/gist_id}","starred_url":"https://api.github.com/users/globalworming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/globalworming/subscriptions","organizations_url":"https://api.github.com/users/globalworming/orgs","repos_url":"https://api.github.com/users/globalworming/repos","events_url":"https://api.github.com/users/globalworming/events{/privacy}","received_events_url":"https://api.github.com/users/globalworming/received_events","type":"User","site_admin":false},"body":"fixes #33 ","created_at":"2015-11-24T08:09:43Z","updated_at":"2015-11-24T08:09:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff9a19272f821b5572b1389e5ef66f5590e07d38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34/commits","review_comments_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34/comments","review_comment_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues/34/comments","statuses_url":"https://api.github.com/repos/robbi5/kleineanfragen/statuses/b5161847532ac642e42bbe6a1ae9f4250073f4af","head":{"label":"globalworming:#33-brandenburgscraper-detail-lineorder","ref":"#33-brandenburgscraper-detail-lineorder","sha":"b5161847532ac642e42bbe6a1ae9f4250073f4af","user":{"login":"globalworming","id":2108984,"avatar_url":"https://avatars.githubusercontent.com/u/2108984?v=3","gravatar_id":"","url":"https://api.github.com/users/globalworming","html_url":"https://github.com/globalworming","followers_url":"https://api.github.com/users/globalworming/followers","following_url":"https://api.github.com/users/globalworming/following{/other_user}","gists_url":"https://api.github.com/users/globalworming/gists{/gist_id}","starred_url":"https://api.github.com/users/globalworming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/globalworming/subscriptions","organizations_url":"https://api.github.com/users/globalworming/orgs","repos_url":"https://api.github.com/users/globalworming/repos","events_url":"https://api.github.com/users/globalworming/events{/privacy}","received_events_url":"https://api.github.com/users/globalworming/received_events","type":"User","site_admin":false},"repo":{"id":30397914,"name":"kleineanfragen","full_name":"globalworming/kleineanfragen","owner":{"login":"globalworming","id":2108984,"avatar_url":"https://avatars.githubusercontent.com/u/2108984?v=3","gravatar_id":"","url":"https://api.github.com/users/globalworming","html_url":"https://github.com/globalworming","followers_url":"https://api.github.com/users/globalworming/followers","following_url":"https://api.github.com/users/globalworming/following{/other_user}","gists_url":"https://api.github.com/users/globalworming/gists{/gist_id}","starred_url":"https://api.github.com/users/globalworming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/globalworming/subscriptions","organizations_url":"https://api.github.com/users/globalworming/orgs","repos_url":"https://api.github.com/users/globalworming/repos","events_url":"https://api.github.com/users/globalworming/events{/privacy}","received_events_url":"https://api.github.com/users/globalworming/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/globalworming/kleineanfragen","description":"","fork":true,"url":"https://api.github.com/repos/globalworming/kleineanfragen","forks_url":"https://api.github.com/repos/globalworming/kleineanfragen/forks","keys_url":"https://api.github.com/repos/globalworming/kleineanfragen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/globalworming/kleineanfragen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/globalworming/kleineanfragen/teams","hooks_url":"https://api.github.com/repos/globalworming/kleineanfragen/hooks","issue_events_url":"https://api.github.com/repos/globalworming/kleineanfragen/issues/events{/number}","events_url":"https://api.github.com/repos/globalworming/kleineanfragen/events","assignees_url":"https://api.github.com/repos/globalworming/kleineanfragen/assignees{/user}","branches_url":"https://api.github.com/repos/globalworming/kleineanfragen/branches{/branch}","tags_url":"https://api.github.com/repos/globalworming/kleineanfragen/tags","blobs_url":"https://api.github.com/repos/globalworming/kleineanfragen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/globalworming/kleineanfragen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/globalworming/kleineanfragen/git/refs{/sha}","trees_url":"https://api.github.com/repos/globalworming/kleineanfragen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/globalworming/kleineanfragen/statuses/{sha}","languages_url":"https://api.github.com/repos/globalworming/kleineanfragen/languages","stargazers_url":"https://api.github.com/repos/globalworming/kleineanfragen/stargazers","contributors_url":"https://api.github.com/repos/globalworming/kleineanfragen/contributors","subscribers_url":"https://api.github.com/repos/globalworming/kleineanfragen/subscribers","subscription_url":"https://api.github.com/repos/globalworming/kleineanfragen/subscription","commits_url":"https://api.github.com/repos/globalworming/kleineanfragen/commits{/sha}","git_commits_url":"https://api.github.com/repos/globalworming/kleineanfragen/git/commits{/sha}","comments_url":"https://api.github.com/repos/globalworming/kleineanfragen/comments{/number}","issue_comment_url":"https://api.github.com/repos/globalworming/kleineanfragen/issues/comments{/number}","contents_url":"https://api.github.com/repos/globalworming/kleineanfragen/contents/{+path}","compare_url":"https://api.github.com/repos/globalworming/kleineanfragen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/globalworming/kleineanfragen/merges","archive_url":"https://api.github.com/repos/globalworming/kleineanfragen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/globalworming/kleineanfragen/downloads","issues_url":"https://api.github.com/repos/globalworming/kleineanfragen/issues{/number}","pulls_url":"https://api.github.com/repos/globalworming/kleineanfragen/pulls{/number}","milestones_url":"https://api.github.com/repos/globalworming/kleineanfragen/milestones{/number}","notifications_url":"https://api.github.com/repos/globalworming/kleineanfragen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/globalworming/kleineanfragen/labels{/name}","releases_url":"https://api.github.com/repos/globalworming/kleineanfragen/releases{/id}","created_at":"2015-02-06T06:06:10Z","updated_at":"2015-05-07T07:49:18Z","pushed_at":"2015-11-24T08:09:18Z","git_url":"git://github.com/globalworming/kleineanfragen.git","ssh_url":"git@github.com:globalworming/kleineanfragen.git","clone_url":"https://github.com/globalworming/kleineanfragen.git","svn_url":"https://github.com/globalworming/kleineanfragen","homepage":"https://kleineanfragen.de","size":5504,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"robbi5:master","ref":"master","sha":"fabdbe4f720c06f94a402f5345bbac5da60e2320","user":{"login":"robbi5","id":172415,"avatar_url":"https://avatars.githubusercontent.com/u/172415?v=3","gravatar_id":"","url":"https://api.github.com/users/robbi5","html_url":"https://github.com/robbi5","followers_url":"https://api.github.com/users/robbi5/followers","following_url":"https://api.github.com/users/robbi5/following{/other_user}","gists_url":"https://api.github.com/users/robbi5/gists{/gist_id}","starred_url":"https://api.github.com/users/robbi5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbi5/subscriptions","organizations_url":"https://api.github.com/users/robbi5/orgs","repos_url":"https://api.github.com/users/robbi5/repos","events_url":"https://api.github.com/users/robbi5/events{/privacy}","received_events_url":"https://api.github.com/users/robbi5/received_events","type":"User","site_admin":false},"repo":{"id":23664133,"name":"kleineanfragen","full_name":"robbi5/kleineanfragen","owner":{"login":"robbi5","id":172415,"avatar_url":"https://avatars.githubusercontent.com/u/172415?v=3","gravatar_id":"","url":"https://api.github.com/users/robbi5","html_url":"https://github.com/robbi5","followers_url":"https://api.github.com/users/robbi5/followers","following_url":"https://api.github.com/users/robbi5/following{/other_user}","gists_url":"https://api.github.com/users/robbi5/gists{/gist_id}","starred_url":"https://api.github.com/users/robbi5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbi5/subscriptions","organizations_url":"https://api.github.com/users/robbi5/orgs","repos_url":"https://api.github.com/users/robbi5/repos","events_url":"https://api.github.com/users/robbi5/events{/privacy}","received_events_url":"https://api.github.com/users/robbi5/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robbi5/kleineanfragen","description":"Collecting kleine Anfragen from Parlamentsdokumentationssystemen for easy search- and linkability","fork":false,"url":"https://api.github.com/repos/robbi5/kleineanfragen","forks_url":"https://api.github.com/repos/robbi5/kleineanfragen/forks","keys_url":"https://api.github.com/repos/robbi5/kleineanfragen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robbi5/kleineanfragen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robbi5/kleineanfragen/teams","hooks_url":"https://api.github.com/repos/robbi5/kleineanfragen/hooks","issue_events_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues/events{/number}","events_url":"https://api.github.com/repos/robbi5/kleineanfragen/events","assignees_url":"https://api.github.com/repos/robbi5/kleineanfragen/assignees{/user}","branches_url":"https://api.github.com/repos/robbi5/kleineanfragen/branches{/branch}","tags_url":"https://api.github.com/repos/robbi5/kleineanfragen/tags","blobs_url":"https://api.github.com/repos/robbi5/kleineanfragen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robbi5/kleineanfragen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robbi5/kleineanfragen/git/refs{/sha}","trees_url":"https://api.github.com/repos/robbi5/kleineanfragen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robbi5/kleineanfragen/statuses/{sha}","languages_url":"https://api.github.com/repos/robbi5/kleineanfragen/languages","stargazers_url":"https://api.github.com/repos/robbi5/kleineanfragen/stargazers","contributors_url":"https://api.github.com/repos/robbi5/kleineanfragen/contributors","subscribers_url":"https://api.github.com/repos/robbi5/kleineanfragen/subscribers","subscription_url":"https://api.github.com/repos/robbi5/kleineanfragen/subscription","commits_url":"https://api.github.com/repos/robbi5/kleineanfragen/commits{/sha}","git_commits_url":"https://api.github.com/repos/robbi5/kleineanfragen/git/commits{/sha}","comments_url":"https://api.github.com/repos/robbi5/kleineanfragen/comments{/number}","issue_comment_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues/comments{/number}","contents_url":"https://api.github.com/repos/robbi5/kleineanfragen/contents/{+path}","compare_url":"https://api.github.com/repos/robbi5/kleineanfragen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robbi5/kleineanfragen/merges","archive_url":"https://api.github.com/repos/robbi5/kleineanfragen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robbi5/kleineanfragen/downloads","issues_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues{/number}","pulls_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls{/number}","milestones_url":"https://api.github.com/repos/robbi5/kleineanfragen/milestones{/number}","notifications_url":"https://api.github.com/repos/robbi5/kleineanfragen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robbi5/kleineanfragen/labels{/name}","releases_url":"https://api.github.com/repos/robbi5/kleineanfragen/releases{/id}","created_at":"2014-09-04T13:47:44Z","updated_at":"2015-05-08T13:07:39Z","pushed_at":"2015-11-24T08:09:43Z","git_url":"git://github.com/robbi5/kleineanfragen.git","ssh_url":"git@github.com:robbi5/kleineanfragen.git","clone_url":"https://github.com/robbi5/kleineanfragen.git","svn_url":"https://github.com/robbi5/kleineanfragen","homepage":"https://kleineanfragen.de","size":5522,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34"},"html":{"href":"https://github.com/robbi5/kleineanfragen/pull/34"},"issue":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/issues/34"},"comments":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/statuses/b5161847532ac642e42bbe6a1ae9f4250073f4af"}}}}