Sha256: 787a822ed640e7483cc5551d807cecc0b34aa79247c568eab0f3689e0b7dc9eb
Contents?: true
Size: 848 Bytes
Versions: 2
Compression:
Stored size: 848 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, :name 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('').for(:lat) } it { should_not allow_value(' ').for(:lat) } it { should_not allow_value(nil).for(:lat) } it { should_not allow_value(-90.1).for(:lat) } it { should_not allow_value(90.1).for(:lat) } it { should ensure_valid_latitude_format_of(:lat) } it { should_not ensure_valid_latitude_format_of(:name) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flash_validators-1.0.0 | spec/lib/latitude_validator_spec.rb |
flash_validators-0.0.1 | spec/lib/latitude_validator_spec.rb |