govkit 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/.rspec +3 -0
  2. data/Gemfile +13 -0
  3. data/README.md +0 -5
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/generators/govkit/templates/govkit.rb +3 -0
  7. data/govkit.gemspec +41 -13
  8. data/lib/gov_kit/acts_as_noteworthy.rb +15 -9
  9. data/lib/gov_kit/configuration.rb +3 -1
  10. data/lib/gov_kit/open_congress/bill.rb +3 -5
  11. data/lib/gov_kit/open_congress/blog_post.rb +3 -7
  12. data/lib/gov_kit/open_congress/news_post.rb +3 -7
  13. data/lib/gov_kit/open_congress/person.rb +2 -4
  14. data/lib/gov_kit/open_congress/person_stat.rb +2 -7
  15. data/lib/gov_kit/open_congress/roll_call.rb +4 -6
  16. data/lib/gov_kit/open_congress/roll_call_comparison.rb +1 -4
  17. data/lib/gov_kit/open_congress/voting_comparison.rb +1 -3
  18. data/lib/gov_kit/open_congress.rb +8 -0
  19. data/lib/gov_kit/open_states.rb +63 -14
  20. data/lib/gov_kit/railtie.rb +4 -0
  21. data/lib/gov_kit/resource.rb +62 -12
  22. data/lib/gov_kit/search_engines/bing.rb +38 -0
  23. data/lib/gov_kit/search_engines/google_blog.rb +3 -2
  24. data/lib/gov_kit/search_engines/google_news.rb +26 -16
  25. data/lib/gov_kit/search_engines/technorati.rb +1 -0
  26. data/lib/gov_kit/search_engines/wikipedia.rb +1 -1
  27. data/lib/gov_kit/search_engines.rb +1 -0
  28. data/lib/gov_kit/transparency_data.rb +98 -0
  29. data/lib/gov_kit/vote_smart.rb +9 -2
  30. data/lib/gov_kit.rb +4 -2
  31. data/spec/fixtures/bing/news_search.response +1 -0
  32. data/spec/fixtures/bing/no_results.response +1 -0
  33. data/spec/fixtures/open_congress/person.response +8 -0
  34. data/spec/fixtures/open_states/401.response +8 -4
  35. data/spec/fixtures/open_states/404.response +9 -0
  36. data/spec/fixtures/open_states/committee_find.response +53 -0
  37. data/spec/fixtures/open_states/committee_query.response +190 -0
  38. data/spec/fixtures/search_engines/google_news.response +8 -0
  39. data/spec/fixtures/transparency_data/contributions.response +18 -0
  40. data/spec/fixtures/transparency_data/entities_search.response +7 -0
  41. data/spec/fixtures/transparency_data/entities_search_limit_0.response +7 -0
  42. data/spec/fixtures/transparency_data/entities_search_limit_1.response +7 -0
  43. data/spec/fixtures/transparency_data/grants_find_all.response +7 -0
  44. data/spec/fixtures/transparency_data/lobbyists_find_all.response +7 -0
  45. data/spec/follow_the_money_spec.rb +7 -3
  46. data/spec/open_congress_spec.rb +36 -0
  47. data/spec/open_states_spec.rb +98 -16
  48. data/spec/search_engines_spec.rb +44 -0
  49. data/spec/spec_helper.rb +2 -3
  50. data/spec/transparency_data_spec.rb +106 -0
  51. metadata +118 -32
  52. data/spec/spec.opts +0 -6
@@ -0,0 +1,18 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Mon, 11 Apr 2011 19:46:53 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ Authorization:
7
+
8
+ [
9
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "D", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9020", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "4150", "parent_organization_name": "", "contributor_address": "3208 WOODLAND PARK DR", "transaction_id": "a980ecbe2fe713d4f7e57bea743fb5dd", "contributor_occupation": "", "filing_id": "", "contributor_city": "ANCHORAGE", "recipient_state_held": "", "district_held": "", "recipient_name": "FRENCH II, HOLLIS S", "organization_ext_id": "", "contributor_zipcode": "99517", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-10-04", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "FRENCH II, HOLLIS S", "contributor_type": "", "contributor_employer": "", "seat_result": "W", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
10
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9010", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "134213", "parent_organization_name": "", "contributor_address": "PO BOX 30009", "transaction_id": "cc17aa1b13fef861e777337443c15deb", "contributor_occupation": "", "filing_id": "", "contributor_city": "CENTRAL", "recipient_state_held": "", "district_held": "", "recipient_name": "CARTER, MAC", "organization_ext_id": "", "contributor_zipcode": "99730", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-03-15", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "CARTER, MAC", "contributor_type": "", "contributor_employer": "", "seat_result": "L", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
11
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z1100", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "CITIZENS FOR DAVE DONLEY", "recipient_ext_id": "13432", "parent_organization_name": "", "contributor_address": "4852 NEWCASTLE WAY", "transaction_id": "4c0b1c4a1749d5418322237bbc3e69f7", "contributor_occupation": "", "filing_id": "", "contributor_city": "ANCHORAGE", "recipient_state_held": "", "district_held": "", "recipient_name": "DONLEY, DAVE", "organization_ext_id": "", "contributor_zipcode": "99503", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-07-26", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "CITIZENS FOR DAVE DONLEY", "contributor_type": "C", "contributor_employer": "", "seat_result": "L", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
12
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9010", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "135818", "parent_organization_name": "", "contributor_address": "200 W 34TH AVE PMB 207", "transaction_id": "fee02c37c584c94ad17b37fcc265c21b", "contributor_occupation": "", "filing_id": "", "contributor_city": "ANCHORAGE", "recipient_state_held": "", "district_held": "", "recipient_name": "HEINZE, HAROLD", "organization_ext_id": "", "contributor_zipcode": "99503", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-10-02", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "HEINZE, HAROLD", "contributor_type": "", "contributor_employer": "", "seat_result": "L", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
13
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9010", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "4175", "parent_organization_name": "", "contributor_address": "1625 OLD STEESE HWY", "transaction_id": "8b354ef63c07e34ed5c4e30af05545c6", "contributor_occupation": "", "filing_id": "", "contributor_city": "FAIRBANKS", "recipient_state_held": "", "district_held": "", "recipient_name": "SEEKINS, RALPH C", "organization_ext_id": "", "contributor_zipcode": "99701", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-10-02", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "SEEKINS, RALPH C", "contributor_type": "", "contributor_employer": "", "seat_result": "W", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
14
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9010", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "4175", "parent_organization_name": "", "contributor_address": "1625 OLD STEESE HWY", "transaction_id": "213a7419bf0642cb871c45e0d6c7c062", "contributor_occupation": "", "filing_id": "", "contributor_city": "FAIRBANKS", "recipient_state_held": "", "district_held": "", "recipient_name": "SEEKINS, RALPH C", "organization_ext_id": "", "contributor_zipcode": "99701", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-06-24", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "SEEKINS, RALPH C", "contributor_type": "", "contributor_employer": "", "seat_result": "W", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
15
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9010", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "20439", "parent_organization_name": "", "contributor_address": "PO BOX 7351", "transaction_id": "0d438bc9c5bc86c90d36e79ef89be9db", "contributor_occupation": "", "filing_id": "", "contributor_city": "NIKISKI", "recipient_state_held": "", "district_held": "", "recipient_name": "WARD, JERRY", "organization_ext_id": "", "contributor_zipcode": "99635", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-07-25", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "WARD, JERRY", "contributor_type": "", "contributor_employer": "", "seat_result": "L", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""},
16
+ {"seat": "state:upper", "committee_ext_id": "", "seat_held": "", "recipient_party": "R", "recipient_type": "P", "seat_status": "", "recipient_state": "AK", "contributor_category": "Z9010", "contributor_gender": "", "contributor_state": "AK", "recipient_category": "", "is_amendment": false, "district": "", "organization_name": "", "recipient_ext_id": "139048", "parent_organization_name": "", "contributor_address": "2207 SPENARD RD STE 100", "transaction_id": "613e3cc3b2758324c597d7f37bc976ff", "contributor_occupation": "", "filing_id": "", "contributor_city": "ANCHORAGE", "recipient_state_held": "", "district_held": "", "recipient_name": "WORTHEN, TIM", "organization_ext_id": "", "contributor_zipcode": "99503", "transaction_namespace": "urn:nimsp:transaction", "date": "2002-09-05", "committee_name": "", "candidacy_status": true, "parent_organization_ext_id": "", "cycle": 2002, "contributor_name": "WORTHEN, TIMOTHY J", "contributor_type": "", "contributor_employer": "", "seat_result": "L", "transaction_type": "", "amount": "10000.00", "contributor_ext_id": "", "committee_party": ""}
17
+
18
+ ]
@@ -0,0 +1,7 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Thu, 14 Apr 2011 18:55:36 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+
7
+ [{"name": "Nancy Pelosi (D)", "count_given": 0, "firm_income": 0.0, "count_lobbied": 0, "seat": "federal:house", "total_received": 12163810.0, "state": "CA", "lobbying_firm": null, "count_received": 9190, "party": "D", "total_given": 0.0, "type": "politician", "id": "85ab2e74589a414495d18cc7a9233981", "non_firm_spending": 0.0},{"name": "Nancy Pelosi for Congress", "count_given": 1133, "firm_income": 0.0, "count_lobbied": 0, "seat": null, "total_received": 0.0, "state": null, "lobbying_firm": false, "count_received": 0, "party": null, "total_given": 1538428.0, "type": "organization", "id": "afb432ec90454c8a83a3113061e7be27", "non_firm_spending": 0.0}]
@@ -0,0 +1,7 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Thu, 14 Apr 2011 18:55:36 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+
7
+ []
@@ -0,0 +1,7 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Thu, 14 Apr 2011 18:55:36 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+
7
+ [{"name": "Nancy Pelosi (D)", "count_given": 0, "firm_income": 0.0, "count_lobbied": 0, "seat": "federal:house", "total_received": 12163810.0, "state": "CA", "lobbying_firm": null, "count_received": 9190, "party": "D", "total_given": 0.0, "type": "politician", "id": "85ab2e74589a414495d18cc7a9233981", "non_firm_spending": 0.0}]
@@ -0,0 +1,7 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Tue, 12 Apr 2011 02:49:40 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+
7
+ [{"progsrc_acnt_code": "", "principal_place_state": "FLORIDA", "non_fed_funding_amount": 0, "rec_flag": false, "recipient_zip": "", "fiscal_year": 2011, "progsrc_subacnt_code": "", "record_type": "1", "cfda_program_num": "97.022", "ending_date": null, "recipient_type": "21", "transaction_status": "active", "principal_place_cc": "BROWARD", "face_loan_guran": 0, "principal_place_cd": "", "total_funding_amount": 8076597900, "orig_sub_guran": 0, "principal_place_code": "12**011", "agency_code": "7022", "recipient_county_code": "011", "assistance_type": "09", "uri": "12011,,,,,,,~1027938375201111", "recipient_country_code": "USA", "maj_agency_cat": "70", "starting_date": null, "imported_on": "2011-03-14", "duns_conf_code": "", "account_title": "", "project_description": "NATIONAL FLOOD INSURANCE PROGRAM", "recipient_city_code": "", "duns_no": "", "recipient_county_name": "BROWARD", "cfda_program_title": "FLOOD INSURANCE", "recip_cat_type": "i", "sai_number": "", "obligation_action_date": "2010-11-30", "fyq": "201102011", "progsrc_agen_code": "70", "federal_award_mod": "", "principal_place_state_code": "FL", "recipient_name": "MULTIPLE RECIPIENTS", "receip_addr2": "", "receip_addr3": "", "receip_addr1": "", "recipient_cd": "ZZ", "recipient_city_name": "", "federal_award_id": "", "fed_funding_amount": 0, "recipient_state_code": "FL", "unique_transaction_id": "891efe71ebbb7d34b827bdce16cf9b71", "agency_name": "FEDERAL EMERGENCY MANAGEMENT AGENCY", "principal_place_zip": "", "fyq_correction": "", "action_type": "", "correction_late_ind": "", "asst_cat_type": "i"},{"progsrc_acnt_code": "0512", "principal_place_state": "NEW YORK", "non_fed_funding_amount": 0, "rec_flag": false, "recipient_zip": "12237", "fiscal_year": 2011, "progsrc_subacnt_code": "", "record_type": "2", "cfda_program_num": "93.778", "ending_date": "2010-12-31", "recipient_type": "00", "transaction_status": "active", "principal_place_cc": "ALBANY", "face_loan_guran": 0, "principal_place_cd": "22", "total_funding_amount": 7223838000, "orig_sub_guran": 0, "principal_place_code": "", "agency_code": "7530", "recipient_county_code": "001", "assistance_type": "03", "uri": "75-227-NY20111-1-1-2011-93778-75-0512-NON", "recipient_country_code": "USA", "maj_agency_cat": "75", "starting_date": "2010-10-01", "imported_on": "2011-03-14", "duns_conf_code": "", "account_title": "Grants to States for Medicaid", "project_description": "MEDICAID ENTITLEMENT FOR NEW YORK - FY 2011 QUARTER 1 - T19", "recipient_city_code": "01000", "duns_no": "806781340", "recipient_county_name": "Albany", "cfda_program_title": "Medical Assistance Program (Medicaid)", "recip_cat_type": "g", "sai_number": "SAI UNAVAILABLE", "obligation_action_date": "2010-10-01", "fyq": "201010291", "progsrc_agen_code": "75", "federal_award_mod": "1", "principal_place_state_code": "NY", "recipient_name": "NY ST DEPT OF HEALTH", "receip_addr2": "", "receip_addr3": "", "receip_addr1": "GNARESP CORNING TWR RM 1395", "recipient_cd": "NY21", "recipient_city_name": "ALBANY", "federal_award_id": "NY20111", "fed_funding_amount": 7223838000, "recipient_state_code": "NY", "unique_transaction_id": "679fd2b6b204328bc7e0811892809399", "agency_name": "DEPARTMENT OF HEALTH AND HUMAN SERVICES", "principal_place_zip": "0", "fyq_correction": "", "action_type": "A", "correction_late_ind": "", "asst_cat_type": "g"},{"progsrc_acnt_code": "0512", "principal_place_state": "NEW YORK", "non_fed_funding_amount": 0, "rec_flag": false, "recipient_zip": "12237", "fiscal_year": 2011, "progsrc_subacnt_code": "", "record_type": "2", "cfda_program_num": "93.778", "ending_date": "2011-03-31", "recipient_type": "00", "transaction_status": "active", "principal_place_cc": "ALBANY", "face_loan_guran": 0, "principal_place_cd": "22", "total_funding_amount": 6907531000, "orig_sub_guran": 0, "principal_place_code": "", "agency_code": "7530", "recipient_county_code": "001", "assistance_type": "03", "uri": "75-227-NY20112-0-1-2011-93778-75-0512-NON", "recipient_country_code": "USA", "maj_agency_cat": "75", "starting_date": "2011-01-01", "imported_on": "2011-03-14", "duns_conf_code": "", "account_title": "Grants to States for Medicaid", "project_description": "MEDICAID ENTITLEMENT FOR NEW YORK - FY 2011 QUARTER 2 - T19", "recipient_city_code": "01000", "duns_no": "806781340", "recipient_county_name": "Albany", "cfda_program_title": "Medical Assistance Program (Medicaid)", "recip_cat_type": "g", "sai_number": "SAI UNAVAILABLE", "obligation_action_date": "2011-01-01", "fyq": "201101211", "progsrc_agen_code": "75", "federal_award_mod": "0", "principal_place_state_code": "NY", "recipient_name": "NY ST DEPT OF HEALTH", "receip_addr2": "", "receip_addr3": "", "receip_addr1": "GNARESP CORNING TWR RM 1395", "recipient_cd": "NY21", "recipient_city_name": "ALBANY", "federal_award_id": "NY20112", "fed_funding_amount": 6907531000, "recipient_state_code": "NY", "unique_transaction_id": "9cf4728d045d93efdebf720476b8109d", "agency_name": "DEPARTMENT OF HEALTH AND HUMAN SERVICES", "principal_place_zip": "0", "fyq_correction": "", "action_type": "A", "correction_late_ind": "", "asst_cat_type": "g"}]
@@ -0,0 +1,7 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx/0.7.67
3
+ Date: Mon, 11 Apr 2011 23:02:23 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+
7
+ [{"registrant_name": "Brookfield Atlantic", "filing_type": "p", "client_category": "C5130", "client_name": "Brookfield Atlantic", "agencies": [{"agency_name": "Central Intelligence Agency", "agency_ext_id": "044 "}, {"agency_name": "Def Advanced Research Projects Agency", "agency_ext_id": "116 "}, {"agency_name": "Defense Business Transformation Agency", "agency_ext_id": "248 "}, {"agency_name": "Dept of Defense", "agency_ext_id": "025 "}, {"agency_name": "Dept of Navy", "agency_ext_id": "031 "}, {"agency_name": "Economic Development Administration", "agency_ext_id": "108 "}, {"agency_name": "Executive Office of the President", "agency_ext_id": "011 "}, {"agency_name": "National Geospatial-Intelligence Agency", "agency_ext_id": "126 "}, {"agency_name": "National Security Agency", "agency_ext_id": "127 "}, {"agency_name": "National Security Council", "agency_ext_id": "016 "}, {"agency_name": "Office of Director of Natl Intelligence", "agency_ext_id": "214 "}, {"agency_name": "US House of Representatives", "agency_ext_id": "002 "}, {"agency_name": "US Marine Corps", "agency_ext_id": "210 "}, {"agency_name": "US Senate", "agency_ext_id": "001 "}, {"agency_name": "White House", "agency_ext_id": "012 "}], "client_ext_id": null, "transaction_type": "q4", "client_parent_name": "Brookfield Atlantic", "amount": "550000.00", "transaction_id": "19E29BE9-B5AC-4058-92C6-07DA9F64537C", "lobbyists": [{"member_of_congress": false, "candidate_ext_id": null, "government_position": null, "lobbyist_name": "Dunn, Jennifer B", "lobbyist_ext_id": "Y00000403020"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": null, "lobbyist_name": "Montgomery, Wayne", "lobbyist_ext_id": "Y00000349490"}], "year": 2011, "transaction_type_desc": "FOURTH QUARTER REPORT", "registrant_is_firm": false, "issues": [{"specific_issue": "Lobbied the US Department of Defense to take over major US defense projects (R&D) that can not be completed with U.S. Public funds due to deficit reduction as well the firm lobbied the NSA & CIA to sell stakes and interest in major satellite programs.", "general_issue": "Defense", "general_issue_code": "DEF"}]},{"registrant_name": "Quantico North NFP Ltd", "filing_type": "p", "client_category": "g5270", "client_name": "Quantico North NFP Ltd", "agencies": [{"agency_name": "Dept of State", "agency_ext_id": "039 "}, {"agency_name": "National Security Agency", "agency_ext_id": "127 "}, {"agency_name": "National Security Council", "agency_ext_id": "016 "}, {"agency_name": "Overseas Private Investment Corporation", "agency_ext_id": "203 "}, {"agency_name": "US House of Representatives", "agency_ext_id": "002 "}, {"agency_name": "US Senate", "agency_ext_id": "001 "}], "client_ext_id": null, "transaction_type": "q4", "client_parent_name": "Quantico North NFP Ltd", "amount": "350000.00", "transaction_id": "FF564278-5E5C-430C-92C7-8E0175299951", "lobbyists": [{"member_of_congress": false, "candidate_ext_id": null, "government_position": null, "lobbyist_name": "Montgomery, Wayne", "lobbyist_ext_id": "Y00000349490"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": null, "lobbyist_name": "North, Lucas", "lobbyist_ext_id": "Y00000448080"}], "year": 2011, "transaction_type_desc": "FOURTH QUARTER REPORT", "registrant_is_firm": false, "issues": [{"specific_issue": "Intelligence & Surveillance , Nuclear Energy , Defense", "general_issue": "Foreign Relations", "general_issue_code": "FOR"}]},{"registrant_name": "Frontier Communications", "filing_type": "p", "client_category": "C4100", "client_name": "Frontier Communications", "agencies": [{"agency_name": "Federal Communications Commission", "agency_ext_id": "053 "}, {"agency_name": "US House of Representatives", "agency_ext_id": "002 "}, {"agency_name": "US Senate", "agency_ext_id": "001 "}], "client_ext_id": null, "transaction_type": "q4", "client_parent_name": "Frontier Communications", "amount": "175000.00", "transaction_id": "22D92EAB-1ABD-4D86-BEF1-32E4DB543F63", "lobbyists": [{"member_of_congress": false, "candidate_ext_id": null, "government_position": null, "lobbyist_name": "Schneider, Jennifer", "lobbyist_ext_id": "Y00000448510"}], "year": 2011, "transaction_type_desc": "FOURTH QUARTER REPORT", "registrant_is_firm": false, "issues": [{"specific_issue": "House and Senate: H.R. 1409 - Employee Free Choice Act of 2009; Tax Reform; monitored general telecommunications, USF, and rural broadband issues. \nFCC: Open Internet Proceeding; Role of the Universal Service Fund and Intercarrier Compensation in the National Broadband Plan; other FCC-related matters.", "general_issue": "Telecommunications", "general_issue_code": "TEC"}]},{"registrant_name": "Capitol Tax Partners", "filing_type": "n", "client_category": "E1500", "client_name": "Clean Coal Solutions", "agencies": [{"agency_name": "Dept of Treasury", "agency_ext_id": "041 "}, {"agency_name": "US House of Representatives", "agency_ext_id": "002 "}, {"agency_name": "US Senate", "agency_ext_id": "001 "}], "client_ext_id": null, "transaction_type": "q1t", "client_parent_name": "Clean Coal Solutions", "amount": "150000.00", "transaction_id": "D5B896AE-6AB5-475A-8992-5042E98BD554", "lobbyists": [{"member_of_congress": false, "candidate_ext_id": null, "government_position": "Deputy Chief of Staff, JCT", "lobbyist_name": "Grafmeyer, Richard", "lobbyist_ext_id": "Y00000316380"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": null, "lobbyist_name": "Hooper, Lindsay D", "lobbyist_ext_id": "Y00000053811"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Tax Counsel, Sen. Grassley, Sen. Finance Comm.", "lobbyist_name": "Javens, Chris L", "lobbyist_ext_id": "Y00000021000"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Staff Director, Ways & Means Over Sub", "lobbyist_name": "McKenney, William", "lobbyist_ext_id": "Y00000318210"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Tax Legislative Counsel - US Treasury", "lobbyist_name": "Mikrut, Joseph", "lobbyist_ext_id": "Y00000186820"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Assistant Treasury Secretary for Tax Policy", "lobbyist_name": "Talisman, Jonathan", "lobbyist_ext_id": "Y00000204320"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Staff Director, Senate Republican Policy Committee", "lobbyist_name": "Willcox, Lawrence G", "lobbyist_ext_id": "Y00000236600"}], "year": 2011, "transaction_type_desc": "FIRST QUARTER TERMINATION", "registrant_is_firm": true, "issues": [{"specific_issue": "Legislative and regulatory services related to the tax treatment of refined coal including: H.R. 4213, the Tax Extenders Act of 2009; S. 2826, the Clean Renewable Energy Advancement Tax Extension Jobs Act of 2009; S. 3793, the Job Creation and Tax Cuts Act; H.R. 5893, the Investing in American Jobs and Closing Tax Loopholes Act of 2010; H.R. 4853, the Tax Relief, Unemployment Insurance Reauthorization, and Job Creation Act of 2010; H.R. 6467, the Middle Class Tax Relief Act of 2010; and S. 3793, the Job Creation and Tax Cuts Act.", "general_issue": "Taxes", "general_issue_code": "TAX"}]},{"registrant_name": "YMCA of the USA", "filing_type": "p", "client_category": "x4000", "client_name": "YMCA of the USA", "agencies": [{"agency_name": "Centers for Disease Control & Prevention", "agency_ext_id": "134 "}, {"agency_name": "Consumer Product Safety Commission", "agency_ext_id": "046 "}, {"agency_name": "Dept of Education", "agency_ext_id": "032 "}, {"agency_name": "Dept of Health & Human Services", "agency_ext_id": "034 "}, {"agency_name": "Dept of Interior", "agency_ext_id": "036 "}, {"agency_name": "Dept of Justice", "agency_ext_id": "037 "}, {"agency_name": "Dept of Labor", "agency_ext_id": "038 "}, {"agency_name": "Executive Office of the President", "agency_ext_id": "011 "}, {"agency_name": "Faith-Based & Community Inititiatives", "agency_ext_id": "202 "}, {"agency_name": "Federal Bureau of Investigation", "agency_ext_id": "150 "}, {"agency_name": "Forest Service", "agency_ext_id": "212 "}, {"agency_name": "Internal Revenue Service", "agency_ext_id": "188 "}, {"agency_name": "National Park Service", "agency_ext_id": "143 "}, {"agency_name": "US House of Representatives", "agency_ext_id": "002 "}, {"agency_name": "US Senate", "agency_ext_id": "001 "}], "client_ext_id": null, "transaction_type": "q4", "client_parent_name": "YMCA of the USA", "amount": "100000.00", "transaction_id": "AB859B94-F1A8-4614-B510-AC735496B4F1", "lobbyists": [{"member_of_congress": false, "candidate_ext_id": null, "government_position": "Fmr. L.D. Rep. Sanders (D-VT)", "lobbyist_name": "Adamson, Katie", "lobbyist_ext_id": "Y00000040250"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Fmr. Dep. Chief of Staff. Sen. Moynihan (D-NY)", "lobbyist_name": "Bland, Richard", "lobbyist_ext_id": "Y00000112190"}, {"member_of_congress": false, "candidate_ext_id": null, "government_position": "Fmr. Chief of Staff, Wife of VP Gore, Tipper Gore", "lobbyist_name": "Haynes, Audrey", "lobbyist_ext_id": "Y0000040744@"}], "year": 2011, "transaction_type_desc": "FOURTH QUARTER REPORT", "registrant_is_firm": false, "issues": [{"specific_issue": "- Extension of the IRA Rollover Charitable Tax Incentive \n-- other provisions relating to nonprofit organizations and tax incentives for charitable giving", "general_issue": "Taxes", "general_issue_code": "TAX"}, {"specific_issue": "Prevention and wellness provisions/regulations in the Patient Protection and Affordable Care Act -- like prevention fund, task force and strategy; as well as Employer Mandate and small Employer Tax Credit", "general_issue": "Health Issues", "general_issue_code": "HCR"}, {"specific_issue": "Interpretation of federal regulations on public pools through the Virginia Graeme Baker Act of 2007, as interpreted and regulated through the Consumer Product Safety Commission.\nInterpretation and guidance on CPSC ban of \"drop-side\" cribs.", "general_issue": "Health Issues", "general_issue_code": "HCR"}, {"specific_issue": "-Efforts to promote YMCA solutions to childhood obesity\n-Efforts to promote YMCA solutions to child care needs and after school needs in US.", "general_issue": "Health Issues", "general_issue_code": "HCR"}, {"specific_issue": "-- Support for the Child Protection Improvements Act of 2009, (The Background Checks Bill) to improve and provide funding for federal background checks for youth serving organizations", "general_issue": "Health Issues", "general_issue_code": "HCR"}, {"specific_issue": "- New Partnerships with the US Forest Service (a subdivision of the USDA) and the US Park Service (a subdivision of the Dept. of Interior) to increase overall public health through physical activity and access to public lands\n- Premitting requirements for YMCA Camps: to have access to Forest Service and Park Service lands through favorable regulations towards nonprofit camps like the YMCA that promote stewardship of the land and give financial assistance", "general_issue": "Health Issues", "general_issue_code": "HCR"}, {"specific_issue": "-Support for legislation that promoted increased physical activity for children, before, during and after school\n-Support for legislation that promotes increased physical activity, better nutrition and healthy living for all adults.\n-Elementary and Seconday Education Act (ESEA) aka No Child Left Behind Legislation Reauthorization (NCLB)- with a focus on promoting health and wellbeing through nutrition and physical activity for children", "general_issue": "Education", "general_issue_code": "EDU"}, {"specific_issue": "FY'11 Labor/HHS/Education Appropriations - provisions related to afterschool, child care, disease prevention and health promotion\nFY'11 Commerce/Justice/Science Appropriations - provisions related to juvenile delinquincy prevention and gang prevention programs", "general_issue": "Fed Budget & Appropriations", "general_issue_code": "BUD"}]}]
@@ -1,5 +1,9 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
+ # Provides "String.singularize"
4
+ # which is used by resource_for_collection, in resource.rb
5
+ require 'active_support/inflector'
6
+
3
7
  module GovKit::FollowTheMoney
4
8
  describe GovKit::FollowTheMoney do
5
9
 
@@ -25,10 +29,10 @@ module GovKit::FollowTheMoney
25
29
  end
26
30
  end
27
31
 
28
- it "should raise NotAuthorizedError if the api key is not valid" do
32
+ it "should raise NotAuthorized if the api key is not valid" do
29
33
  lambda do
30
34
  @contribution = Contribution.find(0)
31
- end.should raise_error(GovKit::NotAuthorizedError)
35
+ end.should raise_error(GovKit::NotAuthorized)
32
36
 
33
37
  @contribution.should be_nil
34
38
  end
@@ -54,4 +58,4 @@ module GovKit::FollowTheMoney
54
58
  end
55
59
 
56
60
  end
57
- end
61
+ end
@@ -0,0 +1,36 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ module GovKit::OpenCongress
4
+ describe GovKit::OpenCongress do
5
+ before(:all) do
6
+ base_uri = "http://www.opencongress.org/api/"
7
+
8
+ # An array of uris and filenames
9
+ # Use FakeWeb to intercept net requests;
10
+ # if a requested uri matches one of the following,
11
+ # then return the contents of the corresponding file
12
+ # as the result.
13
+ urls = [
14
+ [ "people?key=YOUR_OPENCONGRESS_API_KEY&district=1&state=FL&format=json", "person.response" ]
15
+ ]
16
+
17
+ urls.each do |u|
18
+ FakeWeb.register_uri(:get, "#{base_uri}#{u[0]}", :response => File.join(FIXTURES_DIR, 'open_congress', u[1]))
19
+ end
20
+ end
21
+
22
+ describe Person do
23
+ context "#find" do
24
+ it "should find a specific person" do
25
+ lambda do
26
+ @person = Person.find(:district => 1, :state => "FL").first
27
+ end.should_not raise_error
28
+
29
+ @person.should be_an_instance_of(Person)
30
+ @person.firstname.should == "Jeff"
31
+ @person.lastname.should == "Miller"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,21 +1,63 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
+ # Provides "String.singularize"
4
+ # which is used by resource_for_collection, in resource.rb
5
+ require 'active_support/inflector'
6
+
7
+ # Provides string.last()
8
+ # which is used by method_missing in resource.rb
9
+ require 'active_support/core_ext/string'
10
+
3
11
  module GovKit::OpenStates
4
12
  describe GovKit::OpenStates do
5
13
  before(:all) do
6
14
  base_uri = GovKit::OpenStatesResource.base_uri.gsub(/\./, '\.')
7
15
 
16
+ # An array of uris and filenames
17
+ # Use FakeWeb to intercept net requests;
18
+ # if a requested uri matches one of the following,
19
+ # then return the contents of the corresponding file
20
+ # as the result.
8
21
  urls = [
9
- ['/ca/\?', 'state.response'],
10
- ['/bills/ca/20092010/AB667/', 'bill.response'],
11
- ['/bills/search/\?', 'bill_query.response'],
22
+ ['/bills/ca/20092010/AB667/', 'bill.response'],
23
+ ['/bills/\?.*q=cooperatives.*', 'bill_query.response'],
24
+ ['/bills/\?.*state=tx.*', 'bill_query.response'],
25
+ ['/bills/\?.*q=professions.*', 'bill.response'],
12
26
  ['/bills/latest/\?', 'bill_query.response'],
13
27
  ['/legislators/2462/\?', 'legislator.response'],
14
28
  ['/legislators/410/\?', '410.response'],
15
29
  ['/legislators/401/\?', '401.response'],
16
- ['/legislators/search/\?', 'legislator_query.response']
30
+ ['/legislators/404/\?', '404.response'],
31
+ ['/legislators/\?.*state=zz.*', '404.response'],
32
+ ['/legislators/\?.*state=ca.*', 'legislator.response'],
33
+ ['/committees/MDC000012/', 'committee_find.response'],
34
+ ['/committees/\?.*state=md', 'committee_query.response'],
35
+ ['/metadata/ca/\?', 'state.response']
17
36
  ]
18
37
 
38
+ # First convert each of the uri strings above into regexp's before
39
+ # passing them on to register_uri.
40
+ #
41
+ # Internally, before checking if a new uri string matches one of the registered uri's,
42
+ # FakeWeb normalizes it by parsing it with URI.parse(string), and then
43
+ # calling URI.normalize on the resulting URI. This appears to reorder any
44
+ # query parameters alphabetically by key.
45
+ #
46
+ # So the uri
47
+ # http://openstates.sunlightlabs.com/api/v1/legislators/?state=zz&output=json&apikey=
48
+ # would actually not match a registered uri of
49
+ # ['/legislators/\?state=zz', '404.response'],
50
+ # or
51
+ # ['/legislators/\?state=zz*', '404.response'],
52
+ # or even
53
+ # ['/legislators/\?state=zz&output=json&apikey=', '404.response'],
54
+ #
55
+ # But it would match a registered uri of
56
+ # ['/legislators/\?apikey=&output=json&state=zz', '404.response'],
57
+ # or
58
+ # ['/legislators/\?(.*)state=zz(.*)', '404.response'],
59
+
60
+
19
61
  urls.each do |u|
20
62
  FakeWeb.register_uri(:get, %r|#{base_uri}#{u[0]}|, :response => File.join(FIXTURES_DIR, 'open_states', u[1]))
21
63
  end
@@ -23,15 +65,14 @@ module GovKit::OpenStates
23
65
 
24
66
  it "should have the base uri set properly" do
25
67
  [State, Bill, Legislator].each do |klass|
26
- klass.base_uri.should == "http://fiftystates-dev.sunlightlabs.com/api"
68
+ klass.base_uri.should == "http://openstates.sunlightlabs.com/api/v1"
27
69
  end
28
70
  end
29
71
 
30
- it "should raise NotAuthorizedError if the api key is not valid" do
31
- # The Open States API returns a 401 Not Authorized if the API key is invalid.
72
+ it "should raise NotAuthorized if the api key is not valid" do
32
73
  lambda do
33
74
  @legislator = Legislator.find(401)
34
- end.should raise_error(GovKit::NotAuthorizedError)
75
+ end.should raise_error(GovKit::NotAuthorized)
35
76
 
36
77
  @legislator.should be_nil
37
78
  end
@@ -55,9 +96,9 @@ module GovKit::OpenStates
55
96
 
56
97
  describe Bill do
57
98
  context "#find" do
58
- it "should find a bill by stat abbreviation, session, chamber, bill_id" do
99
+ it "should find a bill by state abbreviation, session, chamber, bill_id" do
59
100
  lambda do
60
- @bill = Bill.find('ca', 20092010, 'lower', 'AB667')
101
+ @bill = Bill.find('ca', '20092010', 'lower', 'AB667')
61
102
  end.should_not raise_error
62
103
 
63
104
  @bill.should be_an_instance_of(Bill)
@@ -75,12 +116,20 @@ module GovKit::OpenStates
75
116
  end
76
117
  @bills.collect(&:bill_id).should include("SB 921")
77
118
  end
119
+
120
+ it "should return a single bill result as an array" do
121
+ @bills = Bill.search('professions')
122
+
123
+ @bills.should be_an_instance_of(Array)
124
+ @bills.collect(&:bill_id).should include("AB667")
125
+ end
126
+
78
127
  end
79
128
 
80
129
  context "#latest" do
81
130
  it "should get the latest bills by given criteria" do
82
131
  lambda do
83
- @latest = Bill.latest('2010-01-01','tx')
132
+ @latest = Bill.latest('2010-01-01', :state => 'tx')
84
133
  end.should_not raise_error
85
134
 
86
135
  @latest.should be_an_instance_of(Array)
@@ -104,12 +153,10 @@ module GovKit::OpenStates
104
153
  @legislator.last_name.should == "Cox"
105
154
  end
106
155
 
107
- it "should raise a GovKitError if the legislator is not found" do
108
- lambda do
109
- @legislator = Legislator.find(410)
110
- end.should raise_error(GovKit::ResourceNotFoundError)
156
+ it "should return an empty array if the legislator is not found" do
157
+ @legislator = Legislator.find(404)
111
158
 
112
- @legislator.should be_nil
159
+ @legislator.should eql([])
113
160
  end
114
161
  end
115
162
 
@@ -124,8 +171,43 @@ module GovKit::OpenStates
124
171
  l.should be_an_instance_of(Legislator)
125
172
  end
126
173
  end
174
+
175
+ it "should return an empty array if no legislators are found" do
176
+ lambda do
177
+ @legislators = Legislator.search(:state => 'zz')
178
+ end.should_not raise_error
179
+
180
+ @legislators.should be_an_instance_of(Array)
181
+ @legislators.length.should eql(0)
182
+ end
127
183
  end
128
184
 
129
185
  end
186
+
187
+ describe Committee do
188
+ context "#find" do
189
+ it "should find a specific committee" do
190
+ lambda do
191
+ @committee = Committee.find( 'MDC000012' )
192
+ end.should_not raise_error
193
+
194
+ @committee.should be_an_instance_of(Committee)
195
+ @committee['id'].should eql('MDC000012')
196
+ end
197
+ end
198
+ context "#search" do
199
+ it "should return an array of committees" do
200
+ lambda do
201
+ @committees = Committee.search( :state => 'md', :chamber => 'upper' )
202
+ end.should_not raise_error
203
+
204
+ @committees.should be_an_instance_of(Array)
205
+ @committees.length.should eql(20)
206
+ com = @committees[0]
207
+ com.should be_an_instance_of(Committee)
208
+ com['id'].should eql('MDC000009')
209
+ end
210
+ end
211
+ end
130
212
  end
131
213
  end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ module GovKit::SearchEngines
4
+ describe GovKit::SearchEngines do
5
+ before(:all) do
6
+ google_news_uri = "http://news.google.com/"
7
+
8
+ # An array of uris and filenames
9
+ # Use FakeWeb to intercept net requests;
10
+ # if a requested uri matches one of the following,
11
+ # then return the contents of the corresponding file
12
+ # as the result.
13
+ urls = [
14
+ [ "news?q=congress&output=rss&num=50", "google_news.response" ]
15
+ ]
16
+
17
+ urls.each do |u|
18
+ FakeWeb.register_uri(:get, "#{google_news_uri}#{u[0]}", :response => File.join(FIXTURES_DIR, 'search_engines', u[1]))
19
+ end
20
+ end
21
+
22
+ context "#GoogleNews" do
23
+ it "should return results when passed an array" do
24
+ lambda do
25
+ @mentions = GoogleNews.search(["congress"])
26
+ end.should_not raise_error
27
+
28
+ @mentions.should be_an_instance_of(Array)
29
+ @mentions.first.title.should == "White House and Congress Clear Trade Deal Hurdle"
30
+ @mentions.first.source.should == "New York Times"
31
+ end
32
+
33
+ it "should return results when passed a string" do
34
+ lambda do
35
+ @mentions = GoogleNews.search("congress")
36
+ end.should_not raise_error
37
+
38
+ @mentions.should be_an_instance_of(Array)
39
+ @mentions.first.title.should == "White House and Congress Clear Trade Deal Hurdle"
40
+ @mentions.first.source.should == "New York Times"
41
+ end
42
+ end
43
+ end
44
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  require 'rubygems'
2
- require 'spec'
2
+ require 'rspec'
3
3
  require 'fakeweb'
4
- require 'fakeweb_matcher'
5
4
  require File.dirname(__FILE__) + '/../lib/govkit'
6
5
 
7
6
  # prevent the use of `` in tests
8
- Spec::Runner.configure do |configuration|
7
+ RSpec.configure do |c|
9
8
  end
10
9
 
11
10
  # When running specs in TextMate, provide an rputs method to cleanly print objects into HTML display
@@ -0,0 +1,106 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ # Provides "String.singularize"
4
+ # which is used by resource_for_collection, in resource.rb
5
+ require 'active_support/inflector'
6
+
7
+ # Provides string.last()
8
+ # which is used by method_missing in resource.rb
9
+ require 'active_support/core_ext/string'
10
+
11
+ module GovKit::TransparencyData
12
+
13
+ describe GovKit::TransparencyData do
14
+ before(:all) do
15
+ base_uri = GovKit::TransparencyDataResource.base_uri.gsub(/\./, '\.')
16
+
17
+ urls = [
18
+ ['/contributions.json\?', 'contributions.response'],
19
+ ['/lobbying.json\?', 'lobbyists_find_all.response'],
20
+ ['/grants.json\?', 'grants_find_all.response'],
21
+ ['/entities.json\?apikey=&search=$', 'entities_search.response'],
22
+ ['/entities.json\?apikey=&search=harry%20pelosi', 'entities_search_limit_0.response'],
23
+ ['/entities.json\?apikey=&search=nancy%2Bpelosi', 'entities_search_limit_1.response']
24
+ ]
25
+
26
+ urls.each do |u|
27
+ FakeWeb.register_uri(:get, %r|#{base_uri}#{u[0]}|, :response => File.join(FIXTURES_DIR, 'transparency_data', u[1]))
28
+ end
29
+ end
30
+
31
+ it "should have the base uri set properly" do
32
+ [Contribution, Entity].each do |klass|
33
+ klass.base_uri.should == 'http://transparencydata.com/api/1.0'
34
+ end
35
+ end
36
+ end
37
+
38
+ describe Contribution do
39
+ context "#search" do
40
+ it "should find all contributions" do
41
+ lambda do
42
+ @contributions = Contribution.search
43
+ end.should_not raise_error
44
+
45
+ @contributions.length.should eql(8)
46
+ @contributions[0].contributor_city.should eql("ANCHORAGE")
47
+ end
48
+ end
49
+ end
50
+
51
+ describe Entity do
52
+ context "#search" do
53
+ it "should find all entities" do
54
+ lambda do
55
+ @entities = Entity.search
56
+ end.should_not raise_error
57
+
58
+ @entities.length.should eql(2)
59
+ @entities[0].name.should eql("Nancy Pelosi (D)")
60
+ @entities[1].name.should eql("Nancy Pelosi for Congress")
61
+ end
62
+
63
+ it 'should return an empty list when no elements found' do
64
+ lambda do
65
+ @entities = Entity.search( "harry pelosi" )
66
+ end.should_not raise_error
67
+
68
+ @entities.length.should eql(0)
69
+ end
70
+ it 'should return a list when one element found' do
71
+ lambda do
72
+ @entities = Entity.search( "nancy+pelosi" )
73
+ end.should_not raise_error
74
+
75
+ @entities.length.should eql(1)
76
+ end
77
+ end
78
+ end
79
+
80
+ describe LobbyingRecord do
81
+ context "#search" do
82
+ it "should find all contributions" do
83
+ lambda do
84
+ @records = LobbyingRecord.search
85
+ end.should_not raise_error
86
+
87
+ @records.length.should eql(5)
88
+ @records[0].lobbyists[0].lobbyist_name.should eql('Dunn, Jennifer B')
89
+ end
90
+ end
91
+ end
92
+
93
+ describe Grant do
94
+ context "#search" do
95
+ it "should find all contributions" do
96
+ lambda do
97
+ @records = Grant.search
98
+ end.should_not raise_error
99
+
100
+ @records.length.should eql(3)
101
+ @records[0].project_description.should eql('NATIONAL FLOOD INSURANCE PROGRAM')
102
+ end
103
+ end
104
+ end
105
+ end
106
+