Sha256: 1304c4b5f174e224a3c3c5feb7c7be8c97b6df07e72cfcff5cf938ed21f23aab

Contents?: true

Size: 1.39 KB

Versions: 6

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe(RCAP::CAP_1_2::Point) do
  before(:each) do
    @point_constructor = lambda do |point|
      point.lattitude = 0
      point.longitude = 0
    end
  end

  describe('is not valid if') do
    before(:each) do
      @point = RCAP::CAP_1_2::Point.new(&@point_constructor)
      @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::CAP_1_2::Point::MAX_LONGITUDE + 1
      @point.should_not(be_valid)
      @point.longitude = RCAP::CAP_1_2::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::CAP_1_2::Point::MAX_LATTITUDE + 1
      @point.should_not(be_valid)
      @point.lattitude = RCAP::CAP_1_2::Point::MIN_LATTITUDE - 1
      @point.should_not(be_valid)
    end
  end

  context('when exported') do
    before(:each) do
      @point = RCAP::CAP_1_2::Point.new(&@point_constructor)
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rcap-2.7.4 spec/cap_1_2/point_spec.rb
rcap-2.7.3 spec/cap_1_2/point_spec.rb
rcap-2.7.0 spec/cap_1_2/point_spec.rb
rcap-2.6.0 spec/cap_1_2/point_spec.rb
rcap-2.5.1 spec/cap_1_2/point_spec.rb
rcap-2.5.0 spec/cap_1_2/point_spec.rb