Sha256: 60ee055fd2ea944c7bba530fcaf7bada988cf420ae66fdefeb051a9e8a4a7dcc

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'geomancer'

describe Geomancer do
  it "extracts basic latitude" do
    Geomancer.extract_lat_and_long("latitude: 41.9040 longitude: 12.4530").should_not be_nil
  end
  
  it "extracts abbreviated latitude" do
    Geomancer.extract_lat_and_long("lat: 41.9040 long: 12.4530").should_not be_nil
  end

  it "extracts comma separated stuff" do
    Geomancer.extract_lat_and_long("lat: 41.9040, long: 12.4530").should_not be_nil
  end

  it "doesn't require colons" do
    Geomancer.extract_lat_and_long("latitude 41.9040, longitude 12.4530").should_not be_nil
  end

  it "doesn't extract only latitude" do
    Geomancer.extract_lat_and_long("lat: 41.9040").should be_nil
  end

  it "doesn't extract only longitude" do
    Geomancer.extract_lat_and_long("longitude: 41.9040").should be_nil
  end

  it "extracts actual numbers" do
    lat_and_long = Geomancer.extract_lat_and_long("lat: 41.9040, long: 12.4530")
    lat_and_long[:latitude].should be_a Float
    lat_and_long[:longitude].should be_a Float
  end

  it "extracts negative numbers" do
    lat_and_long = Geomancer.extract_lat_and_long("lat: 37.2350, long: -115.8111")
    lat_and_long[:longitude].should == -115.8111
  end
  

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geomancer-0.7.1 spec/lat_and_long_spec.rb