validators 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dff27e8c867e5bec933ca7d0a48d39a9035d305fce4abc45fdf172aad10ef832
4
- data.tar.gz: b84c8d392ecca8b049b8c200057d9790cda2d7837d5107a0c41a7f68d1b0edaa
3
+ metadata.gz: 414477d8902b0d37dc91199fe230b37e37131a33bcfec8e61ea8b187f6d30532
4
+ data.tar.gz: '084b6d7df7b47f7753790955ab5d403d6c7d1584f808ce65e29c8a9da976d875'
5
5
  SHA512:
6
- metadata.gz: 367bc5f122844017dd15e14d5f44dbc9837ac46d5492d3e8fe892f1525a470a624235432b86644078f81a46e240857a26745f885ebedd1d6096f7dff1dc05df6
7
- data.tar.gz: 2ab57842a75aaec739b70ed0f29efd5d227a6ec857b0814bbbaee5b75e66382154e4f763c5f6750a7692cb61497612050dc79681c21d2edca7a7f7f3cf55cc37
6
+ metadata.gz: 3f6dedd7eb97652ea82ebb4ba3cab3ea089b8219c3e158dd93e3ff57316fb7e42053a5db72cfdbce3d0d5bd897b431b7348ba4438240d636c3b013bfb00a4ddc
7
+ data.tar.gz: aea4115b4b68b0d2870f194eba56a8b92b17aaa62a35e86ea2e9e9d1748850d90dc6064b461dad7f2f3be2e5786baff6a54bed6385de8d6cb1a2f0b682977afa
@@ -9,9 +9,9 @@ module Validators
9
9
  end
10
10
 
11
11
  def self.host_with_valid_tld?(host)
12
- return false if host.split(".").size == 1
12
+ return false if host.to_s.split(".").size == 1
13
13
 
14
- valid? host[/\.([^.]+)$/, 1].to_s.downcase
14
+ valid?(host[/\.([^.]+)$/, 1].to_s.downcase)
15
15
  end
16
16
 
17
17
  def self.valid?(tld)
@@ -4,7 +4,7 @@ module Validators
4
4
  module Version
5
5
  MAJOR = 3
6
6
  MINOR = 0
7
- PATCH = 0
7
+ PATCH = 1
8
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
10
10
  end
@@ -82,4 +82,16 @@ class ValidatesEmailFormatOfTest < Minitest::Test
82
82
  refute user.valid?
83
83
  assert_includes user.errors[:email], "does not have a valid hostname"
84
84
  end
85
+
86
+ test "rejects nil emails" do
87
+ user = Buyer.new(email: nil)
88
+
89
+ refute user.valid?
90
+ end
91
+
92
+ test "rejects nil emails when validating tld" do
93
+ user = EmailWithTLD.new(email: nil)
94
+
95
+ refute user.valid?
96
+ end
85
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira