Sha256: 951dabbeed1237adbbe3a337e6cb5c41191e62818e44dc67f8b9ae0ff35753bc
Contents?: true
Size: 839 Bytes
Versions: 17
Compression:
Stored size: 839 Bytes
Contents
require 'spec_helper' describe LatitudeValidator do context "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
17 entries across 17 versions & 3 rubygems