Sha256: 118092586b0b09714fb42b124bbf3990c989431b3fc68abe36a96f758476ad8d

Contents?: true

Size: 681 Bytes

Versions: 6

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'

describe LongitudeValidator do
  context "Longitude has a valid value" do
    let(:klass) do
      Class.new do
        include ActiveModel::Validations
        attr_accessor :lon
        validates :lon, longitude: true
      end
    end

    subject { klass.new }

    it { should allow_value(-180).for(:lon) }
    it { should allow_value(180).for(:lon) }
    it { should allow_value(0).for(:lon) }
    it { should allow_value(9.33).for(:lon) }

    it { should_not allow_value(-181.1).for(:lon) }
    it { should_not allow_value(181.1).for(:lon) }

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

Version data entries

6 entries across 6 versions & 1 rubygems

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