Sha256: 1b0bc10915ea7370cb72b87df9b61a5ba7f7695272c221bea4754496aa914c1d

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe( RCAP::Point ) do
  describe( 'is not valid if' ) do
    before( :each ) do
      @point = RCAP::Point.new( :lattitude => 0, :longitude => 0 )
      @point.should( be_valid )
    end

    it( 'does not have a longitude defined' ) do
      @point.longitude = nil
      @point.should_not( be_valid )
    end

    it( 'does not have a valid longitude' ) do
      @point.longitude = RCAP::Point::MAX_LONGITUDE + 1
      @point.should_not( be_valid )
      @point.longitude = RCAP::Point::MIN_LONGITUDE - 1
      @point.should_not( be_valid )
    end

    it( 'does not have a lattitude defined' ) do
      @point.lattitude = nil
      @point.should_not( be_valid )
    end

    it( 'does not have a valid lattitude' ) do
      @point.lattitude = RCAP::Point::MAX_LATTITUDE + 1
      @point.should_not( be_valid )
      @point.lattitude = RCAP::Point::MIN_LATTITUDE - 1
      @point.should_not( be_valid )
    end
  end

  context( 'when exported' ) do
    before( :each ) do
      @point = RCAP::Point.new( :lattitude => 1, :longitude => 1 )
    end

    context( 'to hash' ) do
      it( 'should export correctly' ) do
        @point.to_h.should == { RCAP::Point::LATTITUDE_KEY => 1, RCAP::Point::LONGITUDE_KEY => 1 }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
rcap-rails-generators-1.3 spec/point_spec.rb
rcap-0.4 spec/point_spec.rb