Sha256: 62580eb5da8a459d8a34e4e2b39478c0adf63a8e261d11ee10a365f4d09c1b58

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

require 'spec_helper'

describe LatitudeValidator do
  let(:klass) do
    Class.new do
      include ActiveModel::Validations
      attr_accessor :lat
      validates :lat, latitude: true
    end
  end

  subject { klass.new }

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
missing_validators-2.3.0 spec/validators/latitude_validator_spec.rb
missing_validators-2.2.0 spec/validators/latitude_validator_spec.rb
missing_validators-2.1.0 spec/validators/latitude_validator_spec.rb