Sha256: 77120ac6239843ac3a92409aab1b8484ceeb6e781e1d0d1a7d3658a697d2cee9

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 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 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.0 spec/lat_and_long_spec.rb