Sha256: 5a3cdc9b7d311a0e678a9b579e0d96b0fec19ff12d0355609a5c6a80626938d7

Contents?: true

Size: 847 Bytes

Versions: 17

Compression:

Stored size: 847 Bytes

Contents

require 'spec_helper'

describe LongitudeValidator do

  context "has a valid value" do
    let(:klass) do
      Class.new do
        include ActiveModel::Validations
        attr_accessor :lon, :name
        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('').for(:lon) }
    it { should_not allow_value(' ').for(:lon) }
    it { should_not allow_value(nil).for(:lon) }
    it { should_not allow_value(-181.1).for(:lon) }
    it { should_not allow_value(181.1).for(:lon) }

    it { should ensure_valid_longitude_format_of(:lon) }
    it { should_not ensure_valid_longitude_format_of(:name) }
  end

end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
active_validation-1.0.0 spec/lib/longitude_validator_spec.rb
yukonisuru-1.0.0 spec/lib/longitude_validator_spec.rb
yukonisuru-0.0.1 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.12 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.11 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.10 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.9 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.8 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.7 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.6 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.5 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.4 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.3 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.2 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.1 spec/lib/longitude_validator_spec.rb
flash_validators-3.0.0 spec/lib/longitude_validator_spec.rb
flash_validators-1.1.0 spec/lib/longitude_validator_spec.rb