Permalink
Browse files

Add specs

  • Loading branch information...
sferik committed Jun 19, 2011
1 parent b528271 commit e317f3de8ddc3c7e895d0ff3b6b7e2ab8ba54cff
@@ -0,0 +1,116 @@
+require 'helper'
+
+describe Congress::Client do
+ before do
+ @client = Congress::Client.new
+ Congress.configure do |config|
+ config.key = "abc123"
+ end
+ end
+
+ describe '#bills' do
+ before do
+ stub_get('/api/v1/bills.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('bills.json'))
+ end
+
+ it "should fetch bills introduced bills and resolutions in Congress" do
+ bills = @client.bills
+ a_get('/api/v1/bills.json?apikey=abc123').
+ should have_been_made
+ bills['count'].should == 17836
+ bills['bills'].first.bill_id.should == "hres314-112"
+ end
+ end
+
+ describe '#votes' do
+ before do
+ stub_get('/api/v1/votes.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('votes.json'))
+ end
+
+ it "should fetch votes taken in Congress" do
+ votes = @client.votes
+ a_get('/api/v1/votes.json?apikey=abc123').
+ should have_been_made
+ votes['count'].should == 5103
+ votes['votes'].first.roll_id.should == "s91-2011"
+ end
+ end
+
+ describe '#amendments' do
+ before do
+ stub_get('/api/v1/amendments.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('amendments.json'))
+ end
+
+ it "should fetch amendments to bills and resolutions offered in Congress" do
+ amendments = @client.amendments
+ a_get('/api/v1/amendments.json?apikey=abc123').
+ should have_been_made
+ amendments['count'].should == 6606
+ amendments['amendments'].first.bill_id.should == "s679-112"
+ end
+ end
+
+ describe '#videos' do
+ before do
+ stub_get('/api/v1/videos.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('videos.json'))
+ end
+
+ it "should fetch videos from the U.S. House of Representatives and from the White House" do
+ videos = @client.videos
+ a_get('/api/v1/videos.json?apikey=abc123').
+ should have_been_made
+ videos['count'].should == 1034
+ videos['videos'].first.video_id.should == "whitehouse-1308389400-weekly-address-celebrating-fathers"
+ end
+ end
+
+ describe '#floor_updates' do
+ before do
+ stub_get('/api/v1/floor_updates.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('floor_updates.json'))
+ end
+
+ it "should fetch updates from the floor of each chamber of Congress" do
+ floor_updates = @client.floor_updates
+ a_get('/api/v1/floor_updates.json?apikey=abc123').
+ should have_been_made
+ floor_updates['count'].should == 2183
+ floor_updates['floor_updates'].first.chamber.should == "senate"
+ end
+ end
+
+ describe '#committee_hearings' do
+ before do
+ stub_get('/api/v1/committee_hearings.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('committee_hearings.json'))
+ end
+
+ it "should fetch upcoming scheduled committee hearings in the House and Senate" do
+ committee_hearings = @client.committee_hearings
+ a_get('/api/v1/committee_hearings.json?apikey=abc123').
+ should have_been_made
+ committee_hearings['count'].should == 482
+ committee_hearings['committee_hearings'].first.committee_id.should == "SSVA"
+ end
+ end
+
+ describe '#documents' do
+ before do
+ stub_get('/api/v1/documents.json?apikey=abc123').
+ to_return(:status => 200, :body => fixture('documents.json'))
+ end
+
+ it "should fetch links to various kinds of documents produced by agencies within Congress" do
+ documents = @client.documents
+ a_get('/api/v1/documents.json?apikey=abc123').
+ should have_been_made
+ documents['count'].should == 124
+ documents['documents'].first.document_type.should == "whip_notice"
+ end
+ end
+
+end
View
@@ -0,0 +1,18 @@
+require 'helper'
+
+describe Congress do
+ describe ".new" do
+ it "should return a Congress::Client" do
+ Congress.new.should be_a Congress::Client
+ end
+ end
+
+ describe ".configure" do
+ it "should set 'name' and 'pass'" do
+ Congress.configure do |c|
+ c.key = "abc123"
+ end
+ Congress.key.should == "abc123"
+ end
+ end
+end

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1 @@
+{"committee_hearings":[{"session":112,"legislative_day":"2011-07-29","occurs_at":"2011-07-29T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Veterans' Affairs","committee_id":"SSVA","chamber":"senate"},"description":"Business meeting to consider pending calendar business.","committee_id":"SSVA","room":"SR-418","chamber":"senate"},{"session":112,"legislative_day":"2011-07-08","occurs_at":"2011-07-08T13:30:00Z","time_of_day":"09:30AM","committee":{"name":"Senate Committee on Veterans' Affairs","committee_id":"SSVA","chamber":"senate"},"description":"Hearings to examine pending calendar business.","committee_id":"SSVA","room":"SR-418","chamber":"senate"},{"session":112,"legislative_day":"2011-06-30","occurs_at":"2011-06-30T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Foreign Relations","committee_id":"SSFR","chamber":"senate"},"description":"Hearings to examine the state of democracy in the Americas.","committee_id":"SSFR","room":"SD-419","chamber":"senate"},{"session":112,"legislative_day":"2011-06-29","occurs_at":"2011-06-29T18:30:00Z","time_of_day":"02:30PM","committee":{"name":"Senate Committee on Veterans' Affairs","committee_id":"SSVA","chamber":"senate"},"description":"Business meeting to consider pending calendar business.","committee_id":"SSVA","room":"SR-418","chamber":"senate"},{"session":112,"legislative_day":"2011-06-29","occurs_at":"2011-06-29T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Veterans' Affairs","committee_id":"SSVA","chamber":"senate"},"description":"Business meeting to consider pending calendar business.","committee_id":"SSVA","room":"SR-418","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T18:30:00Z","time_of_day":"02:30PM","committee":{"name":"Senate Select Committee on Intelligence","committee_id":"SLIN","chamber":"senate"},"description":"Hearings to examine the nomination of David H. Petraeus, of New Hampshire, to be Director of the Central Intelligence Agency.","committee_id":"SLIN","room":"SH-216","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T18:30:00Z","time_of_day":"02:30PM","committee":{"name":"Senate Committee on Energy and Natural Resources","committee_id":"SSEG","chamber":"senate"},"description":"Hearings to examine S.500, to direct the Secretary of the Interior to convey certain Federal features of the electric distribution system to the South Utah Valley Electric Service District, S.715, to reinstate and transfer certain hydroelectric licenses and extend the deadline for commencement of construction of certain hydroelectric projects, S.802, to authorize the Secretary of the Interior to allow the storage and conveyance of nonproject water at the Norman project in Oklahoma, S.997, to authorize the Secretary of the Interior to extend a water contract between the United States and the East Bench Irrigation District, S.1033, to amend the Reclamation Wastewater and Groundwater Study and Facilities Act to authorize the Secretary of the Interior to participate in the City of Hermiston, Oregon, water recycling and reuse project, and S.1047, to amend the Reclamation Projects Authorization and Adjustment of 1992 to require the Secretary of the Interior, acting through the Bureau of Reclamation, to take actions to improve environmental conditions in the vicinity of the Leadville Mine Drainage Tunnel in Lake County, Colorado, an original bill entitled, "Bureau of Reclamation Fish Recovery Programs Reauthorization Act of 2011", and an original bill entitled, "Fort Sumner Project Title Conveyance Act".","committee_id":"SSEG","room":"SD-366","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T18:15:00Z","time_of_day":"02:15PM","committee":{"name":"Senate Committee on Indian Affairs","committee_id":"SLIA","chamber":"senate"},"description":"An oversight hearing to examine the "Indian Reorganization Act" 75 years later, focusing on restoring tribal homelands and promote self-determination.","committee_id":"SLIA","room":"SD-628","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T18:15:00Z","time_of_day":"02:15PM","committee":{"name":"Senate Committee on Foreign Relations","committee_id":"SSFR","chamber":"senate"},"description":"Joint hearings to examine rebuilding Haiti in the Martelly era.","committee_id":"SSFR","room":"SD-419","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Banking, Housing, and Urban Affairs","committee_id":"SSBK","chamber":"senate"},"description":"Hearings to examine reauthorization of the National Flood Insurance Program, part II.","committee_id":"SSBK","room":"SD-538","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on the Judiciary","committee_id":"SSJU","chamber":"senate"},"description":"Business meeting to consider S.1145, to amend title 18, United States Code, to clarify and expand Federal criminal jurisdiction over Federal contractors and employees outside the United States, and the nominations of Steve Six, of Kansas, to be United States Circuit Judge for the Tenth Circuit, Major General Marilyn A. Quagliotti, USAF (Ret.), of Virginia, to be Deputy Director for Supply Reduction, Office of National Drug Control Policy, Executive Office of the President, and Alfred Cooper Lomax, to be United States Marshal for the Western District of Missouri, and David L. McNulty, to be United States Marshal for the Northern District of New York, both of the Department of Justice.","committee_id":"SSJU","room":"SD-226","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Foreign Relations","committee_id":"SSFR","chamber":"senate"},"description":"Business meeting to consider the nominations of William J. Burns, of Maryland, to be Deputy Secretary, Gary Locke, of Washington, to be Ambassador to the People's Republic of China, and Ryan C. Crocker, of Washington, to be Ambassador to the Islamic Republic of Afghanistan, all of the Department of State; to be immediately followed by a hearing to examine evaluating goals and progress in Afghanistan and Pakistan.","committee_id":"SSFR","room":"SD-106","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Health, Education, Labor, and Pensions","committee_id":"SSHR","chamber":"senate"},"description":"Hearings to examine middle class families.","committee_id":"SSHR","room":"SD-430","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Commerce, Science, and Transportation","committee_id":"SSCM","chamber":"senate"},"description":"Hearings to examine U.S. Coast Guard budget and oversight.","committee_id":"SSCM","room":"SR-253","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T14:00:00Z","time_of_day":"10:00AM","committee":{"name":"Senate Committee on Homeland Security and Governmental Affairs","committee_id":"SSGA","chamber":"senate"},"description":"Hearings to examine Federal regulation, focusing on a review of legislative proposals.","committee_id":"SSGA","room":"SD-342","chamber":"senate"},{"session":112,"legislative_day":"2011-06-23","occurs_at":"2011-06-23T13:30:00Z","time_of_day":"09:30AM","committee":{"name":"Senate Committee on Agriculture, Nutrition, and Forestry","committee_id":"SSAF","chamber":"senate"},"description":"Hearings to examine farm bill accountability, focusing on the importance of measuring performance, while eliminating duplication and waste.","committee_id":"SSAF","room":"SD-G50","chamber":"senate"},{"session":112,"legislative_day":"2011-06-22","occurs_at":"2011-06-22T18:30:00Z","time_of_day":"02:30PM","committee":{"name":"Senate Committee on the Judiciary","committee_id":"SSJU","chamber":"senate"},"description":"Hearings to examine the nominations of Christopher Droney, of Connecticut, to be United States Circuit Judge for the Second Circuit, Robert David Mariani, to be United States District Judge for the Middle District of Pennsylvania, Cathy Bissoon, and Mark Raymond Hornak, both to be a United States District Judge for the Western District of Pennsylvania, and Robert N. Scola, Jr., to be United States District Judge for the Southern District of Florida.","committee_id":"SSJU","room":"SD-226","chamber":"senate"},{"session":112,"legislative_day":"2011-06-22","occurs_at":"2011-06-22T18:00:00Z","time_of_day":"02:00PM","committee":{"name":"Senate Commission on Security and Cooperation in Europe","committee_id":"JCSE","chamber":"senate"},"description":"Hearings to examine addressing ethnic tension in Kyrgyzstan, focusing on the report of the International Commission of Inquiry into the events in Southern Kyrgyzstan in June 2010.","committee_id":"JCSE","room":"RHOB-2118","chamber":"senate"},{"session":112,"legislative_day":"2011-06-22","occurs_at":"2011-06-22T17:30:00Z","time_of_day":"01:30PM","committee":{"name":"Senate Committee on Homeland Security and Governmental Affairs","committee_id":"SSGA","chamber":"senate"},"description":"Hearings to examine transforming lives through diabetes research.","committee_id":"SSGA","room":"SD-G50","chamber":"senate"},{"session":112,"legislative_day":"2011-06-22","occurs_at":"2011-06-22T15:30:00Z","time_of_day":"11:30AM","committee":{"name":"Joint Committee on Printing","committee_id":"JSPR","chamber":"joint"},"description":"Organizational business meeting to consider committee's rules of procedure and budget for the 112th Congress.","committee_id":"JSPR","room":"SC-6","chamber":"senate"}],"count":482,"page":{"page":1,"count":20,"per_page":20}}
@@ -0,0 +1 @@
+{"documents":[{"session":112,"notice_type":"weekly","url":"http://www.democraticwhip.gov/content/weekly-whip-friday-june-17-2011","for_date":"2011-06-17","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-17T23:45:09Z"},{"session":112,"notice_type":"nightly","url":"http://www.democraticwhip.gov/content/nightly-whip-thursday-june-16-2011","for_date":"2011-06-16","document_type":"whip_notice","party":"D","chamber":"house","posted_at":"2011-06-16T21:21:36Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-thursday-june-16-2011","for_date":"2011-06-16","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-16T13:12:19Z"},{"session":112,"notice_type":"daily","url":"http://majorityleader.gov/floor/6-16-11.pdf","for_date":"2011-06-16","party":"R","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-16T12:00:00Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-wednesday-june-15-2011","for_date":"2011-06-15","document_type":"whip_notice","party":"D","chamber":"house","posted_at":"2011-06-15T13:08:00Z"},{"session":112,"notice_type":"daily","url":"http://www.gpo.gov/fdsys/pkg/BILLS-112hr2112rh/pdf/BILLS-112hr2112rh.pdf","for_date":"2011-06-15","party":"R","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-15T12:00:00Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-tuesday-june-14-2011","for_date":"2011-06-14","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-14T13:48:18Z"},{"session":112,"notice_type":"daily","url":"http://www.gpo.gov/fdsys/pkg/BILLS-112hr2055rh/pdf/BILLS-112hr2055rh.pdf","for_date":"2011-06-14","party":"R","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-14T12:00:00Z"},{"session":112,"notice_type":"nightly","url":"http://www.democraticwhip.gov/content/nightly-whip-monday-june-13-2011","for_date":"2011-06-13","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-13T23:56:11Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-monday-june-13-2011","for_date":"2011-06-13","document_type":"whip_notice","party":"D","chamber":"house","posted_at":"2011-06-13T13:34:26Z"},{"session":112,"notice_type":"weekly","url":"http://majorityleader.gov/floor/6-13-11.pdf","for_date":"2011-06-13","party":"R","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-13T12:00:00Z"},{"session":112,"notice_type":"daily","url":"http://www.gpo.gov/fdsys/pkg/BILLS-112hr2055rh/pdf/BILLS-112hr2055rh.pdf","for_date":"2011-06-13","party":"R","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-13T12:00:00Z"},{"session":112,"notice_type":"nightly","url":"http://www.democraticwhip.gov/content/nightly-whip-sunday-june-12-2011","for_date":"2011-06-12","document_type":"whip_notice","party":"D","chamber":"house","posted_at":"2011-06-12T23:29:45Z"},{"session":112,"notice_type":"weekly","url":"http://www.democraticwhip.gov/content/weekly-whip-friday-june-10-2011","for_date":"2011-06-10","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-10T21:47:04Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-friday-june-3-2011","for_date":"2011-06-03","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-03T13:00:44Z"},{"session":112,"notice_type":"daily","url":"http://rules.house.gov/Media/file/PDF_112_1/Floor_Text/BOEHNE_002_xml(1).pdf","for_date":"2011-06-03","document_type":"whip_notice","party":"R","chamber":"house","posted_at":"2011-06-03T12:00:00Z"},{"session":112,"notice_type":"nightly","url":"http://www.democraticwhip.gov/content/nightly-whip-thursday-june-2-2011","for_date":"2011-06-03","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-03T03:32:58Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-thursday-june-2-2011","for_date":"2011-06-02","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-02T13:41:18Z"},{"session":112,"notice_type":"daily","url":"http://www.gpo.gov/fdsys/pkg/BILLS-112hr2017rh/pdf/BILLS-112hr2017rh.pdf","for_date":"2011-06-02","party":"R","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-02T12:00:00Z"},{"session":112,"notice_type":"daily","url":"http://www.democraticwhip.gov/content/daily-whip-wednesday-june-1-2011","for_date":"2011-06-01","party":"D","document_type":"whip_notice","chamber":"house","posted_at":"2011-06-01T14:06:39Z"}],"count":124,"page":{"page":1,"count":20,"per_page":20}}
Oops, something went wrong.

0 comments on commit e317f3d

Please sign in to comment.