Sha256: 928814b46c675bcba03253af26bab78176001369be154ee5b629425db3a843f4

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

module VoteSmart
  describe Official do
    
    describe "find_by_district_id" do
      
      def do_find
        Official.find_by_district_id("20451")
      end
      
      it_should_find :item => {:last_name => "Isakson", :id => "1721"}
    end
    
    describe "offices" do
      
      def do_find
        @official = Official.find_by_district_id("20451")
        @official.offices
      end
      
      it_should_find :count => 5, :first => {:address => {:type => "District"}},
                                  :last  => {:address => {:type => "Washington, D.C."}}
    end
    
    describe "find by address" do
      
      before :each do
        mcll4r = {"response" => {"state_lower" => {"district" => "1"}, "state_upper" => {"district" => "2"}}}
        Geocoding.should_receive(:get).once.and_return([mock("placemark", :latitude => 2, :longitude => 10)])
        Mcll4r.should_receive(:new).once.and_return(mock("mcll4r", :district_lookup => mcll4r))
      end
      
      def do_find
        Official.find_all_by_address "123 fake st", "atlanta", "ga", "30303"
      end
      
      it_should_find :count => 5, :first => {:last_name => "Handel", :title => "Secretary"},
                                  :last  => {:last_name => "Jackson", :title => "Senator"}
      
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netroots-ruby-votesmart-0.2.0 spec/vote_smart/official_spec.rb