Sha256: 5a3880080bd5396fcfb3510bd897ad3049f44e96bda2b4f4d326f001ce01a319

Contents?: true

Size: 438 Bytes

Versions: 2

Compression:

Stored size: 438 Bytes

Contents

require "test_helper"

class Ipv4Test < Minitest::Test
  let(:user) { User.new }

  test "is valid" do
    User.validates_ip_address :url, only: :v4
    user.url = "192.168.1.2"

    assert user.valid?
  end

  test "is invalid" do
    User.validates_ip_address :url, only: :v4
    user.url = "FE80:0000:0000:0000:0202:B3FF:FE1E:8329"

    refute user.valid?
    assert_includes user.errors[:url], "is not a valid IPv4 address"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validators-2.8.1 test/validators/validates_ip_address/ipv4_test.rb
validators-2.8.0 test/validators/validates_ip_address/ipv4_test.rb