Sha256: 080342920ea322b0621ee7d0d5430c45a45ff8850008e5346842d43f2feee84a

Contents?: true

Size: 674 Bytes

Versions: 6

Compression:

Stored size: 674 Bytes

Contents

require 'spec_helper'

describe LatitudeValidator do
  context "Latitude has a valid value" do
    let(:klass) do
      Class.new do
        include ActiveModel::Validations
        attr_accessor :lat
        validates :lat, latitude: true
      end
    end

    subject { klass.new }

    it { should allow_value(-90).for(:lat) }
    it { should allow_value(90).for(:lat) }
    it { should allow_value(0).for(:lat) }
    it { should allow_value(9.33).for(:lat) }

    it { should_not allow_value(-90.1).for(:lat) }
    it { should_not allow_value(90.1).for(:lat) }

    it { should_not allow_value(nil).for(:lat) }
    it { should_not allow_value('').for(:lat) }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
missing_validators-1.1.0 spec/validators/latitude_validator_spec.rb
missing_validators-1.0.1 spec/validators/latitude_validator_spec.rb
missing_validators-0.9.1 spec/validators/latitude_validator_spec.rb
missing_validators-0.9 spec/validators/latitude_validator_spec.rb
missing_validators-0.8.3 spec/validators/latitude_validator_spec.rb
missing_validators-0.8.2 spec/validators/latitude_validator_spec.rb