{"action":"created","comment":{"url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments/29434666","id":29434666,"diff_hunk":"@@ -0,0 +1,91 @@\n+require 'test_helper'\n+\n+class HessenTest < ActiveSupport::TestCase\n+  def setup\n+    @scraper = HessenScraper\n+    @overview = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hessen_overview.html')))\n+    @detail_minor = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hessen_detail_minor.html')))\n+    @detail_major = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hessen_detail_major.html')))\n+    @search = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hessen_search.html')))\n+    @blocks = @scraper.extract_blocks @overview\n+    @detail_block_minor = @scraper.extract_detail_block(@detail_minor)\n+    @detail_block_major = @scraper.extract_detail_block(@detail_major)\n+    @search_result = @scraper.extract_result_from_search(@search)\n+  end\n+\n+  test 'get overview blocks' do\n+    blocks = @scraper.extract_blocks @overview\n+    assert_equal 634, blocks.length\n+  end\n+\n+  test 'get detail block' do\n+    assert_equal true, @scraper.extract_detail_block(@detail_minor).content.include?('und Antw 17.02.2015 Drs')\n+    assert_equal true, @scraper.extract_detail_block(@detail_major).content.include?('23.02.2015 Drs 19/1632')\n+  end\n+\n+  test 'get reference from block' do\n+    assert_equal ['19', '1774'], @scraper.extract_reference(@blocks.first)\n+  end\n+\n+  test 'extract_interpellation_type' do\n+    assert_equal Paper::DOCTYPE_MINOR_INTERPELLATION, @scraper.extract_interpellation_type(@blocks.first)\n+  end\n+\n+  test 'extract title' do\n+    assert_equal 'Studium Generale', @scraper.extract_title(@blocks.first)\n+  end\n+\n+  test 'extract originators' do\n+    text = @scraper.extract_originator_text(@detail_block_minor)\n+    assert_equal({people: [\"Marius Weiß\", \"Norbert Schmitt\", \"Wolfgang Decker\", \"Kerstin Geis\", \"Brigitte Hofmeyer\", \"Gerald Kummer\", \"Angelika Löber\", \"Torsten Warnecke\"], parties: [\"SPD\"]}, @scraper.extract_originators(text))\n+\n+    text = \"GrAnfr             Waschke, Sabine, SPD\n+  16.10.2014 Drs 19/1030\n+  Antw 09.02.2015 Drs 19/1578\n+  PlPr 19/38  05.03.2015\n+  von Tagesordnung abgesetzt\n+  Ausschussberatung:\n+  EUA 19/13  14.04.2015 (ö)\"\n+    assert_equal({people: [\"Sabine Waschke\"], parties: [\"SPD\"]}, @scraper.extract_originators(text))\n+  end\n+\n+  test 'extract originators from text' do\n+    text = \"KlAnfr             Greilich, Wolfgang, FDP\n+  18.11.2014 und Antw 08.01.2015 Drs 19/1128\"\n+    assert_equal({people: [\"Wolfgang Greilich\"], parties: [\"FDP\"]}, @scraper.extract_originators(text))\n+  end\n+\n+  test 'get result from search' do\n+    assert_equal true, @scraper.extract_result_from_search(@search).content.include?('Europäische Förderprogramme ')\n+  end\n+\n+  test 'get reference from search result' do\n+    assert_equal ['19', '1030'], @scraper.extract_reference(@search_result)\n+  end\n+\n+  test 'extract_interpellation_type from search result' do\n+    assert_equal Paper::DOCTYPE_MINOR_INTERPELLATION, @scraper.extract_interpellation_type(@blocks.first)\n+  end\n+\n+  test 'extract answer line' do\n+    text = \"Europäische Förderprogramme\n+  GrAnfr             Waschke, Sabine, SPD; Franz, Dieter, SPD; Geis,\n+                     Kerstin, SPD; Grüger, Stephan, SPD; Kummer,\n+                     Gerald, SPD; Quanz, Lothar, SPD; Fraktion der SPD\n+  16.10.2014 Drs 19/1030\n+  Antw 09.02.2015 Drs 19/1578\n+  PlPr 19/38  05.03.2015\n+  von Tagesordnung abgesetzt\n+  Ausschussberatung:\n+  EUA 19/13  14.04.2015 (ö)\n+\n+    \"\n+    assert_equal 'Antw 09.02.2015 Drs 19/1578', @scraper.extraxct_answer_line(text)\n+    text = \"Studium Generale\n+  KlAnfr             Sommer, Daniela, Dr., SPD\n+  24.03.2015 und Antw 29.04.2015 Drs 19/1774\n+            \"\n+    assert_equal '24.03.2015 und Antw 29.04.2015 Drs 19/1774', @scraper.extraxct_answer_line(text)\n+    assert_equal true, @scraper.extraxct_answer_line(\"\").nil?","path":"test/scraper/hessen_test.rb","position":89,"original_position":89,"commit_id":"558fbea8288526b4b87b64b355e10ea2b616649a","original_commit_id":"558fbea8288526b4b87b64b355e10ea2b616649a","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":"Prefer single-quoted strings when you don't need string interpolation or special symbols.","created_at":"2015-04-30T14:36:52Z","updated_at":"2015-04-30T14:36:52Z","html_url":"https://github.com/robbi5/kleineanfragen/pull/20#discussion_r29434666","pull_request_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments/29434666"},"html":{"href":"https://github.com/robbi5/kleineanfragen/pull/20#discussion_r29434666"},"pull_request":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20","id":34461213,"html_url":"https://github.com/robbi5/kleineanfragen/pull/20","diff_url":"https://github.com/robbi5/kleineanfragen/pull/20.diff","patch_url":"https://github.com/robbi5/kleineanfragen/pull/20.patch","issue_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues/20","number":20,"state":"open","locked":false,"title":"hessen scraper","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":"","created_at":"2015-04-30T13:50:35Z","updated_at":"2015-04-30T14:36:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b61add8e6d56ef686894d4f715744fe546aeb4f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20/commits","review_comments_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20/comments","review_comment_url":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/robbi5/kleineanfragen/issues/20/comments","statuses_url":"https://api.github.com/repos/robbi5/kleineanfragen/statuses/558fbea8288526b4b87b64b355e10ea2b616649a","head":{"label":"globalworming:he-scraper","ref":"he-scraper","sha":"558fbea8288526b4b87b64b355e10ea2b616649a","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-03-12T12:21:48Z","pushed_at":"2015-04-30T14:36:46Z","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":4529,"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":"f6ed9cc78d7d8705da638bf02521f7ab6e91f3ba","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-04-29T13:25:56Z","pushed_at":"2015-04-30T14:36:47Z","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":5349,"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/20"},"html":{"href":"https://github.com/robbi5/kleineanfragen/pull/20"},"issue":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/issues/20"},"comments":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/robbi5/kleineanfragen/statuses/558fbea8288526b4b87b64b355e10ea2b616649a"}}}}