Sha256: 56b9dd224dfb787d74fc2a585238d91d5b2617926decff88f4f02a578150e842

Contents?: true

Size: 765 Bytes

Versions: 2

Compression:

Stored size: 765 Bytes

Contents

require 'spec_helper'

describe SeventeenMon do
  describe "# IPDB loading" do
    it 'should be eager loaded' do
      ipdb_1 = SM::IPDB.instance
      ipdb_2 = SM::IPDB.instance

      ipdb_1.object_id.should == ipdb_2.object_id
    end
  end

  describe "# query test" do
    before do
      @ip_param = "129.215.5.255"
      @url_params = {
          address: "www.ruby-lang.com",
          protocol: "http"
        }
    end

    it "can find location by ip" do
      result = SM.find_by_ip @ip_param
      result.should include(:city)
      result.should include(:country)
    end

    it "can find location by address" do
      result = SM.find_by_address @url_params
      result.should include(:city)
      result.should include(:country)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seventeen_mon-0.0.2 spec/seventeen_mon_spec.rb
seventeen_mon-0.0.1 spec/seventeen_mon_spec.rb