Sha256: 829ec6d03d93dfc013b4f6b79c8341a659b554ab1c7ec2654ab1e8748c82e1c0

Contents?: true

Size: 997 Bytes

Versions: 15

Compression:

Stored size: 997 Bytes

Contents

require "spec_helper"
require "zipcoder/cacher/redis"


describe Zipcoder::Cacher::Redis do
  stub_redis_once = false

  before(:each) do
    unless stub_redis_once
      allow(Zipcoder::Cacher::Redis).to receive(:_create_redis_client) do
        RedisStub.new
      end
      Zipcoder.load_cache Zipcoder::Cacher::Redis.new
    end

    stub_redis_once = true
  end

  describe "#zip_info" do
    it "match" do
      info = "78748".zip_info
      expect(info[:city]).to eq("Austin")
    end

    it "matches city" do
      zips = Zipcoder.zip_info city: "Austin", state: "TX"
      expect(zips.count).to eq(47)
    end

    it "no match" do
      info = "78706".zip_info
      expect(info).to be_nil
    end
  end

  describe "#zip_cities" do
    it "match" do
      cities = "78748".zip_cities
      expect(cities.count).to eq(1)
      expect(cities[0][:city]).to eq("Austin")
    end

    it "no match" do
      cities = "78706".zip_cities
      expect(cities.count).to eq(0)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
zipcoder-0.9.1 spec/cacher_redis_spec.rb
zipcoder-0.9.0 spec/cacher_redis_spec.rb
zipcoder-0.8.4 spec/cacher_redis_spec.rb
zipcoder-0.8.3 spec/cacher_redis_spec.rb
zipcoder-0.8.2 spec/cacher_redis_spec.rb
zipcoder-0.8.1 spec/cacher_redis_spec.rb
zipcoder-0.8.0 spec/cacher_redis_spec.rb
zipcoder-0.7.4 spec/cacher_redis_spec.rb
zipcoder-0.7.3 spec/cacher_redis_spec.rb
zipcoder-0.7.2 spec/cacher_redis_spec.rb
zipcoder-0.7.1 spec/cacher_redis_spec.rb
zipcoder-0.7.0 spec/cacher_redis_spec.rb
zipcoder-0.6.1 spec/cacher_redis_spec.rb
zipcoder-0.6.0 spec/cacher_redis_spec.rb
zipcoder-0.5.0 spec/cacher_redis_spec.rb