Sha256: 614ac173d480d9c51d7fa35a0475828d3d1812521b18541905698e333396a31a

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 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) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
missing_validators-0.8.1 spec/validators/longitude_validator_spec.rb
missing_validators-0.8.0 spec/validators/longitude_validator_spec.rb