Sha256: d39ce97b4f12fe175804a2f260a8c6a98649cd40d662727d3f870829779adbf6

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

require "spec_helper"

describe Ziptastic do
  describe "#query" do
    context "valid zipcode" do 
      context "w/ results" do      
        it "should return an array of results" do
          Ziptastic.search("16335").count.should eq 3
        end
      
        it "each result should have city, state, and country" do
          meadville = Ziptastic.search("16335")[0]
          
          meadville[:city].should eq "MEADVILLE"
          meadville[:state].should eq "PA"
          meadville[:country].should eq "US"
        end
      end
      
      context "no result" do
        it "should return false" do
          Ziptastic.search("8675309").should eq []
        end
      end
    end
        
    context "invalid zipcode" do
      it "should return an exception" do
        expect { Ziptastic.search("16335a") }.to raise_error(Ziptastic::NotZipCode, "16335a is not a zip code!")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ziptastic-0.1.0 spec/ziptastic_spec.rb